Swap: retry a journal's recovery checkpoint while idle
After a lost record the journal drops position-based records until a full checkpoint. That checkpoint was only requested from later edits, rate-limited to once a second; when the writer handled the failing record before its edit asked for a checkpoint, the checkpoint failed as well and consumed the slot, so edits made within the next second were not recovered and, if the user stopped typing, the journal stayed behind indefinitely. SwapManager::RetryGapCheckpoints(), called once per frame from Editor::ProcessPendingOpens, requests it once the interval has passed. This also made SwapReplay_LostRecord_ResyncsWithCheckpoint flaky under load; the test now exercises the retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
@@ -493,6 +493,10 @@ Editor::ProcessPendingOpens()
|
||||
// runs from every frontend's loop, outside command dispatch: report the
|
||||
// failure instead of letting it end the editor.
|
||||
try {
|
||||
// Also the once-per-frame hook for the journal: retry the
|
||||
// checkpoint of a journal that lost a record.
|
||||
if (kte::SwapManager *sm = Swap())
|
||||
sm->RetryGapCheckpoints();
|
||||
return process_pending_opens_();
|
||||
} catch (const std::exception &e) {
|
||||
kte::ErrorHandler::Instance().Error("Editor", std::string("open failed: ") + e.what(), "");
|
||||
|
||||
Reference in New Issue
Block a user