Loading Academy Hub...
Demystify Delta Lake internals: the `_delta_log` directory, monotonically increasing commit files (000000.json), checkpoint parity (.checkpoint.parquet), Optimistic Concurrency Control (OCC), and time travel forensics.
[!NOTE] Delta Lake is an open-source storage layer that brings ACID transactions to Apache Spark and big data workloads. Delta tables are physically stored as standard Apache Parquet files paired with a forward-only transactional commit log in the
_delta_log/directory.
_delta_log Commit ProtocolEvery write, update, delete, or merge to a Delta table creates a new commit file:
abfss://lakehouse/silver/transactions/
├── _delta_log/
│ ├── 00000000000000000000.json (Version 0: Table creation & schema)
│ ├── 00000000000000000001.json (Version 1: Added 10 Parquet files)
│ ├── 00000000000000000002.json (Version 2: Removed 2 files, added 2 files - MERGE)
│ └── 00000000000000000010.checkpoint.parquet (Checkpoint every 10 commits)
├── part-00000-c000.snappy.parquet (Active data file)
└── part-00001-c000.snappy.parquet (Active data file)
Delta Lake uses OCC to guarantee serializable isolation:
$V+1$.json. If another job committed $V+1$.json first, Delta checks if the two jobs mutated the same files or partitions.
$V+2$.json.ConcurrentModificationException and aborts._delta_log, Deletion Vectors & Time Travel Boundaries_delta_log Checkpoints: Every Delta commit writes an immutable atomic 00000N.json log file and builds a Parquet checkpoint every 10–100 commits so readers never replay 100,000 tiny JSON files. Concurrent UPDATE/MERGE jobs use Row-Level Concurrency (with Deletion Vectors enabled) to avoid false ConcurrentAppendException aborts when touching disjoint rows in the same partition.Merge-on-Read Speedup): Enabling delta.enableDeletionVectors = true marks updated/deleted row positions inside lightweight Roaring Bitmap .bin files instead of rewriting entire 1 GB Parquet files during MERGE/DELETE, speeding up GDPR & CDC upserts by 5x–10x.VACUUM table RETAIN 0 HOURS while active streaming readers or long queries run—keep the default 168 hours (7 days) safety floor so DESCRIBE HISTORY / Time Travel remains deterministic and uncorrupted.Review the production code, company interview Q&As, incident traces, and comprehension quiz inside this lesson.
-- 1. View complete transaction commit history
DESCRIBE HISTORY lakehouse_silver.transactions;
-- 2. Query historical snapshot as of specific timestamp or version
SELECT COUNT(*)
FROM lakehouse_silver.transactions TIMESTAMP AS OF '2026-03-01 02:00:00';
-- 3. Instantaneously roll back accidental deletion to version 42
RESTORE TABLE lakehouse_silver.transactions TO VERSION AS OF 42;
-- 4. Query changes between versions using Change Data Feed (CDF)
SELECT *
FROM table_changes('lakehouse_silver.transactions', 40, 42)
WHERE _change_type IN ('update_postimage', 'insert');com.databricks.sql.transaction.taps.ConcurrentModificationException: Cannot commit transaction because a concurrent update touched the same partitions.