Repository navigation
[ZC: WW.3.S] UM-1684: let the collector say which checkpoint governs its outbox - #2129
Conversation
…ns its outbox One collector's outbox was never pruned, because its checkpoint is filed under a name the outbox never learned. The minimax collector checkpoints under its state key, `minimax-runtime`, while its outbox belongs to the producer `minimax-code`, so the sweep's exact match never found it and the receipts in that outbox were never pruned. It is the largest of the six outboxes on this host. The collector is the only side that knows both names, so the collector records the key it checkpoints under, in the identity row the outbox already carries, and the sweep reads it. The match stays exact: without the recorded key the sweep falls back to the producer's own name, and an outbox whose checkpoint cannot be found is still skipped and keeps its receipts. Two regression tests cover it, and the first fails against the code before this change.
|
@kody start-review |
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀
Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
|
Automatic approval held Kody's assessment:
|
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ✅ |
…takes Jet's finding on #2124 was right, and it is fixed here. The sweep counted an outbox's receipts and removed the directory when the count was zero, so a collector writing into that outbox at that moment lost the row it was writing. The reclaim now opens the outbox, takes the write lock, counts under it and removes the directory while it still holds it: a collector that was already writing either holds the lock itself, so the removal waits and then sees the row, or waits for the lock, and its write fails loudly instead of disappearing. A regression test reproduces the window Jet named, the sweep counting the outbox empty and a collector writing into it at that moment, and the outbox is left in place with the row still in it. The checkpoint key fix is in the same pull request: the minimax collector checkpoints under its state key while its outbox belongs to a differently named producer, so the sweep never found the checkpoint and never pruned that outbox, which is the largest of the six on this host.
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ✅ |
|
@kody start-review |
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ✅ |
|
@kody start-review |
Code Review Completed! 🔥The code review was successfully completed based on your current configurations.
Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
The checkpoint key now travels with the identity on the path that writes the outbox, and an identity recorded without a key keeps the one already recorded. A collector whose passes always find events therefore records which checkpoint governs its outbox, and a pass that finds nothing to send can no longer reset it. The checkpoint file is validated against a schema before any of its fields are read, because a watermark authorizes the deletion of receipts and the file is untrusted input. The reclaim waits for a collector that holds the outbox's write lock, and the outbox's schema is checked with reads before it is changed, so a maintenance job no longer needs the write lock merely to open an outbox. The busy check lives in the bridge, where the collector and the maintenance job can both reach it. Three tests were added: an identity keeps its recorded key, a checkpoint file of the wrong shape proves nothing, and the reclaim waits for a collector's write instead of failing the outbox. The outbox suite passes 29 assertions, and the collector runtime and session-token suites pass as before.
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ✅ |
|
@kody start-review The four findings the first run left open are all fixed. The checkpoint key now travels with the identity on the path that writes the outbox, and an identity recorded without a key keeps the one already recorded. The checkpoint file is validated against a schema before any of its fields are read. The reclaim retries a busy database while it takes the outbox's write lock, and the outbox's schema is now checked with reads before it is changed, so a maintenance job no longer needs the write lock merely to open an outbox. The outbox suite passes 29 assertions, including three new ones that cover the identity keeping its key, a checkpoint file of the wrong shape, and the reclaim waiting for a collector's write. |
This comment has been minimized.
This comment has been minimized.
…d under the writer The review found the third way the reclaim could get it wrong, and it is the same window one step further on. A collector that had already opened the outbox when the reclaim removed it is waiting for the lock, and its write either fails with an I/O error, because the write-ahead log went with the directory, or succeeds, because a connection that already holds that log open writes into it happily. In the second case the receipt lands in a file no path points at, and the collector is told it stored a receipt that is gone. The write now compares the file the path points at before and after the write, by device and inode, and writes the receipt again when the path no longer holds what was written into it. A write that failed with the I/O error is retried once, because the outbox is simply gone and a new one is the answer. A test reproduces the window: the reclaim runs between the outbox's open and the write, and the test asserts that the receipt is in the outbox at the path when the write returns. It fails on the old code, where the receipt is written into a file the removal unlinked and the outbox at the path does not exist. The outbox suite passes 30 assertions, and the collector runtime and session-token suites pass as before.
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
[ZC: WW.3.S] UM-1684: two ways the receipt sweep could get it wrong
Fixes UM-1684 (follow-up to #2124, which is merged and on the host).
Summary
Summary
Collector receipt writes now verify that the outbox file still points to the database they wrote to. If an outbox is reclaimed during a write, the collector retries the write so the receipt is stored in the outbox at its path; an I/O error caused by a removed outbox is also retried once, while persistent errors are reported.
A regression test covers reclaiming an empty outbox between opening it and writing a receipt. The rollout follow-up documents this reclaim race and reports 30 assertions passing; the provided changes do not establish that the tests were run for this pull request.