Repository navigation
fix(memopayload): collect memo IDs in one query so none is skipped - #6666
Conversation
|
No actionable comments were generated in the recent review. WalkthroughThe runner now collects memo IDs with one query instead of paginating with Suggested reviewers: Severity of issue fixed: Medium Merge Risk:
|
Listing every memo without a limit to collect the IDs held each memo's payload in memory for the length of the read. Add store.ListMemoIDs, which selects only the id column in ID order on all three drivers, and have the rebuild use it. The runner test now deletes a memo right after the IDs are read, so it fails if the pass stops going through the single ID query.
Fixes #6664
Root cause
listMemoIDsread the memo IDs page by page (LIMIT/OFFSET, ordered by created time) while the server takes writes. A memo deleted, or one whose created time was changed, between two page reads moved the rows after it to another page, so one memo was never rebuilt, and the pass still recorded the newVersion.Changes
core/memopayload/runner.go:listMemoIDsreads every memo ID in oneListMemosquery (ExcludeContent, same order).RunOncestill loads and rebuilds the memos in batches of 100. The comments onRunOnceandlistMemoIDssay why.core/memopayload/runner_test.go:TestRunOnceRebuildsEveryMemoWhenOneIsDeletedDuringThePasswraps the store driver, asstore/test/reaction_test.godoes, and deletes the first memo right after the first list of IDs is read. With 150 memos it fails on main (one memo keeps its stale payload) and passes with the fix.docs/design/memo-attachment-filters.md: a dated amendment, since its Coverage paragraph said the paged read could not skip a memo.Notes
LIMITor filter, so the single query returns the same memos as before on SQLite, MySQL and PostgreSQL.Versionbump. ASELECT iddriver method or ID-based paging would hold less; both change theDriverinterface and all three drivers, so I left that out. Happy to add it if you prefer.Verification
go test -race ./server/... ./core/...: pass.golangci-lint run(v2.14.0): no issues incore/;go fix -diff: clean.