You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two defensive spots in the delta symbol-dict path had no biting test, and
one guard was incomplete (M3).
Complete the catch-up frame-size guard (M3b). The int-overflow hardening
covered ensureSentDictCapacity (the mirror growth) but not the single
catch-up frame: with no server cap, frameLen = HEADER + varints +
symbolsLen is an int and would wrap negative as symbolsLen approaches the
mirror ceiling, feeding a bad Unsafe.malloc. sendDictCatchUp's budget
already keeps each chunk under that bound, so this is unreachable at real
cardinality -- but the guard must be local so a future caller cannot
overflow it silently. Compute the size in long and fail loud
(CatchUpSendException) before the malloc, matching the mirror-side guard.
Cover accumulateSentDict's partial-overlap tail (M3a). A delta that
straddles the mirror tip (deltaStart < sentDictCount < deltaEnd) must copy
only the new tail, not drop the whole frame. The monotonic producer never
emits a straddling delta in steady state, so reverting to the pre-fix
drop-whole-frame guard passed every test; it is reachable on a torn-dict
replay (mirror seeded smaller than a frame's coverage), where dropping the
tail would leave the reconnect catch-up incomplete and shift server ids.
Add a white-box test that drives the straddle directly.
Both new tests fail with their production line reverted (the mirror stays
at 1 id; the frame guard falls through to a negative malloc that throws
IllegalArgumentException, not the clean terminal) and pass with it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: core/src/test/java/io/questdb/client/test/cutlass/qwp/client/sf/cursor/CursorWebSocketSendLoopCatchUpAlignmentTest.java
+132Lines changed: 132 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -43,8 +43,12 @@
43
43
importjava.lang.reflect.Method;
44
44
importjava.nio.charset.StandardCharsets;
45
45
importjava.nio.file.Paths;
46
+
importjava.util.ArrayList;
47
+
importjava.util.Arrays;
48
+
importjava.util.List;
46
49
47
50
importstaticorg.junit.Assert.assertEquals;
51
+
importstaticorg.junit.Assert.assertTrue;
48
52
importstaticorg.junit.Assert.fail;
49
53
50
54
/**
@@ -211,6 +215,76 @@ public void testTransientCatchUpSendFailureIsRetriableNotTerminal() throws Excep
0 commit comments