Skip to content

[Bug]: Branch index restore BVT intermittently misses inserted FULLTEXT2 row and falls back from HNSW after readiness checks #31065

Closed

Description

@iamlinjunhong

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Searched open and closed issues for the exact case name, branch/index restore, branch readiness, and branch/cdc_tail. Closed #27950 covered the original permanently uninitialized branch indexes; its validation discusses initialization races, but it does not track this current regression test's two readiness/assertion failures. Closed #27788 covered cross-CN fulltext cache invalidation. Open #31063 covers a DROP/ISCP lock cycle, which passed in this attempt and is a different failure.

Branch Name

codex/loom/develop/00dc00b7c5924c06e67f30dbb1e4ddf8454d5af2db0ad0f41025be8c4f8aa183 (PR #31029); current official-main source control below.

Commit ID

PR head 00a2705af9f0c375d8f84f8f2c24713afc8af00e.
Current official main 80ea60aaeb42d06415438e0eb26eeb76b124993a (verified before and after controls).

Other Environment Information

Linux/x64, multi-CN Compose pessimistic BVT, coverage-instrumented shared MatrixOne build, Go 1.27.1, run 40147835780, attempt 2.

BVT command: bash optools/run_bvt_group.sh <mo-tester> <absolute cases directory> 0 <absolute resources directory>; generation 40147835780-1, retaining the original group on rerun.

Actual Behavior

Only two statements fail, both in test/distributed/cases/git4data/branch/edge/branch_multi_index_restore_init.sql:

02:13:30 row 79:
select id from leaf_t
where match(body) against('+branch' in boolean mode) order by id;
expected: 1,3
actual:   1

02:13:30 row 84:
explain select id from leaf_t
order by l2_distance(v, '[0,0,0]') limit 2;
expected regex: Vector Index Scan on
actual: Project -> Sort -> Table Scan on issue27950_branch_indexes.leaf_t

Both hidden-storage readiness checks and the no-permanent-job-error assertion passed. The actual HNSW result and independent (l2_distance(...) + 0) result both passed (3,2); the vector failure is its required index-plan assertion, not a wrong Top-K. FULLTEXT2 did take its index plan but missed the newly inserted row. File summary: 35 statements, 33 success, 2 failed. Whole BVT: 88255 total, 87795 success, 2 failed, 458 ignored, 0 abnormal. Final producer exit 1. Coverage calculated no verdict because its required producer was unsuccessful; CI Required propagates that failure. UT Coverage passed in attempt 2. The previous attempt's vector_hybrid_fulltext.sql DROP deadlock did not recur.

Artifacts: execution 12583584860 (bvt-pessimistic.log), diagnostics 12584570134 (upload/mo-tester/report/error.txt, complete tester log and both CN logs).

Expected Behavior

The regression's readiness condition must establish the state its assertions require. Existence of any FULLTEXT2 cdc_tail or HNSW metadata alone does not establish that both branch DML commits have been consumed. Preserve the fulltext result, HNSW indexed-path assertion and independent exact-distance oracle; do not hide the race with sleeps, skips, expected missing rows, or a weaker plan assertion. If a correct readiness barrier still returns stale fulltext data, fix that product mechanism separately.

Steps to Reproduce

  1. Execute the unchanged 35-statement case in the original multi-CN pessimistic BVT lane.
  2. It creates FULLTEXT2 and HNSW indexes, forces source reindex, branches, updates row 1, inserts row 3, then polls for any cdc_tail/metadata before asserting both index paths.
  3. Compare the two statements above and preserve CN/ISCP timestamps. This occurrence is scheduling-sensitive; the local controls below did not reproduce it.

Additional information

Mechanism evidence, with inference distinguished from observation:

  • CN logs register leaf table 282185 restore jobs at 02:13:28.827675/.831200, start watermark 1792894408769041563-1.
  • HNSW RestoreInitSQL replaces job 2 with job 3 at 02:13:29.097117, start watermark 1792894408906738806-1; assertions run at 02:13:30.
  • The BVT waits only for max(chunk_id) >= 0 and count(*) > 0. Neither compares a consumed watermark against the later branch writes. hnswIndexCoversSnapshot in pkg/sql/plan/apply_indices_hnsw.go deliberately rejects a generation behind the source and keeps the exact table scan. Thus the HNSW fallback is consistent with its correctness guard; the combined evidence suggests an insufficient BVT readiness barrier. It does not prove the underlying FULLTEXT2 cause or a particular cache bug.

Four-part non-PR flaky candidate evidence:

  1. Complete failed-job logs, original tester output, error report and relevant server diagnostics inspected. This is a runtime result/plan assertion, not compilation, types, static analysis or a security gate. No deterministic local product failure was found.
  2. Exact PR head: the original 35 statements passed three consecutive times on fresh real two-CN pessimistic embedded clusters. The probe preserves the original one-second/60-second readiness polls, drains every result, and asserts every returned result set: both readiness values, no failed jobs, both required index plans, fulltext 1,3, HNSW and independent scan 3,2, and branch diff 2. No retry of either failed assertion, sleep added to synchronization, skipped statement, or source change.
  3. Complete 10-file PR business delta reviewed: only Iceberg rewrite snapshot summary operation is changed to replace and its tests adjusted. No init/global-state, branch/clone, fulltext/HNSW, ISCP, optimizer, lockservice, BVT case or CI harness change. The changed writers are entered only for Iceberg maintenance requests; this SQL case never calls them. Exact-head SCA, ordinary UT, shared build and proxy BVT passed; the maintenance package also passed in attempt 1's coverage output (2.389s). These inputs are unchanged and that evidence is reused.
  4. Current official-main source: identical probe, three consecutive passes, results and durations recorded below. The lane forbids new or switched worktrees, so a Go overlay replaces every differing Go source/test file with exact current-main bytes: 10 Iceberg files restored to baseline, plus 7 Go files from the two newer main commits. All 17 replacements were verified against Git blobs or unchanged baseline bytes. All other compiled source and module/native inputs are identical to main. Both overlays add only the identical temporary diagnostic test. Git HEAD and tracked worktree remain unchanged.

Controls use the repository mo-cgo-test wrapper, Darwin/arm64, Go 1.27.1, CGo enabled, no race and no extra tags; same two-CN pessimistic topology and source SQL. This matches race/tags/CGo choices but does not recreate Linux Compose, full-suite load or CI coverage instrumentation. Passing controls support only the narrow flaky-candidate classification, not a main failure reproduction or CI success.

Commands (temporary diagnostics and output under the task TMPDIR):

.agents/skills/mo-dev/scripts/mo-cgo-test -p=1 -overlay "$TMPDIR/pr31029-1a76a2ea58d22e0b-validation/pr-overlay.json" -v -count=3 -timeout=600s -run '^TestLoomPR31029BranchMultiIndexRestore$' ./pkg/tests/sqlintegration/multicn
.agents/skills/mo-dev/scripts/mo-cgo-test -p=1 -overlay "$TMPDIR/pr31029-1a76a2ea58d22e0b-validation/main-overlay.json" -v -count=3 -timeout=600s -run '^TestLoomPR31029BranchMultiIndexRestore$' ./pkg/tests/sqlintegration/multicn

The run's one authorized failed-jobs rerun was already consumed when attempt 2 was accepted at 02:00 UTC. This report records the new signature; no additional automatic rerun is planned or requested, no unrelated code is changed, and no reviewer action is requested.

Control results (all 35 statements and nine result-set/plan oracles selected in each round):

  • pr: 25.76, 25.68, 26.00 seconds; three passes, terminal exit 0.
  • main: 26.14, 25.83, 25.87 seconds; three passes, terminal exit 0.

SHA256 receipts:

  • pr-three.log: bb10dbbfd74bbd5c4a08908ea959bffc8f201ba07e2b9b63fcd7bf5acadd8539
  • main-three.log: 4cfab4f4b63808658a351528567ada40eba4e40262e2e3e495c73267673ab64f
  • branch_probe_test.go: 06a1d302d56c6522397a3d1173e054a63bfadbd342f5d9eae331446fadf29c43
  • overlay-audit.json: 3de5b1391cbdd757503b08360dfee654702925934120c43242d8f9f768aaeb71
  • ci-error.txt: 8343ed9e0894c7230e0e581278b5f5edbb60ee94f6419a612866faecc854559c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions