Skip to content

test(goclusterfs): pace the uncommitted-blocks writer on the reader - #182

Merged
mattmattox merged 2 commits into
mainfrom
claude/uncommitted-blocks-pacing
Nov 17, 2026
Merged

mattmattox merged 2 commits into
mainfrom
claude/uncommitted-blocks-pacing

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

TestReaderNeverSeesUncommittedBlocks failed about 1 in 20 runs, and it was the test's timing check, not data exposure. The failure line, from the stale-reads session:

lock_commit_test.go:196: node B saw the file at only 2 non-empty sizes while node A wrote it

The check required the reader to see at least 3 sizes while the writer filled 16 blocks, which depends on scheduling. Under #160's narrower zeroing the writes were fast enough to miss that. #162 reverted #160, so current main passed 1000 of 1000 for me on .68.

Fix: after each quarter of the file, the writer waits for a read that started after it, so the reader is shown at least 3 sizes. The reader keeps reading while the next quarter is written, so the uncommitted-block race is still exercised. The "read byte" check is unchanged.

200 runs each on .68, with tmpfs images as in the original report:

Commit Old test Paced test
daa33a6 (#160) 6 failures, all "only N sizes" 0 failures
main not run 0 failures (also 100 of 100 with -race, median 11s against about 9s before)

Pacing at every block also worked, but took 30s under -race.

🤖 Generated with Claude Code

mattmattox and others added 2 commits November 16, 2026 17:00
TestReaderNeverSeesUncommittedBlocks required the reader to see at least 3
sizes while the writer filled 16 blocks, which depends on how the two are
scheduled: with #160's narrower zeroing the writes were fast enough that the
reader sometimes saw only 2, about 1 run in 20 on .68. After each block the
writer now waits for a read that started after it, so the reader sees every
block's size, while it keeps reading during the next block's writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Waiting after every block made the test take 30 s under -race. Three waits,
after each quarter of the file, are enough to show the reader three sizes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit d72c974 into main Nov 17, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant