-
Notifications
You must be signed in to change notification settings - Fork 22
fix(brain): compact sync log on installs with no brain-sync peers #5462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -874,6 +874,11 @@ export async function syncAllPeers() { | |
| }); | ||
| const minSeq = Math.min(...consumedSeqs); | ||
| await brainSyncLog.compactLog(minSeq); | ||
| } else if (brainSyncLog.getCurrentSeq() > 0) { | ||
| // No brain-sync peer will ever pull these entries; a peer added later | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CRITICAL] Local pull settings do not prove the log has no remote consumers
|
||
| // converges through the reconcile snapshot (#1077). Keep the last entry so | ||
| // initSyncLog still recovers the sequence counter across restarts. | ||
| await brainSyncLog.compactLog(brainSyncLog.getCurrentSeq()); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CRITICAL] Choose the compaction floor from durable state under the log mutex
|
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[IMPROVEMENT] Assert the absence of a write, not only identical bytes
Removing the new
if (dropped === 0) return 0would still reconstruct and atomically write the same bytes, so this before/after content comparison passes while the idle-rewrite regression returns. WrapatomicWritewith a delegating spy in thefileUtilsproxy and assert it was not called aftercompactLog(1).