Commit 41ae975
fix(ilp): cursor SF — apply PR-17 review critical and moderate findings
Critical:
- C1: SegmentRing.openExisting quarantines corrupt-first-frame .sfa
files to <path>.corrupt instead of unlinking, preventing silent
loss of valid frames behind a bit-flipped frame[0] CRC.
- C2: clamp wireSeq in CursorWebSocketSendLoop.handleServerRejection
against nextWireSeq-1 (matches OK-ACK branch); SegmentRing.acknowledge
also clamps at publishedFsn for defense-in-depth.
- C4: recordFatal now runs before dispatchError at all four HALT sites
in CursorWebSocketSendLoop so the typed terminal error is latched
before the user handler is invoked.
- C5: MmapSegment.create removes the on-disk file on mmap-fail catch;
SegmentManager.serviceRing cleanup removes the path even when the
spare is null.
- C7: remove stray QWP_CLIENT_REVIEW.md (review notes for vi_egress).
- C8: Sender.build wraps startOrphanDrainers in its own try/catch that
closes the connected sender on failure; the outer catch (which
closes cursorEngine directly) only fires for the pre-connect window
before ownership transfer.
Moderate:
- M1: MmapSegment.openExisting validates baseSeq >= 0 and throws
MmapSegmentException so SegmentRing's skip-with-log handles it.
- M2: SegmentRing.openExisting catches Throwable per-file and wraps
the whole recovery body in an outer catch that closes every
recovered segment on rethrow, plugging fd+mmap leaks.
- M3: POSIX read/write/append reject negative len with EINVAL,
matching the existing Win32 guard.
- M4: crc32c.c _Static_assert on __BYTE_ORDER__ so big-endian builds
fail loudly rather than silently miscompiling slice-by-8.
Tests:
- C9: ServerErrorAckTerminalTest and IoThreadErrorSurfacedOnRowApiTest
flipped from STATUS_SCHEMA_MISMATCH (DROP) to STATUS_PARSE_ERROR
(HALT) — the terminal-throw contract being asserted is the HALT
contract per spec. New testDropPolicyNackDoesNotHaltAndAdvancesAck
pins the DROP_AND_CONTINUE contract.
- C10: MmapSegmentTest.testFirstFrameCrcCorruptionFlagsTornTailAnd
PreservesFile covers the unit-level contract for corrupt frame[0].
- C11: PrReviewRedTestsE2e adds end-to-end coverage for the central
user-visible error API contract — flush() after a HALT NACK throws
LineSenderServerException carrying the typed SenderError.
- SegmentRingTest.testAcknowledgeIsMonotonic publishes frames before
acking to reflect the new clamp-at-publishedFsn contract.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 36b0839 commit 41ae975
14 files changed
Lines changed: 967 additions & 201 deletions
File tree
- core/src
- main
- java/io/questdb/client
- cutlass/qwp/client/sf/cursor
- test/java/io/questdb/client/test/cutlass/qwp/client
- sf/cursor
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
28 | 49 | | |
29 | 50 | | |
30 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
97 | 106 | | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
102 | 111 | | |
103 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
104 | 117 | | |
105 | 118 | | |
106 | 119 | | |
107 | 120 | | |
108 | 121 | | |
109 | 122 | | |
110 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
111 | 128 | | |
112 | 129 | | |
113 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1091 | 1091 | | |
1092 | 1092 | | |
1093 | 1093 | | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
1094 | 1098 | | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
1098 | | - | |
| 1099 | + | |
1099 | 1100 | | |
1100 | 1101 | | |
1101 | 1102 | | |
| |||
1115 | 1116 | | |
1116 | 1117 | | |
1117 | 1118 | | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
1118 | 1137 | | |
1119 | 1138 | | |
1120 | 1139 | | |
| |||
1139 | 1158 | | |
1140 | 1159 | | |
1141 | 1160 | | |
1142 | | - | |
| 1161 | + | |
1143 | 1162 | | |
1144 | 1163 | | |
1145 | 1164 | | |
| |||
Lines changed: 34 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
438 | 442 | | |
| 443 | + | |
439 | 444 | | |
440 | 445 | | |
441 | 446 | | |
| |||
481 | 486 | | |
482 | 487 | | |
483 | 488 | | |
484 | | - | |
| 489 | + | |
| 490 | + | |
485 | 491 | | |
| 492 | + | |
486 | 493 | | |
487 | 494 | | |
488 | 495 | | |
| |||
788 | 795 | | |
789 | 796 | | |
790 | 797 | | |
791 | | - | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
792 | 801 | | |
| 802 | + | |
793 | 803 | | |
794 | 804 | | |
795 | 805 | | |
| |||
837 | 847 | | |
838 | 848 | | |
839 | 849 | | |
840 | | - | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
841 | 862 | | |
842 | 863 | | |
843 | 864 | | |
| |||
857 | 878 | | |
858 | 879 | | |
859 | 880 | | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | 881 | | |
866 | 882 | | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
871 | 889 | | |
| 890 | + | |
872 | 891 | | |
873 | 892 | | |
874 | 893 | | |
875 | 894 | | |
876 | | - | |
| 895 | + | |
877 | 896 | | |
878 | 897 | | |
879 | 898 | | |
880 | 899 | | |
| 900 | + | |
881 | 901 | | |
882 | 902 | | |
883 | 903 | | |
| |||
0 commit comments