Commit 6537139
Fix flaky snapshot+stream race in integration test
The test compared the stream output against an atomic counter that races
with the actual database commits. The writer goroutine does INSERT then
count.Add(1), but Stop() can land between those two operations, causing
the count to be off by one from what the database (and thus the stream)
actually sees.
Fix: read the committed row count from the database after stopping the
writer, instead of trusting the in-process atomic counter.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 96729e5 commit 6537139
3 files changed
Lines changed: 21 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
916 | 916 | | |
917 | 917 | | |
918 | 918 | | |
919 | | - | |
920 | 919 | | |
921 | 920 | | |
922 | 921 | | |
923 | | - | |
924 | 922 | | |
925 | 923 | | |
926 | 924 | | |
| |||
948 | 946 | | |
949 | 947 | | |
950 | 948 | | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
951 | 956 | | |
952 | | - | |
| 957 | + | |
953 | 958 | | |
954 | 959 | | |
955 | 960 | | |
| |||
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
24 | 33 | | |
25 | 34 | | |
26 | 35 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
| |||
0 commit comments