Skip to content

tests: native command-after probe checks each journal event once - #548

Merged
luisleo526 merged 2 commits into
mainfrom
perf/cr389-oracle
Oct 27, 2026
Merged

luisleo526 merged 2 commits into
mainfrom
perf/cr389-oracle

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Summary

The probe in tests/test_native_command_after.cpp compared has_command_after and first_command_after against a scan that walked the retained journal from its oldest event for every cursor at every callback. The journal is paged, so each old event is a paged read, and the cost grew with the square of the journal length: one long row took about 560 s on CI while the other rows took seconds.

The probe now verifies the ordinals of the retained window once, incrementally (each event is read once, from the newest back to the first position not yet checked, plus the junction with the previous check), and answers the per-cursor question from the newest event, which the order check makes equivalent to the old scan. Both CHECK lines (fast == searched, fast == scanned) are unchanged.

Test-only change: one file, +24/-9. No engine source changes.

Evidence

  • Fixed test, single row: 72 runs, 5,278,598 comparisons, finished in under 60 s (before: about 1,089 s on the same host class; about 563 s on CI).
  • Mutation check: changing has_command_after from > to >= (a planted wrong answer, not committed) makes the row FAIL, with both CHECK lines firing at test_native_command_after.cpp:170-171.
  • Merged with current main (the 8-slice split of this test): all 8 slices pass on the merged tree, 772 s total for the job.

Notes

  • The honest limit is stated in a code comment: for the single predicate it compares against, the probe's answer is the same tail test has_command_after uses; the independent parts are the full-window order proof (every event, once) and the first_command_after search.
  • If slice 8 is now fast, its entry in the pinned slow-row list can be removed in a follow-up.

🤖 Generated with Claude Code

… once per cursor

The probe in test_native_command_after compared has_command_after and
first_command_after against a scan that walked the retained journal from its
oldest event for every cursor at every callback. The journal is paged, so each
old event is a paged read, and the cost grew with the square of the journal
length: one long row took about 560 s on CI while the other rows took a few
seconds.

The probe now verifies the ordinals of the retained window once, incrementally
(each event is read once, from the newest back to the first position not yet
checked, plus the junction with the previous check), and answers the per-cursor
question from the newest event, which the order check makes equivalent to the
old scan. Both CHECK lines are unchanged. A planted wrong answer in
has_command_after (> changed to >=) still fails the row.

The long row now finishes in well under a minute on the same host class.
# Conflicts:
#	tests/test_native_command_after.cpp
@luisleo526
luisleo526 merged commit feae336 into main Oct 27, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant