Skip to content

test: fence cross-CN view visibility in prepared-reader rebind test - #30382

Merged
XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
ck89119:issue-30344-main
Oct 16, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
ck89119:issue-30344-main

Conversation

@ck89119

@ck89119 ck89119 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #30344

What this PR does / why we need it:

TestIssue30090ReplaceViewLifecycleOrder/prepared_reader_rebinds_after_replace replaces a view on CN1 and immediately re-executes the prepared reader on CN0, expecting the replacement result (5). Under sacrificing-freshness consistency a CN read snapshot is bounded by its own applied logtail watermark, so CN0 can still legally observe the pre-replacement view and return the old result (3); CI under load hits this window intermittently.

The prepared-plan invalidation path itself is sound: PREPARE captures the view ObjectRef in the plan schemas, and EXECUTE detects the replacement through the catalog cache (HasNewerVersion sees the new relation id) once CN0 has consumed the commit, then rebuilds the plan.

This PR establishes CN1 -> CN0 visibility with the existing mo_ctl('cn', 'SYNCCOMMIT', '') fence before the revalidation assertion, the same boundary fence main's #30334 added for other cross-CN tests. No sleeps, retries, relaxed expectations, or skips are introduced; the expected value 5 and all other assertions are unchanged.

Local validation on Darwin/arm64: focused run passes all five subtests; -count=5 -race repeat run passes.

…atrixorigin#30344)

TestIssue30090ReplaceViewLifecycleOrder/prepared_reader_rebinds_after_replace
replaces the view on CN1 and immediately re-executes the prepared reader on
CN0. Under sacrificing-freshness consistency a CN read snapshot is bounded by
its own applied logtail watermark, so CN0 can still legally observe the
pre-replacement view and the CI assertion of 5 fails intermittently.

The prepared-plan invalidation path itself is sound: PREPARE captures the view
ObjectRef and EXECUTE detects the replacement through the catalog cache
(HasNewerVersion sees the new relation id) once CN0 has consumed the commit.

Establish CN1 -> CN0 visibility with the existing SYNCCOMMIT fence before the
revalidation assertion, as matrixorigin#30334 already does at other cross-CN boundaries.
No sleeps, retries, relaxed expectations, or skips are introduced.
@mergify mergify Bot added the kind/test-ci label Oct 16, 2026
@matrix-meow matrix-meow added the size/XS Denotes a PR that changes [1, 9] lines label Oct 16, 2026
@ck89119
ck89119 marked this pull request as ready for review October 16, 2026 07:03
@ck89119
ck89119 requested a review from XuPeng-SH as a code owner October 16, 2026 07:03
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 69cba777820ed08bfeef2f33f993020cf3b81947

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 69cba777820ed08bfeef2f33f993020cf3b81947

Assessment: approve

Reviewed the complete delta and visibility, prepared-plan, and cleanup paths. The existing SYNCCOMMIT fence correctly establishes cross-CN visibility without clearing the prepared statement or weakening its assertions. The change adds bounded synchronization to one test and no production SQL overhead. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1

Validation:

  • All five TestIssue30090ReplaceViewLifecycleOrder subtests passed in normal mode with -count=1 and -vet=all.

  • The focused race run passed; its measured 5.88-second duration selected five repetitions. All five repetitions passed in one process.

  • Isolation preflight passed. Verified 192 native inputs and 62 retained artifacts before testing through the supplied executor.

  • Formatting, diff checks and source-cleanliness checks passed. Reconciled commands, source fingerprints, exit receipts and logs; final audit receipt checks/1792147302612396511-2.json exited 0.

  • Evidence index: /home/xupeng/.local/state/mo-bot/jobs/e7c30f17244f1a9a428a8306/attempt-1/review-evidence.json.

Limitations:

  • Local execution covered the affected test, not the entire issues package. Supplied exact-head CI reports Ubuntu UT and Linux ARM static-analysis success, but contains no raw CI logs.

  • The linked issue's full body was absent; its behavioral contract was assessed from the PR description, existing regression and production callers.

@mergify mergify Bot added the queued label Oct 16, 2026
@mergify

mergify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-16 10:42 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-16 11:03 UTC · at ea466ca1a8249750f74f620b19b865c97f9fd355

This pull request spent 20 minutes 59 seconds in the queue, with no time running CI.

Reason

Pull request #30382 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@ck89119
ck89119 deleted the issue-30344-main branch October 17, 2026 05:47
XuPeng-SH added a commit that referenced this pull request Oct 20, 2026
…30632)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes #30622
Fixes #30625
Fixes #30621 (fixture completion and SI assertion ordering)

Related #30344 is already fixed on the base by #30382; this PR preserves
and validates that correction.

## What this PR does / why we need it:

A flush can drop an empty appendable object without writing its snapshot
file. Unconditionally switching that object to a persisted node makes an
older reader load zero extent from a nonexistent file. Keep unwritten
appendable shells in memory, including WAL/checkpoint reconstruction,
while retaining their frozen lifecycle. Any nonzero persistence payload,
including legacy placeholder stats, keeps the existing persisted path
and reference ownership.

The remaining CI corrections establish the completion conditions
required by their assertions:

- `TestISCPExecutor3` awaits each of its four index jobs, then applies
the consumers' actual committed frontier before checking source/index
equality.
- CHECK namespace tests drain lazy allocator-row cleanup from previous
DROP/COPY operations before selecting a fresh SI snapshot. The confirmed
interfering transaction was a background `DELETE mo_increment_columns`:
it advanced the table-wide `mo_tables` lock watermark after the new SI
snapshot. Replace three blind attempts with an observable completion
condition and one statement execution. Keep all existing authoring,
enforcement, rollback and name-reuse assertions. Empty concurrency-only
tables use explicit primary keys to avoid irrelevant allocator cleanup.
- A controlled real two-CN test commits an unrelated table after the
target SI snapshot, verifies error 20619 without snapshot advancement or
DDL effects, and verifies subsequent fenced name reuse succeeds.
Production SI admission remains conservative; this does not promise
progress during continuous concurrent metadata changes.

### Validation

Linux/amd64, Go 1.27.1, matching CPU CGo build, `matrixone_test`,
bounded timeouts and disk-backed temporary storage:

- Deterministic pre-fix reproduction on base
`7c146f4adbf068dd0c06b377157cfb7d7698b1eb`: adding an old-reader scan to
the existing empty-object fixture fails both branches with the same
NoExt/zero-extent/missing-file signature.
- Full owning `tables` package passes normal and race tests. Empty-shell
scans before and after WAL/checkpoint restart, original `TestDelete3`,
flush-transfer visibility/rollback, flush errors, dropped objects and
physical abort-hole controls pass.
- Original ISCP, complete CHECK namespace and existing prepared-view
integration roots pass normal and race checks.
- Focused adaptive race checks: node lifecycle 100, persisted
publication 100, empty-object replay 51, `TestDelete3` 100, ISCP 4,
prepared-view 5; CHECK uses its separately measured bounded full-root
run.
- Incremental `go vet`, `molint` and configured golangci-lint pass for
all four changed package closures; refreshed for the final embedded-test
delta.

The production correction adds bounded stats checks only at object
construction/upgrade, with no new I/O or scan work. The CHECK fixture
now observes the existing 10-second lazy-cleanup cadence: its final
normal root takes 33.60s versus 7.81s without the completion wait. It
reuses the same two-CN fixture and data; the additional time proves
cleanup rather than relying on that worker not running during
assertions. Hosted CI remains pending.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
mergify Bot pushed a commit that referenced this pull request Oct 22, 2026
Classic FULLTEXT and FULLTEXT2 currently reject scan-local `MATCH(...) OR scalar_predicate` and `NOT MATCH(...)` with error 20105. This change supports those predicates, including nested AND/OR/NOT, while retaining nonmatching rows that qualify through a scalar branch and returning overlapping matches once per base row.

The composition path attaches one complete, unique raw-score stream per distinct bound MATCH leaf with preserving LEFT joins, normalizes absent scores to typed zero below user outer joins, and evaluates the original Boolean expression in a FILTER. Emitted zero and negative scores, scalar SQL NULLs, and exact term/mode/parameter identities remain intact. Served scores can be consumed by projection, aggregation, windows, and ordering. Explicit FORCE INDEX FOR JOIN hints reach the same path. Cross-binding, missing-index, mismatched-index-parts, and unserved-score consumers retain their explicit refusal behavior.

This route requires a MATCH beneath OR/NOT in a scan-local WHERE predicate. Existing positive and projection-only MATCH membership behavior is unchanged; standalone projection does not globally gain zero-score rows. Fulltext candidate limits and ANN truncation are disabled for this composition path: explicit distance/score ordering and LIMIT/OFFSET operate on the complete Boolean-filtered set. FULLTEXT2 keeps its existing asynchronous visibility contract.

Design: [exact approved design content](https://github.com/VioletQwQ-0/matrixone/blob/dde7e9ef357815198133ef8abe666cb5b021d94c/docs/design/20261014-fulltext-boolean-composition.md), originally reviewed at `dce89ab1ad4f61eb157c84c2cd55e89902fbaa87` (content SHA256 `df7d8bafc2772d79fe18934226c1c3608e51573348ba97494d6e9bc1e32a1925`). User-facing supported/refused semantics are documented in `docs/sql/fulltext-boolean-composition.md`.

Validation completed on the reviewed candidate source:

- Independent design and implementation reviews passed, including the FORCE JOIN correction. All 14 `^TestFullTextBoolean` tests passed; owning planner/provider packages with all vet analyzers and incremental affected-package lint passed.
- Clean production base `5a0570ea70083c9365719009a5ed8d7618f9ed91`: 12/12 checks, comprising eight expected real 20105 receipts across both engines and four positive/projection-only controls.
- Native Go 1.27.1 Darwin arm64 service: canonical normal comparison of `fulltext_boolean_composition`, `fulltext2_boolean_composition`, and `fulltext_wrapped_score`, twice on the same instance, each 235/235 with zero failed/ignored/abnormal cases. The reviewed SQL/result pairs were unchanged; database/snapshot teardown was verified between runs.
- Supplemental execution: 50 semantic checks, 20 real EXPLAIN ANALYZE checks, and two JDBC server-prepared subprocess checks, all passing (72/72). Includes three-valued logic, nullable multi-column content, signed/zero scores, exact leaf projection binding, duplicate-leaf controls, FORCE JOIN hints, global pagination, and exact vector sorting with an IVF index present. Binary prepared statements were reused across terms/thresholds/NULL/absent patterns, including classic error 20301 followed by successful reuse. Historical/current snapshot results demonstrably differed under each provider's visibility contract.
- Actual core Analyze counters show complete 3-hit streams, preserving joins with 8 base rows, Boolean filtering 8→5, and outer pagination 5→2. Repeated leaves use one stream; distinct leaves use two. A signed fixture emits all four scores, including one negative and three exact zeros. Owned processes/data/sockets/ports were cleaned.

Original publication provenance: reviewed original head `8c39a92bc3da43b88be525ae3da50b9e7bc0a434`; Mac execution used temporary commit `027e413ee700edf3e4810606f06ae6a6cf2e5c2d`. That original publication only normalized the three local commits' author/committer identity. All three final heads have exactly the same complete Git tree `d721a6d69f1a24ded1087fa1a47ae8ea8e47a517`, independently audited; no source change or duplicate runtime rerun was introduced by history recovery or attribution.

Limits: bounded single-CN CPU validation, not production-scale capacity/performance, HNSW runtime, multi-CN, GPU/Sirius, or full repository CI. The separate #30164 optimization is not included; combined changes have planner-layer evidence only. Latest-main preflight at `fab7b5c0430a475bf64ad1619ce4d5249013a138` merges cleanly, but its join/CTE changes have not been rerun as a combined runtime build. Local independent design, implementation, runtime acceptance, and cleanup gates are complete; this PR is ready for review. External repository approval and hosted CI remain merge gates, with no approval or CI-pass claim. Mergify subsequently merged that main into this branch at `1188011cbd8638bfc2219839b579d089d5199c60` (tree `b0241134ebc52db0d18f0653eb595f3c0967710a`); all 17 feature-change paths retain their reviewed bytes and modes. Original local execution remains proof at its recorded source tree; combined merged-main integration remains subject to hosted CI; see the scoped maintenance status below.

### Scoped CI maintenance

Maintenance commit: `bab2e835a0919d08e9646df8fc9bbb109263f7ca`. This is an additional test-only correction, not part of the original identity-only publication described above.

The source-head coverage failure in run [38599892439](https://github.com/matrixorigin/matrixone/actions/runs/38599892439/job/115976278666) came from the broadcast ownership fixture choosing scheduler completion when both completion and empty-consumer retirement were already observable. The waiter now rechecks retirement and preserves the received scheduler result for the unchanged terminal/error assertions. Genuine early completion, cancellation/deadline/error propagation, source interruption, output and allocation cleanup assertions remain intact.

Validation on source `15f3a5db33e56899d9292436d1502811cd4ec2a9` plus this exact maintenance patch (Darwin arm64, Go 1.27.1, genuine matching native CPU SDK, GOMAXPROCS=2, build parallelism=1):

- Coverage mode `set`, all vet analyzers, all five directly affected ownership roots and their subcases: PASS.
- Each affected root under race detection, then adaptive repetitions computed as `clamp(floor(30 / measured_seconds), 1, 100)`: PASS. The five roots are Product/HashJoin/LoopJoin shared-producer ownership and HashJoin/LoopJoin remote-source ownership.
- Owning-package normal tests were executed: the five affected roots passed, but the package is **not green** because `TestUnionNestedTopClearsAllocationOwners` failed with a spill-budget error. A root-only five-run control also failed on the unmodified source (1/5) and candidate (3/5); that test never calls the changed helper. These controls establish an independent test instability, not a blanket attribution of every failure variant or product acceptance. No UNION expectations or resource budget were changed.
- Scoped molint, incremental configured golangci-lint and diff/format checks: PASS.

For this maintenance delta, BVT is N/A: only a Go fixture's event-order oracle changes, with no production SQL entry point. The five real-operator ownership roots supply the corresponding regression evidence; the feature's canonical SQL/result pairs remain unchanged. Source15f hosted ordinary UT, SCA and both BVT jobs passed, while coverage/CI Required failed; none of those old runs is presented as new-head CI.

QA required: yes. This remains a user-visible FULLTEXT feature. Original bounded single-CN acceptance stays bound to its recorded original tree; deployment/multi-CN/capacity gates and external review remain separate. No issue closure, review approval, full-package success or new-head hosted-CI success is claimed by this maintenance update.


### Rebase and current validation (2026-10-22)

Current source: `5856b5a679197f302a655749cc54a1fbf5f46b90`, rebased onto main `0276f82fb72941efba8d2f8de738f1cb04174dae`. This section records current-source evidence; the earlier receipts remain historical evidence at their stated revisions.

The vector-routing conflict preserves both the Boolean composition exact-sort refusal and main's plugin membership capability. The original merge-only IVF mixed-OR assertion is restored alongside main's volatile-filter control; the existing capability table now checks Boolean refusal for IVFFLAT, HNSW, CAGRA and IVFPQ. The old broadcast fixture workaround is superseded by main's durable completion handling and introduces no compile-package delta.

Normal comparison exposed 13 stale metadata header lines. Two Boolean result files now follow main's deliberate computed-BOOL numeric TINYINT contract from #30191; the wrapped-score fixture now expects precision 20 for its declared VARCHAR(20). SQL, row values, NULLs, ordering and error assertions remain unchanged; results were not regenerated.

Validation on Linux/amd64, Go 1.27.1, fresh matching CPU native artifacts and disk-backed temporary storage:

- Complete planner, classic search reader, FULLTEXT2 search reader and FULLTEXT2 core packages pass normal tests and `go test -race -count=1` with bounded timeouts. These runs include existing roots, not just new cases.
- Both originally failing CI roots, `TestIssue30090ReplaceViewLifecycleOrder` and `TestISCPExecutor3`, pass on the combined source with `matrixone_test`. Main contains their synchronization corrections from #30382 and #30632.
- Incremental `go vet` and configured golangci-lint pass for all four affected packages; lint reports zero issues. Molint retains two existing `recover` diagnostics in untouched FULLTEXT2 storage functions; the same diagnostics were independently reproduced on clean target `0276f82fb7`. No new delta finding is hidden.
- Normal comparison of the three canonical fulltext SQL/result pairs passes **235/235 twice on the same owned instance**, with zero failed, ignored or abnormal cases. Database and snapshot teardown checks pass after each iteration.
- An independent JDBC control asserts stored BOOL versus computed BOOL types, precisions and true/false/NULL values, plus VARCHAR(20) metadata/values. Statement, client-prepared and actual server-prepared execution pass; the server-prepared class is explicitly checked to exclude fallback.

Design, metadata addendum and final overall review use `gpt-6.1-sol / xhigh`. Design sessions: `01a160f2-20f7-7072-9274-93df5a897de9` and `01a160fa-b994-7211-976d-8af38b838e87`. Final review: session `01a160fd-f414-74c0-82be-acd213747d5a`, reviewed `5856b5a679`: **PASS, zero unresolved material blockers**.

This remains bounded single-CN CPU validation. No new GPU, multi-CN or production-capacity claim is made. Fresh hosted CI results remain pending after publication.

Approved by: @XuPeng-SH, @aptend, @fengttt

This branch was previously deployed

1 inactive deployment
ci — ea466ca1 Deployed Oct 16, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/test-ci size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CI prepared view reader returns stale result after cross-CN replacement

3 participants