Databricks & Lakehouse
Delta Lake & the Lakehouse: What the Transaction Log Actually Does
DataForge Series: Databricks Data Engineer Associate - Part 1 of 16

There’s a moment every data engineer eventually hits.
You’re running a job that reads a large Parquet table. Midway through, another job starts writing to the same location. Your read finishes. The numbers look slightly wrong. Not catastrophically wrong — just slightly wrong. You run it again. Different result.
This is what it feels like when your storage layer has no concept of transactions.
The Lakehouse architecture exists to solve this. And Delta Lake is the mechanism that makes it real. Not as a marketing story — as an engineering reality with specific trade-offs and specific failure modes you need to understand.
Let’s go deep.
TL;DR
If you’re short on time, here’s what this article builds toward:
Delta Lake is not a file format. It’s a transaction log (_delta_log/) layered on top of ordinary Parquet files. Every read resolves against an immutable snapshot of active files reconstructed by replaying that log. This is how concurrent reads stay consistent during writes, how time travel works, and why VACUUM is destructive.
By the end of this article you’ll be able to:
- Explain exactly what happens inside
_delta_log/on every write, checkpoint, and delete - Trace how a specific table version gets reconstructed from commit history
- Identify the three most common production failure modes involving Delta — and why they’re all log-related
- Reason through any exam scenario involving ACID guarantees, time travel, schema drift, or managed vs external tables
Exam relevance: ~4–6 questions on the associate exam touch Delta Lake mechanics directly. Another 6–8 touch it indirectly through Unity Catalog, ingestion patterns, and optimization. This is the foundational article of the series.
The Problem Delta Lake Was Solving
Before the Lakehouse, the data engineering world had a fork:
Data Warehouses (Redshift, Snowflake, BigQuery) gave you ACID transactions, schema enforcement, query performance. But they were expensive, opaque, and locked your data inside proprietary formats. You couldn’t run ML frameworks on the raw files. You couldn’t cheaply store petabyte-scale unstructured data.
Data Lakes (HDFS, S3, GCS with raw Parquet) gave you cheap object storage at any scale. Open formats. ML workloads could read directly. But there was no transactional consistency. No schema enforcement by default. No audit trail. “Just drop files in S3” is a valid data lake pattern — and it’s why data lakes turned into data swamps.
The Lakehouse bet was: keep the cheap open storage of a data lake, add the reliability guarantees of a data warehouse. The mechanism that enables this is Delta Lake’s transaction log.
What Delta Lake Actually Is
Delta Lake is not a file format. Parquet is the file format — Delta tables are still just Parquet files on disk.
Delta Lake is a transaction log layer that sits on top of those Parquet files. It’s a directory called _delta_log/ that lives alongside your data files in cloud object storage.
s3://my-bucket/my-table/
├── _delta_log/
│ ├── 00000000000000000000.json
│ ├── 00000000000000000001.json
│ ├── 00000000000000000002.json
│ └── 00000000000000000010.checkpoint.parquet
├── part-00000-abc123.parquet
├── part-00001-def456.parquet
└── part-00002-ghi789.parquetEvery change to a Delta table — whether it’s an INSERT, UPDATE, DELETE, MERGE, or schema change — produces a new JSON entry in _delta_log/. That entry is a commit file.
This is the foundation of everything Delta Lake provides.
The Transaction Log: Line by Line
A commit JSON file in _delta_log/ looks roughly like this:
{
"commitInfo": {
"timestamp": 1717200000000,
"operation": "WRITE",
"operationParameters": {"mode": "Append"},
"readVersion": 4,
"isolationLevel": "WriteSerializable"
}
}
{
"add": {
"path": "part-00000-abc123.parquet",
"size": 4821234,
"stats": "{\"numRecords\":12500,\"minValues\":{\"event_date\":\"2024-01-01\"},\"maxValues\":{\"event_date\":\"2024-01-31\"}}",
"dataChange": true
}
}A DELETE or UPDATE generates a remove action for old files and an add action for new files:
{"remove": {"path": "part-00001-def456.parquet", "deletionTimestamp": 1717200000000}}
{"add": {"path": "part-00003-new456.parquet", "size": 4800000, "dataChange": true}}The actual Parquet file with the old data doesn’t get deleted immediately. It just gets marked as removed in the log. This is how time travel works — older versions of the table are the same files referenced by earlier commit entries.
This is not magic. It’s append-only log entries + immutable Parquet files.
ACID Guarantees: What You Actually Get
The four properties and what they mean in practice:
Atomicity — a write either fully succeeds or doesn’t happen at all. If your Spark job writes 50 Parquet files and then fails on the 51st, the transaction is never committed to _delta_log/. From any reader's perspective, none of those 50 files exist yet. The partially-written files sit orphaned on disk until VACUUM cleans them up.
Consistency — schema enforcement ensures every write conforms to the defined schema. You can’t accidentally write a column as STRING when the table expects LONG. This prevents the classic "I appended a CSV with a wrong column order and now half my data is garbage" failure.
Isolation — concurrent readers and writers don’t interfere with each other. Delta Lake uses a protocol called Optimistic Concurrency Control. When a writer is about to commit, it checks whether any conflicting operations happened since it started. If they did, it retries. This means:
- A reader always sees a consistent snapshot (either before or after a write, never mid-write)
- Two writers targeting the same partition will detect the conflict and one will retry
Durability — once a commit is written to _delta_log/, it's durable. The files are in object storage (S3/ADLS/GCS), which provides their own durability guarantees.
What Delta Lake does NOT give you:
Delta Lake is not a full RDBMS. There are no row-level locks. The isolation level defaults to WriteSerializable (not Serializable). Concurrent writes to different partitions generally succeed without conflict — but concurrent writes to the same partition require careful orchestration.
Time Travel: How It Actually Works
Time travel is one of Delta Lake’s most practically useful features. The mechanism is simple: since the transaction log accumulates all commit history, you can reconstruct the table state at any version by replaying commits up to that point.
-- Read table at a specific version
SELECT * FROM events VERSION AS OF 5;
-- Read table at a specific timestamp
SELECT * FROM events TIMESTAMP AS OF '2024-01-15';
-- From PySpark
df = spark.read.format("delta").option("versionAsOf", 5).load("s3://bucket/events")Common production uses:
- Audit: “What did this table look like before the bad pipeline ran?”
- Rollback:
RESTORE TABLE events TO VERSION AS OF 5 - Debugging: compare a specific version against current to find data drift
- Reproducibility: ML training jobs pin to a specific table version for reproducible experiments
The constraint you need to know:
Time travel only works within the retention window. The default is 7 days. After VACUUM runs, the old Parquet files get physically deleted and older versions become inaccessible.
-- Check retention setting
DESCRIBE DETAIL events;
-- Override retention (extend window for compliance)
ALTER TABLE events SET TBLPROPERTIES ('delta.logRetentionDuration' = '30 days');
-- VACUUM with safety off (use with extreme caution)
VACUUM events RETAIN 168 HOURS;The gotcha: VACUUM and time travel are in tension. If your compliance requirements mandate 90-day audit access, you need to set retention explicitly and avoid running VACUUM with short windows. This is a common production oversight.
Checkpoints: When the Log Gets Too Long
Every 10 commits, Delta Lake automatically writes a checkpoint file (Parquet format) to _delta_log/. This checkpoint is a full snapshot of the current table state — all active files, schema, partitioning info.
Without checkpoints, reading a table with 10,000 commits would require replaying all 10,000 JSON files. With checkpoints, a reader only needs to load the most recent checkpoint and replay the commits since then — typically just a handful.
_delta_log/
├── 00000000000000000000.json (commits 0-9)
├── ...
├── 00000000000000000009.json
├── 00000000000000000010.checkpoint.parquet ← full snapshot at v10
├── 00000000000000000010.json
├── ...Why this matters operationally: Tables with extremely high commit rates (streaming ingestion making hundreds of micro-batch commits per hour) can accumulate large log directories. Checkpoint reads become expensive. This is one reason why streaming to Delta should use OPTIMIZE and compaction strategies — to keep the active file count manageable.
How Snapshot Reconstruction Actually Works
This is the mechanism worth internalizing — because once you see it, Delta’s consistency guarantees stop feeling like marketing and start feeling like inevitable geometry.
Imagine a table’s commit history looks like this:
Version 0:
ADD file_A
ADD file_B
Version 1:
REMOVE file_A
ADD file_C
Version 2:
ADD file_DWhen a reader requests VERSION AS OF 1, Delta doesn't "undo" anything. It replays the log forward from the last checkpoint to the requested version and builds a set of active files:
Start: {}
After v0: { file_A, file_B }
After v1: { file_B, file_C } ← file_A removed, file_C added
↑ this is the snapshot returnedfile_A is physically still on disk. It hasn't been deleted yet. It's simply excluded from the active file set for this version. VACUUM is what eventually removes it — which is why time travel stops working once VACUUM clears the old files.
A current read (VERSION AS OF 2) resolves to:
After v2: { file_B, file_C, file_D }This is why concurrent reads remain consistent even during active writes. A writer adding file_E in version 3 commits a new log entry. Any reader that started before that commit resolves against v2's file set and never sees file_E. Any reader that starts after sees v3. There's no mid-write state visible to anyone — because "current state" is always a deterministic replay of the log up to a specific version number.
The Spark driver reconstructs this active file list before dispatching tasks to executors. Executors read only the files in that resolved set. File_A sitting on disk is invisible to them — not locked, not hidden, just absent from the manifest they were handed.
_delta_log replay → active file manifest → Spark task dispatch → executor readsThe operational implication: a table with 10M active files has a slow cold-start because the driver has to load and filter a very large manifest. This is the root cause of the small-file performance problem at scale — not the file reads themselves, but the manifest resolution overhead. OPTIMIZE reduces active file count. Liquid Clustering (Part 8) eliminates the need for rigid partition structures that cause runaway file proliferation.
Schema Enforcement vs Schema Evolution
These two features sit at opposite ends of a dial.
Schema Enforcement (default): Delta Lake rejects any write that doesn’t match the table’s current schema. This is on by default.
# This will FAIL if `new_column` doesn't exist in the table schema
df_with_new_col.write.format("delta").mode("append").save("s3://bucket/events")
# AnalysisException: A schema mismatch detected when writing to the Delta table...This is exactly what you want in production — it’s your first line of defense against schema drift.
Schema Evolution (opt-in): When you genuinely want to add columns, you can enable mergeSchema:
df_with_new_col.write \
.format("delta") \
.mode("append") \
.option("mergeSchema", "true") \
.save("s3://bucket/events")Or at the session level:
spark.conf.set("spark.databricks.delta.schema.autoMerge.enabled", "true")The trap: Auto-merge can silently add columns you didn’t intend to add. A source system changes an upstream schema; your pipeline picks it up silently; downstream BI dashboards show NULL columns they’ve never seen. This is why mergeSchema should be explicit and deliberate, not a default setting on all your writers.
Architecture Flow
Source Data (Files, Streams, JDBC)
│
▼
┌─────────────────────┐
│ Spark Write Job │
│ (Parquet files) │
└──────────┬──────────┘
│ writes data files + commit entry
▼
┌─────────────────────────────────────┐
│ Delta Table on S3/ADLS │
│ │
│ _delta_log/ │
│ ├── 0000...00.json (commits) │
│ ├── 0000...10.checkpoint.parquet │
│ └── 0000...11.json │
│ │
│ data/ │
│ ├── part-00000.parquet │
│ ├── part-00001.parquet │
│ └── (old files, not yet vacuumed) │
└──────────┬──────────────────────────┘
│
┌───────┴───────┐
▼ ▼
BI Queries ML Training
(SQL Engine) (Spark Read)
see consistent pins to version
snapshot for reproducibilityKey architectural insight: The transaction log is the source of truth. The Parquet files are just data blobs. Any system that understands Delta Lake can read this table — Spark, Trino, Athena (with manifests), DuckDB. This is the open architecture advantage over proprietary warehouse formats.
Failure Modes You’ll See in Production
Silent partial writes without Delta: A Parquet-only pipeline writes 20 files, crashes on file 21. Next reader sees partial data. With Delta, the writer never commits — the reader sees nothing of the failed write.
Log directory becoming a bottleneck: With streaming jobs making thousands of commits per day, the _delta_log/directory grows large. AWS S3's eventual consistency model (now strongly consistent, but historically problematic) was a real issue pre-2020. Today, the bottleneck is more about log file reads on cold starts.
VACUUM deleting files still in use: If you have a long-running read job and run VACUUM with a short retention window, VACUUM can physically delete files the reader still needs. Delta Lake has some guards here (it checks for active readers), but in practice, production pipelines should use retention windows longer than their longest expected read job.
Optimistic concurrency failures under high write contention: When many writers target the same table simultaneously, OCC retries can become expensive. Each retry re-reads the log to check for conflicts. Under very high concurrency, this creates a thundering herd. The solution is either partitioning writes by a key (so they hit different partitions) or serializing through a queue.
Schema drift through auto-merge: As described above — mergeSchema enabled globally means unexpected upstream schema changes silently propagate downstream.
Trade-offs: What Delta Lake Optimizes For and What It Sacrifices
Optimized for:
- Write reliability and reader consistency
- Open format (Parquet) readable by many engines
- Cheap object storage costs
- Auditability via time travel
Sacrificed or constrained:
- Write latency: every commit writes to object storage. Object storage PUT operations have higher latency than writing to local disk or an in-memory buffer. Streaming micro-batch commit rates are bounded by this.
- Small file problem: high-frequency appends create many small Parquet files, degrading read performance.
OPTIMIZEcompaction is a maintenance operation, not automatic (unless Predictive Optimization is enabled on Unity Catalog tables). - True real-time: Delta is very good at near-real-time (seconds), but for sub-second latency, a pure streaming system (Kafka) is more appropriate. Delta Streaming Tables bridge some of this gap but have their own trade-offs.
- Complex concurrent write patterns: Delta’s OCC works well for append-heavy workloads. High-volume concurrent MERGE/UPDATE/DELETE workloads require careful partition design.
Real-World Constraints
Scale considerations: A Delta table with 100M+ files (extremely high-cardinality partitioning is the usual cause) becomes very expensive to read — the driver has to load and filter all active file paths from the transaction log. Partition pruning helps but doesn’t eliminate the overhead. This is one of the key motivations for Liquid Clustering (covered in Part 8).
Cost considerations: _delta_log/ lives in the same object storage bucket as your data. At very high commit rates, you're doing many small object storage writes. On S3, this means per-PUT costs accumulate. On GCS, similar. For streaming at very high frequency, batching commits (larger micro-batch windows) is cheaper than continuous micro-commits.
Operational complexity: Delta tables require maintenance: OPTIMIZE to compact small files, VACUUM to remove stale files, ANALYZE to refresh statistics for query optimization. Forgetting maintenance means degrading performance over months. Predictive Optimization on Unity Catalog automates some of this, but it's not magic — understanding when and why these run matters.
What Databricks Expects You to Reason About
The exam doesn’t test memorization. It tests whether you can reason through a scenario and eliminate wrong answers by understanding why a design fails.
Here’s the reasoning pattern behind the concepts that show up repeatedly:
The transaction log is the table. Parquet files are just blobs. If the log says a file is removed, it doesn’t exist from any query’s perspective — even if it’s physically on disk. This distinction matters when debugging “why am I getting stale data” or “why is VACUUM failing to free space.”
Time travel is log replay, bounded by VACUUM. You can only travel as far back as your oldest non-vacuumed commit. Compliance teams asking for 90-day audit access need an explicit retention policy set before VACUUM runs — not after data is already gone.
Schema enforcement is a gate, schema evolution is a choice. Enforcement prevents bad writes silently corrupting downstream consumers. Evolution should be deliberate — if you enable autoMerge globally and an upstream source adds a column, your Gold layer tables will start showing NULLs in BI dashboards with no error, no warning, and no obvious cause.
Managed vs external tables have different lifecycle semantics. DROP TABLE on a managed table deletes the data. On an external table, it only removes the metadata registration. Getting this wrong in production means either orphaned data accumulating on S3 or — worse — accidentally dropping data you needed.
Unity Catalog + Delta = single source of truth for AI and BI. The exam scenario that tests this is always framed around needing consistency, lineage, audit trails, and ML access simultaneously. The answer is always Delta + Unity Catalog. The wrong answers sacrifice at least one of those requirements.
The exam’s trap answers are architecturally plausible but operationally wrong — CSV with manual versioning “works” but fails on audit trails. Object storage alone “works” but fails on consistency. In-memory DataFrames “work” but fail on durability. Every wrong option satisfies some requirements and breaks others. Read the scenario requirements exhaustively before eliminating options.
Summary: The Engineering Lesson
Delta Lake’s power is architectural, not magical.
It takes two simple primitives — immutable Parquet files and an append-only transaction log — and builds ACID guarantees out of them on top of infrastructure (S3, ADLS) that was never designed for it.
Understanding how the transaction log works tells you everything about where Delta Lake is strong (consistency, auditability, time travel, open format access) and where it has constraints (small file accumulation, high-concurrency write contention, latency bounds imposed by object storage).
The Lakehouse architecture wins when you need the data to be reliable enough for both compliance reporting and ML training — using the same table, at the same time.
That’s not a trivial engineering achievement.
🔥 Next in Series
Part 2 — Unity Catalog: Governance as Infrastructure
Most engineers treat Unity Catalog as a permissions layer bolted on top of Databricks. It’s not. It’s a full governance plane — a three-level namespace, a lineage graph, a centralized metastore, and a security hierarchy that spans workspaces.
We’ll go deep on managed vs external tables (and why the distinction matters when you run DROP TABLE), how GRANT/REVOKE works across the hierarchy, and the production failure patterns that come from getting the catalog design wrong from the start.
🔔 Follow for More
Follow TheDataForge for high-signal deep dives on Spark, Kafka, Streaming, Lakehouse, and real-world data engineering — no fluff, only engineering truth.
⚡️Let’s connect — I post daily Big Data & Spark insights at DataForgeX on X.
💬 Comment Below
What’s the worst data consistency issue you’ve debugged in production?
Was it a concurrent write race condition? A partial write leaving your table in a bad state? Schema drift from an upstream source silently corrupting downstream metrics?
And — did you have Delta Lake’s transaction log to help you trace it, or were you debugging raw Parquet files trying to figure out which run left which files?
Tags:
#delta-lake #databricks #lakehouse #acid-transactions #time-travel #transaction-log # data-engineering #databricks-certification #dataforge