Skip to content

fix: make Columnar deletes durable across reopen (flush-time compaction) - #365

Merged
MPCoreDeveloper merged 1 commit into
masterfrom
fix/delete-persistence
Sep 3, 2026
Merged

fix: make Columnar deletes durable across reopen (flush-time compaction)#365
MPCoreDeveloper merged 1 commit into
masterfrom
fix/delete-persistence

Conversation

@MPCoreDeveloper

Copy link
Copy Markdown
Owner

Problem

Columnar (append-only) deletes were logical onlyDeleteRecordsCore/the contiguous bulk fast path removed PK/hash-index entries but never touched the .dat. Because the on-load PK-index rebuild reads every physical record, deleted rows came back after a reopen (repro: insert 100, delete 50, Flush, dispose, reopen → 100 rows again).

Fix

Track logically-deleted rows (Table._pendingLogicalDeletes, incremented by every Columnar delete path incl. the B9 contiguous bulk fast path) and physically compact them at Table.Flush/Dispose via the new CompactPendingDeletes() — Columnar tables with a PK, outside a transaction (deferred otherwise). Compaction rewrites the file keeping only live PK positions and rebuilds the indexes, so DELETE now survives reopen.

Tests

Full suite 1656/1656. New regression DeletesPersistAcrossReopen_AfterFlushCompaction: delete half the rows, flush, reopen → exactly the remaining rows come back (scan + COUNT). Existing delete/bulk tests (incl. scan/COUNT-after-delete assertions) stay green.

Columnar deletes were logical only (PK/hash-index removal), so the on-load PK-index rebuild resurrected deleted rows from the untouched .dat after a reopen. Logically deleted rows are now tracked (_pendingLogicalDeletes, incremented by DeleteRecordsCore and the contiguous bulk-delete fast path) and physically compacted at Table.Flush/Dispose via CompactPendingDeletes (Columnar + PK, outside a transaction). Regression test DeletesPersistAcrossReopen_AfterFlushCompaction deletes half the rows, flushes, reopens and asserts exactly the remaining rows come back.
@sonarqubecloud

sonarqubecloud Bot commented Sep 3, 2026

Copy link
Copy Markdown

@MPCoreDeveloper
MPCoreDeveloper merged commit 80c468a into master Sep 3, 2026
13 checks passed
@MPCoreDeveloper
MPCoreDeveloper deleted the fix/delete-persistence branch September 3, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant