The Delta Lake Transaction Log (_delta_log), Explained With Real Commits
A Delta table looks like a normal folder of Parquet files. What makes it a table is the `_delta_log` folder next to them: an ordered list of commits that says which files are part of the table at each version. Once you have seen a few commits, ACID, time travel and MERGE stop being magic.
The folder
/data/outputs/orders_history/
part-00000-….snappy.parquet
part-00000-….snappy.parquet
_delta_log/
00000000000000000000.json ← version 0
00000000000000000001.json ← version 1
00000000000000000002.json ← version 2Every commit is one JSON file, numbered from 0. After every 10 commits Delta also writes a checkpoint (a Parquet summary), so readers do not have to replay the whole log.
What is inside a commit
Each line of a commit file is one action:
- **commitInfo**: the operation (WRITE, UPDATE, DELETE, MERGE, RESTORE), when it ran, and metrics such as numOutputRows, numUpdatedRows, numDeletedRows.
- **add**: a Parquet file that is now part of the table, with its size and statistics.
- **remove**: a file that is no longer part of the table. It stays on disk until VACUUM, which is why time travel works.
- **metaData** and **protocol**: the schema and the reader and writer versions, in the first commit and whenever they change.
Why an UPDATE removes a file
Parquet files are never edited. To update 204 rows, Delta rewrites the files that hold them: the commit has one remove (the old file) and one add (the new file, with 204 rows changed and the rest copied). The Spark Lab shows this as "~204 updated, =796 copied unchanged, files +1 −1".
See it yourself
1. Open the Spark Lab and run lesson **D2. Update, delete, append**.
2. The **Delta log** panel opens: v0 WRITE, v1 UPDATE, v2 DELETE, v3 WRITE (append).
3. Click **JSON** on any commit to read the actions, or copy the docker command to list the folder in your terminal: `docker exec spark-lab ls -l /data/outputs/orders_history/_delta_log`.
How a reader uses the log
To read version N, Spark replays commits 0 to N (or starts from the latest checkpoint): every add makes a file part of the table, every remove takes it out. The files left over are the table. That is also how `versionAsOf` reads an old version.
Also try
How to use the Spark Lab: step by step
- Start the Spark Lab and connect
- Run lesson D2
- Open the Delta log panel
- Click JSON on a commit
When to use the Spark Lab
- Understanding how Delta gives ACID on files
- Debugging why a table has many small files
- Explaining time travel in an interview
- Checking what a MERGE really changed
Frequently asked questions
Do I need Databricks to learn Delta Lake?
No. Delta Lake is open source. The Spark Lab runs Spark with Delta Lake on your own computer in Docker, free, with no account.
Which Delta Lake version does the lab use?
Delta Lake 3.2 on Apache Spark 3.5, with the jars baked into the lab image so it works offline.
Where are my Delta tables stored?
In /data/outputs inside the lab, which is a Docker volume (datautility-spark-data) on your computer. Nothing is uploaded.
Can I see the _delta_log files?
Yes. The Delta log panel under the editor lists every commit with its operation and row counts, and shows the raw JSON. You can also run docker exec spark-lab ls /data/outputs/<table>/_delta_log.