8000 feat(notebooks): Delta OPTIMIZE/VACUUM maintenance notebook by dmux · Pull Request #10 · dmux/minilake · GitHub
[go: up one dir, main page]

Skip to content

feat(notebooks): Delta OPTIMIZE/VACUUM maintenance notebook - #10

Merged
dmux merged 2 commits into
mainfrom
feat/delta-maintenance-notebook
Aug 21, 2026
Merged

dmux merged 2 commits into
mainfrom
feat/delta-maintenance-notebook

Conversation

@dmux
@dmux dmux commented Aug 21, 2026
Copy link
Copy Markdown
Owner

Adds a second seeded notebook to the embedded JupyterLab, covering the operational half of Delta Lake that the quickstart does not: the small-files problem and the OPTIMIZE / VACUUM cycle that fixes it.

What it does

Fifty micro-batch appends manufacture the problem — 200 tiny Parquet files, 50 rows each — then OPTIMIZE compacts them and VACUUM reclaims the tombstones. Verified end to end:

Stage On disk Live Rows/live file Query
50 micro-batch appends 200 200 (464 KiB) 50 8 ms
after OPTIMIZE 204 4 (147 KiB) 2,500 4 ms (2.3x)
after VACUUM 4 4 2,500 5 ms

The pivot is the on-disk count rising to 204 after OPTIMIZE: 200 tombstoned files that still back time travel, which VACUUM then reclaims — ending with FileNotFoundException on version 0. Also covered: DESCRIBE HISTORY, versionAsOf, OPTIMIZE ... WHERE ... ZORDER BY, and a VACUUM ... DRY RUN.

Both sides of the boundary

Every measurement runs through the SQL Statement Execution API with databricks-sdk — glob() for what is on disk, and a SQL replay of the _delta_log (add paths minus remove paths) for what is live. That replay is what makes the tombstone step visible from the Databricks side at all.

Spark work goes through the Jobs API, like the quickstart: the embedded kernel has no pyspark on purpose, so an in-kernel SparkSession is not an option. OPTIMIZE, VACUUM, DESCRIBE HISTORY and VERSION AS OF are Delta protocol operations and are not in minilake's DuckDB dialect — section 11 of the notebook states that outright rather than papering over it.

Also here

  • Dockerfile.notebook copies all of notebooks/ rather than one hardcoded filename.
  • docs/spark-and-delta.md — the JupyterLab section now describes the embedded Jupyter (both seeded notebooks, and the deliberate absence of pyspark) before the optional --profile notebook container.
  • FEATURES.md §12a lists both seeded notebooks; §12 goes back to describing only the local-Spark container.

Verification

Executed non-interactively (jupyter nbconvert --execute) against ghcr.io/dmux/minilake:latest in an isolated container and volume: ~90s, zero errors, shipped with outputs cleared.

https://claude.ai/code/session_01Xme3rgBDt5Ce4egA77skms

Seeded alongside the quickstart: fifty micro-batch appends manufacture a
small-files problem (200 tiny Parquet files), OPTIMIZE compacts them to
four, and VACUUM reclaims the 201 tombstoned ones. Every measurement runs
through the SQL Statement Execution API -- glob() for what is on disk, a
SQL replay of the _delta_log for what is live -- which is what makes the
"files on disk go up after OPTIMIZE" step visible from the Databricks side.

Spark work goes through the Jobs API, like the quickstart: the embedded
kernel has no pyspark on purpose, so an in-kernel SparkSession is not an
option here.

Dockerfile.notebook now copies all of notebooks/ rather than one filename.

Claude-Session: https://claude.ai/code/session_01Xme3rgBDt5Ce4egA77skms
@dmux dmux self-assigned this Aug 21, 2026
@dmux dmux added the documentation Improvements or additions to documentation label Aug 21, 2026
@dmux
dmux merged commit 53af158 into main Aug 21, 2026
3 checks passed
@dmux
dmux deleted the feat/delta-maintenance-notebook branch September 30, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0