Commit 05c3829
test(ilp): wrap SF cursor tests in assertMemoryLeak; PR-17 regression tests
Test-only commit; production fixes are in the previous commit so the
new red-then-green tests below land green under git bisect.
assertMemoryLeak wrapping (C2). Every @test method across the SF cursor
test surface (15 files, 75 tests) is now wrapped in
TestUtils.assertMemoryLeak(() -> { ... }), so any native-memory leak
introduced anywhere in the cursor codepaths (mmap segment lifecycle,
slot lock fd, drainer pool, native Files calls) surfaces in CI instead
of accumulating silently. Test method signatures changed to declare
throws Exception where needed.
New regression tests:
* MemoryOrderingFindingsTest — pins MmapSegment.frameCount and
CursorSendEngine.closed as volatile via reflection. Reflection is
used because x86's strong memory model masks plain-long staleness in
practice; a stress test would be flaky, the modifier check is
deterministic.
* SegmentManagerTotalBytesRaceTest — concurrent stress with eight
producer threads doing register/spin/deregister cycles while the
manager's worker polls at 1us. Reads totalBytes via reflection
after every ring is deregistered; the field must read 0 (no
accounting drift). Produced 50-60 KB of drift on the failing run
pre-fix.
* EngineCloseSlotLockReleaseTest — opens an engine, reflectively
nulls the ring field to inject an NPE on engine.close(), then
asserts a fresh SlotLock.acquire on the same dir succeeds. Pre-fix
the close-path NPE skipped slotLock.close() and the kernel-held
flock blocked the second acquire.
* EmptyOrphanSlotChurnTest — opens-and-closes a CursorSendEngine on a
fresh slot without writing, asserts no .sfa file remains. Re-opens
and asserts the same. Pre-fix sf-initial.sfa survived close because
unlinkAllSegmentFiles was gated only on publishedFsn>=0.
* FilesFindFirstErrorTest — pins the post-fix contract:
Files.findFirst on a missing path must return a negative sentinel
so callers can distinguish "opendir failed" from "directory empty".
Test cleanups:
* Migrate ~25 test cleanup blocks from `if (find != 0)` /
`if (find == 0)` to `if (find > 0)` / `if (find <= 0)` so the new
Files.findFirst -1L sentinel is handled correctly and findClose is
never called on -1.
* BackgroundDrainerPoolRaceTest switches its leak check from
java.util.List.contains to indexed ObjList.getQuick iteration to
match the new BackgroundDrainerPool.snapshot() contract.
* ReconnectTest class doc — drop the connectionGeneration mention
(refs were removed alongside the dead retry loop).
* Delete ConnectionGenerationTest — every hook it tested
(bumpConnectionGenerationForTest, getConnectionGenerationForTest,
onWireReconnect bump on disk recovery) was removed alongside the
dead retry loop in the previous commit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 07b930a commit 05c3829
26 files changed
Lines changed: 2596 additions & 1955 deletions
File tree
- core/src/test/java/io/questdb/client/test
- cutlass/qwp/client
- sf
- cursor
- std
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
Lines changed: 0 additions & 251 deletions
This file was deleted.
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| |||
0 commit comments