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
The recovery boundary suite only covered files that fit in a single
pread window, leaving the scan's window repositioning and the
chunk-by-chunk CRC verification untested. The new test recovers a
4 MiB segment holding a 3 MiB frame followed by a small one: checking
the large frame reloads the window four times, feeding each chunk
into the running CRC, and the small frame is then verified out of a
repositioned window. Recovery must be total -- both frames kept, the
cursor at the last appended byte, no torn tail. A mutation check
confirmed the test has teeth: reseeding the CRC on each window reload
fails exactly this test while the rest of the suite stays green.
writeSegment gains an explicit-segment-size variant to build the
oversized file.
The comments in MmapSegment and the test suite also drop the "fold
the CRC" phrasing: the scan computes the CRC incrementally, feeding
each window-sized chunk into the running value.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: core/src/test/java/io/questdb/client/test/cutlass/qwp/client/sf/cursor/MmapSegmentRecoveryBoundaryTest.java
+53-5Lines changed: 53 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,10 @@
60
60
* point under a JIT-compiled caller — the JDK 8 CI flake this suite guards
61
61
* against reintroducing.)
62
62
* <p>
63
+
* The suite also guards the fully-readable side of the same machinery: a file
64
+
* larger than the scan's pread window, whose recovery slides the window
65
+
* forward and checks one frame's CRC in chunks spanning several window loads.
66
+
* <p>
63
67
* These tests drive the production entry point ({@code openExisting}), not
64
68
* private scan methods via reflection, so they exercise the real recovery
65
69
* path end to end.
@@ -114,10 +118,11 @@ public void testRecoveryKeepsFramesBeforeUnbackedTail() throws Exception {
114
118
* The harder case: a frame whose 8-byte header sits on a backed page but
115
119
* whose payload reaches into the unbacked hole (a torn write leaves a real
116
120
* positive {@code payloadLen} with the payload spanning the boundary). The
117
-
* CRC therefore folds across the backed-to-hole edge: the backed bytes are
118
-
* real, the hole preads as zeros, the CRC mismatches, and recovery rejects
119
-
* that frame while keeping the one below it. The surviving non-zero header
120
-
* bytes at the bail-out position are flagged as a torn tail.
121
+
* CRC check therefore reads bytes on both sides of the backed-to-hole
122
+
* edge: the backed bytes are real, the hole preads as zeros, the CRC
123
+
* mismatches, and recovery rejects that frame while keeping the one
124
+
* below it. The surviving non-zero header bytes at the bail-out position
0 commit comments