Repository navigation
Count text index postings from every query_log row that carries them - #114338
PedroTadim merged 2 commits into
Conversation
02346_text_index_parallel_replicas asserted its second column from system.query_log rows filtered by type = 'QueryFinish', and flaked as `1 0` in 12 runs across 11 unrelated PRs and master since 2026-07-01. At parallel_replicas_local_plan = 0 the initiator does no index analysis, so TextIndexUsedEmbeddedPostings can only be incremented by the follower that deserialized the dictionary (MergeTreeIndexText.cpp). When the initiator has its answer and tears down its connections, a follower still writing results loses the socket and terminates with Code: 210, which executeQuery logs as ExceptionWhileProcessing. Such rows do carry ProfileEvents, so the counter is present - the type filter discarded the only row holding it. ParallelReplicasUsedCount is charged to the coordinator, i.e. always the initiator, which is why the first column never flapped. Replaying the test's own predicate over the archived query_log of two failing CI runs (PR ClickHouse#103526 arm_binary and PR ClickHouse#112918 amd_debug) turns the failing run into a passing one in both, 113 -> 114 and 88 -> 89 healthy runs, with no healthy run regressing. The negative control still reddens: with use_skip_indexes = 0 the test yields `1 0` in 20 of 20 runs, so the assertion keeps its discriminating power. Closes: ClickHouse#113751
Internal second-model review (2 findings, both addressed before publishing)I reviewed the resulting diff cold, then a second model re-reviewed the full scope
Checks that passed, worth stating since four earlier attempts on this test were closed unmerged:
Session id: cron:clickhouse-review-slot-8:20260811-134200 |
Pre-PR validation gate
No 50/50 randomized campaign was run and none is claimed: at the measured 6.29e-05 per-run rate, 50 runs has 0.3% power. A prior 50,051-run loaded campaign found 0 defects, which is what redirected the investigation to the archived CI logs. |
|
cc @ahmadov, could you review this? |
|
Workflow [PR], commit [3862e65] Summary: ❌
AI ReviewSummaryThis PR narrows a real Final Verdict✅ Approve. |
CI finish ledger - 3e0ff9aEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Both hung checks are the same trunk defect and not caused by this PR, whose whole diff is one Session id: cron:our-pr-ci-monitor:20260812-040000 |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units6 translation units recompiled, 5 s compile time in total, 6 of them have a recent master baseline. |
CI finish ledger - 3862e65Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
This PR's diff is one line in Session id: cron:our-pr-ci-monitor:20260812-083000 |
483d16a
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Closes: #113751
Requested by @ alexey-milovidov on #103526 (comment).
02346_text_index_parallel_replicasflakes as1 0- 12 runs across 11 unrelated PRs and master since 2026-07-01, second column only.The probe discards the only row carrying the counter.
TextIndexUsedEmbeddedPostingsis incremented at one site,MergeTreeIndexText.cpp:1232, by whichever server deserializes the dictionary. Atparallel_replicas_local_plan = 0(randomized;0in all 12 failures) the initiator does no index analysis, so only a follower can increment it. When the initiator has its answer and tears down connections, a follower still writing results loses the socket and ends withCode: 210, logged asExceptionWhileProcessing(executeQuery.cpp:851). Those rows do carry ProfileEvents, sotype = 'QueryFinish'dropped the counter.ParallelReplicasUsedCountis coordinator-charged, hence the first column never flapped.The assertion is not weakened: with
use_skip_indexes = 0the test still yields1 0in 20 of 20 runs after the fix. Replaying the test's own predicate over both failing runs' archivedquery_log, the defect disappears and no healthy run regresses, on aarch64 and x86_64 alike (below).The other 87 tests reading
ProfileEventsfromquery_logwithtype = 'QueryFinish'under parallel replicas need no change: each one either scopes byquery_id, requiresis_initial_query, or omits theOR position(query, currentDatabase()) > 0disjunct, and any one of those makes a follower row unreachable (it carriescurrent_database = 'default'and a differentquery_id). 02346 was the only file with the disjunct and noquery_idscoping.I treated the follower's
Code: 210as expected rather than a bug: the initiator stops reading once it has its answer, both initiatorQueryFinishrows are correct, and the earlier assertions (15 30,3 3) matched. Making the initiator wait for followers is a much wider engine change, and I have not made it - your call if you want it.Validation on the two failing CI runs (old vs new predicate, same rows)
1 01 0b214f13f(#103526)924143d1(#112918)The one
1 0run per job flips to passing and joins the healthy set; no healthy run regresses and no new failure appears.Version info
26.8.1.1221(included in26.8and later)