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
{{ message }}
Repository navigation
Commit 9e8bbdc
Browse filesBrowse the repository at this point in the historyBrowse files
Stop the sorted-page cost guard measuring a cache, and give it a clock-free twin
`Build with Java 17 in MacOS` failed on this guard in 5 of the last 12 runs, and
only ever on macOS. Two causes, both in the test.
**It was warmed into meaninglessness.** `timeOf` ran the query once to warm and
then timed three more. But re-querying a collection that was just written
measures a cache, not a decode: over these same 2000 fat rows a blocking sort
costs 353 ms, then 83 ms, then 0.8 ms. By the timed runs, the decode this guard
exists to detect had already been cached away, and what was left was one to five
milliseconds of JIT and scheduling — which reads 0.6x on an idle laptop and 4.9x
on a loaded runner. Each half is now measured once on a collection no query has
touched, and sampled over several fresh ones with the quickest kept, because
contention can only ever add time.
**It compared a fat collection against a lean one**, assuming the index walk
cancelled between them. It does not: the fat collection's index lives in a file
two orders of magnitude larger, so walking it costs more I/O for reasons that
have nothing to do with decoding. Measured cold, a fat sorted page cost 4.6x a
lean one *with the optimisation present and working* — a floor sitting above the
3x threshold, which is the failure CI kept reporting. Both halves are now the
same collection shape sorted two ways, indexed against unindexed, so row count,
document size, file and returned row all cancel and only the discarded-row
decode is left. Measured 4.5x on the worst run of a laptop under load and 45x on
the best, against a 2x threshold; a regression does not narrow that ratio, it
removes it, because the two halves become one code path.
**And a second test with no clock in it at all.** A cost guard's failure mode is
not going red, it is going green while measuring nothing, and on a shared runner
a timing threshold can only ever be a compromise.
`testSortedPageIsPlannedFromTheIndex` asserts the planner sets
`sortIndexDescriptor` for a limited sort on an indexed field and leaves it unset
for an unindexed one. That cannot be made to flake.
Both were confirmed to fail on a planted regression rather than pass vacuously,
and they catch different ones: disabling the execution path fails the cost guard
and not the plan test, disabling the planner fails the plan test. Test-only; no
library code is touched. mvstore module green at 5386 tests.
Copy file name to clipboardExpand all lines: nitrite-mvstore-adapter/src/test/java/org/dizitart/no2/integration/collection/CollectionSortedFindCostTest.java
0 commit comments