Skip to content

Drop the unread logical key from the purge queues - #1824

Merged
edwinyyyu merged 2 commits into
MemMachine:feat/horizontal-scalingfrom
edwinyyyu:fix/tombstones-without-logical-key
Oct 16, 2026
Merged

edwinyyyu merged 2 commits into
MemMachine:feat/horizontal-scalingfrom
edwinyyyu:fix/tombstones-without-logical-key

Conversation

@edwinyyyu

@edwinyyyu edwinyyyu commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Purpose of the change

Both purge queues stored the deleted partition's or collection's logical key next to its incarnation: segment_store_gc.partition_key and collection_registry_gc.name. Neither purge reads it.

  • The segment store's purge works from an entry's incarnation, enqueue stamp, and cursor. The partition key was written for forensics.
  • The registry's purge round locates a dead incarnation's records by namespace and config. The name was kept for inspection.

A tombstone also outlives the data it tracks, and the key is caller-provided. Some data protection regulations may prohibit keeping caller-provided values, the partition key and collection name included, on a tombstone after the data is deleted.

This PR drops both columns, so a tombstone holds only what its purge reads. The deletions stop writing the columns, the tests that queue a tombstone by hand stop setting them, and the design docs describe the queues without them.

Databases created before this change are left to the repo-wide schema migration (#1825, #1826).

Stack

Directly on feat/horizontal-scaling.

Verification

At this PR's head 5ebba1554, rebased onto feat/horizontal-scaling at cf7ae1579 on 2026-10-15, with both patches unchanged from fc2565fa9:

  • ruff check and ruff format --check are clean, uv lock --check passes, and ty check is clean as CI runs it (uv run --frozen --all-extras ty check --project packages/server).
  • The segment store and vector store suites (episodic_memory/event_memory/segment_store and common/vector_store), unit and integration: 897 passed, 5 skipped.

🤖 Generated with Claude Code

@marvinyu-memverge marvinyu-memverge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at fc2565f. The drop itself is clean. Nothing reads either column; the writes this PR removes were the only references at head. delete_partition and _unregister_where delete the registry row in the same transaction, so with this change the caller's key leaves the database with the deletion. One question, on upgrades.

  1. segment_store_gc, with partition_key NOT NULL, already ships in v0.4.0 (released 10-08, latest on Docker Hub). The wizard's default config puts event memory's segment store on SQLite, so a default v0.4.0 install has this table. startup only runs create_all, which leaves an existing table as it is. After an upgrade to a release with this change, the queue insert in delete_partition fails the NOT NULL check and rolls back the whole transaction. Every partition deletion then fails until someone runs the ALTER from the description. How will a v0.4.0 install get that ALTER? (collection_registry_gc is only on feat/horizontal-scaling and in the 0.4.1-dev0/dev1 tags, so outside those it doesn't have this problem.)

Verified:

  • No code at head reads segment_store_gc.partition_key or collection_registry_gc.name. The registry's purge selects namespace and config.
  • In v0.4.0, partition_key has no index or constraint beyond NOT NULL, so SQLite (3.35+) can drop it with the statement in the description.

@xiongzubiao
xiongzubiao force-pushed the feat/horizontal-scaling branch from 101182c to cf7ae15 Compare October 15, 2026 15:31
edwinyyyu and others added 2 commits October 15, 2026 14:33
The purge reads an entry's incarnation, enqueue stamp, and cursor. The
partition key was written for forensics and read by nothing. Drop the
column, so an entry holds only what the purge reads; the tests that
queue an entry by hand stop setting it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A purge round locates a dead incarnation's records by its namespace and
configuration. The name was kept for inspection and read by nothing.
Drop the column, so a tombstone holds only what the purge reads; the
tests that queue a tombstone by hand stop setting it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@edwinyyyu
edwinyyyu force-pushed the fix/tombstones-without-logical-key branch from fc2565f to 5ebba15 Compare October 15, 2026 21:36
@edwinyyyu

Copy link
Copy Markdown
Contributor Author

@marvinyu-memverge Existing databases, v0.4.0 installs included, are left to the repo-wide schema migration in #1825 and #1826 rather than special-cased here, so the description no longer carries the ALTER statements.

The branch is rebased onto the current feat/horizontal-scaling (cf7ae1579) as 5ebba1554, with both patches unchanged.


🤖 Written by Claude Code (Claude Opus 5.5) on behalf of @edwinyyyu.

@marvinyu-memverge marvinyu-memverge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 5ebba15. Leaving existing databases to the migration in #1825/#1826 makes sense to me.

@edwinyyyu
edwinyyyu merged commit a67efd1 into MemMachine:feat/horizontal-scaling Oct 16, 2026
39 checks passed
This was referenced Oct 19, 2026
This was referenced Oct 19, 2026
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.

3 participants