Skip to content

memdb: free the logs of blocks that delete from each other - #52

Merged
mumtaz6 merged 2 commits into
masterfrom
wal-retention-cycles
Oct 4, 2026
Merged

mumtaz6 merged 2 commits into
masterfrom
wal-retention-cycles

Conversation

@mumtaz6

@mumtaz6 mumtaz6 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Two fixes found while freeing a store written by v0.6.0, and one for master's CI.

  • Blocks that delete from each other free their logs. A block's logs waited for the logs of every block it deletes from. A batch's block and the block current as it was written can delete from each other, as can blocks recovered from a WAL holding several versions of a key. Each waited for the other, forever. A released block's logs now go together with those of the blocks it transitively deletes from, once all of them are released, in the order they were written. A v0.6.0 store compacted with one value per key went from 85,698 logs to 10. Before this fix it kept 85,505.
  • An emptied batch block is released. Its time ID can be past the current block's, and only blocks before the current one were released.
  • e2e: a CONNACK that comes with the close is taken. Since Engine checks, the bugs they found, and one value per key in memdb #51 a refusal is written as the connection closes, and the test client's select could take the close over the CONNACK. TestReleaseFourMintID failed this way on master's CI.

🤖 Generated with Claude Code

mumtaz6 and others added 2 commits October 4, 2026 22:53
A block's logs stayed in the WAL until the logs of every block it
deleted versions from had gone. Blocks can delete from each other: a
batch's block and the block current as it was written, or blocks that
recovery of a WAL of several versions of a key links. Each waited for
the other, and both kept their logs for good. A store written by v0.6.0
and compacted, 85,698 logs, kept 85,505: 11,448 blocks waited in
cycles.

Logs can't wait in a cycle: a delete is written after the put it
deletes. A released block's logs now go with those of the blocks it
deletes from, and from which they delete, once all are released, in
the order they were written, so that a put's log goes before its
delete's. The compacted store keeps 10 logs.

A batch's block, emptied by deletes, was never released: its time ID,
the batch's, can be past the current block's, and a block was released
only before the current one. Written, a batch's block takes no more
writes; a block is now released unless it is the current one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A refusal is now written as the connection closes. The client's read
loop hands the CONNACK over, then the close, and connectWith's select
took either: TestReleaseFourMintID saw the connection closed during
connect, on master's CI. A close now takes a CONNACK waiting first.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mumtaz6
mumtaz6 merged commit d4fb05b into master Oct 4, 2026
11 checks passed
@mumtaz6
mumtaz6 deleted the wal-retention-cycles branch October 6, 2026 09:37
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