Repository navigation
tan: fail indexed reads that make no progress at EOF - #19
Merged
volgariver6 merged 1 commit intoOct 16, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and root cause
Addresses matrixorigin/matrixone#30219 at the Tan dependency boundary. MatrixOne must also consume the fixed dependency revision; merging this dependency PR alone must not be treated as a deployed MatrixOne fix.
When a persisted entry index points at EOF,
readLogtreats EOF as a successful scan. No entry callback advancespassed, sogetEntriesreopens the same log and seeks to the same position forever. Its old EOF branch is unreachable both because EOF is normally swallowed byreadLogand because non-nil errors already return above it. Raft's step worker cannot return to its stop channel while this call is spinning.This loop was introduced in
9ef6a64061dadddfdcb9b80082fe6ae1c31421b3(2022-11-15). The current MatrixOne pinabc3d2fce5a6and this PR's base18a1f46a2ea64eb42a2b330ef98d662ca68a1365have identical trees. This identifies the origin of the non-progress loop, not the origin of missing on-disk records.Minimal change
maxSizeis reached.readLogEOF semantics intact because normal log rotation and index rebuild use them.The error propagates through
LogDB.IterateEntriesandLogReader.Entriesto the existing Raft/engine storage-error path. A recovery read fails explicitly instead of busy-looping. Existing engine behavior is fail-stop; this is not a new graceful-repair mechanism.Regression and control evidence (Linux amd64, Go 1.24.0, GOMAXPROCS=4)
TestIndexedReadWithoutProgresspersists a small index, closes/reopens Tan, and checks both the public LogDB API and its LogReader consumer:A bounded FS-open counter makes the old version fail deterministically rather than leaving a hung test goroutine. All three bad-input cases failed before the production fix; all pass after it.
Executed successfully:
The focused race test measured 2.13 seconds; 14 repeats fit the 30-second adaptive stress budget. Existing normal tests cover log rotation, restart, entry overwrite, empty updates, max-size reads, compaction and torn-tail rebuild behavior.
Review boundaries
passed; a no-progress iteration fails. No elapsed-time heuristic or unbounded retry.No SQL BVT is added: the changed contract is below SQL, at persisted Raft-log iteration. The issue's original retained large fixtures are not reproduced by this test; the test deliberately injects the exact inconsistent-index/EOF condition. Why the original records are missing remains a separate investigation.