Repository navigation
fix(fulltext2): keep warm search cache across ordinary CDC flushes - #29227
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 High deep review of exact head 3552afb: APPROVE. Ordinary CDC flushes intentionally retain the immutable warm cache snapshot; normal stale/TTL housekeeping eventually replaces it. The regression verifies retention through commit, TTL-driven refresh, updated results, and exactly-once cleanup; public BVT confirms eventual visibility. Temporary stale reads are part of this eventual-refresh contract. No concrete P1/P2 blockers found.
Merge Queue Status
This pull request spent 36 minutes 30 seconds in the queue, with no time running CI. Waiting for any of
All conditions
ReasonHintYou 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. Tick the box to put this pull request back in the merge queue (same as
|
…; reconcile CDC narrative Addresses the GPT-6 re-review P2s, reconciled with the main merge (matrixorigin#29227 removed the CDC-flush RemoveIdle, so the periodic sweep is now the SOLE freshness mechanism). - Startup-race (TestSetStaleCheckIntervalDuringServeIsNotLost): force both orderings deterministically (override-before-serve and override-after-serve) instead of only hoping a concurrent loop hits the window; every case (incl. the concurrent stress) reads effectiveTickerNs and Destroys BEFORE asserting, so a failed require never leaks a serve goroutine (unconditional cleanup). - Automatic sweep dispatch (new TestPeriodicSweepTickerEvictsStaleEntry): drive a real serve() ticker at a ms cadence and assert it evicts a stale entry with NO manual checkStale/HouseKeeping call, and leaves a current entry resident -- proving ticker DISPATCH, not just that checkStale works when called. Replaces the RemoveIdle-based TestNonConsumerCNStaleEntryClearedOnlyBySweep, whose consumer-vs-non-consumer distinction is moot now that matrixorigin#29227 removed the CDC-flush RemoveIdle. (True separate- process CN placement remains out of the single-process test's reach.) - fulltext2_copy_alter.sql: update the header narrative -- with matrixorigin#29227 there is no per-CN RemoveIdle shortcut, so the GetVectorIndexCacheInfo=0 poll is driven entirely by the periodic sweep on every CN. Full pkg/vectorindex/cache passes under -race; the pessimistic fulltext2 BVT suite (incl. copy_alter) passes 100%. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…l DML is visible (#30401) (#30606) A `FULLTEXT2` index indexed its initial (pre-create) rows correctly, but an `INSERT`/`UPDATE`/`DELETE` issued **after** `CREATE FULLTEXT2 INDEX` stayed invisible to `MATCH ... AGAINST` for ~10 minutes. ### Root cause The deltas are **not** lost. The ISCP consumer materializes them into `cdc_tail` frames correctly (confirmed: the frames are on disk, and a process restart — fresh cache — shows every incremental row). The defect is that the **warm in-memory fulltext2 search cache never refreshes** to include new `cdc_tail` frames in a live session, so `MATCH` keeps serving the create-time snapshot until the ~10-minute async stale sweep (`VectorIndexCacheTTL/2 × 4`) finally evicts the entry. DROP+recreate "fixes" it only because it builds a fresh cache object. #29227 removed the post-flush idle-evict from `RunFulltext2` (and the `EvictIdleCache` helper), leaving the stale sweep as the only refresh path. ### Fix Restore the idle-evict: after a CDC tail flush that wrote frames, drop the cache entry **if idle** so the next query reloads the appended tail. - `RemoveIdle` evicts only when no search is in flight, so it never thrashes concurrent readers — a busy entry stays warm and refreshes later via the sweep. This was #29227's stated concern, and idle-only addresses it. - The reloaded object is a fresh **read-only** generation, so the read-only-cache contract is unchanged. - The evict is local to the CN that hosts the CDC consumer, giving read-your-writes on the single-CN standalone case (the reported setup); a different querying CN still converges via the sweep (unchanged cross-CN eventual behavior). ### Validation - Unit tests (deterministic, cover the change): `TestEvictIdleCache` (idle→evict+destroy, absent→no-op) and `TestRunFulltext2RefreshesIdleCacheAfterNonEmptyCDCFlush` (a committed non-empty CDC flush evicts the idle warm entry; the next reader reloads the committed row; a mid-flush reader is never yanked). Full `pkg/fulltext2` and `pkg/iscp` packages pass. - End-to-end on a single-node standalone instance at **default** freshness (no ctl override): a post-create `INSERT` is searchable in ~3s and an `UPDATE`'s new/removed terms in ~10s, versus ~10 minutes before. No BVT timing assertion is added for the evict path: at default freshness the idle-evict is single-shot per flush, so a polling `MATCH` would create busy windows that can make the single `RemoveIdle` miss (flaky). The existing `fulltext2_async` `warm_refresh` case already covers the sweep refresh path robustly (via a 1s freshness override) and still passes with this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Approved by: @XuPeng-SH
What type of PR is this?
Which issue(s) this PR fixes:
Related to #28005. This is the ordinary-CDC read-only cache-contract repair; the issue remains open for deployment QA.
What this PR does / why we need it:
Do not evict a warm FULLTEXT2 search object after an ordinary CDC tail flush. The flush makes the new tail durable, but the already-loaded search object stays read-only; subsequent visibility follows the existing generation, stale-sweep, and TTL lifecycle. This avoids making every CDC update trigger a synchronous cache replacement that can block concurrent searches. Remove the now-unused FULLTEXT2-specific eviction helper. COPY ALTER initialization, empty-generation non-retention, generic cache operations, and DDL cleanup are unchanged. No Base-file reuse prototype is included.
The consumer regression drives a non-empty encoded INSERT through
RunFulltext2and the real vector-cache wrapper. A concurrent warm read completes across the commit barrier. After commit, the same object remains loaded and still shows its pre-commit snapshot. Advancing only that entry across its ordinary TTL boundary and calling real housekeeping destroys the old object once; the replacement loads once, sees the committed row, and final cleanup destroys it once. A permanently retained generation fails this oracle.The public SQL BVT holds a warm MATCH after the CDC tail becomes durable, then polls the same query without explicit invalidation. It observes the added row only after the normal asynchronous stale sweep/replacement. This validates eventual visibility, not immediate CDC visibility.
Validation
Exact source head:
3552afbefacda7d205b12740362b7f7018e3e4de; PR base at validation:a1d23f030cb57d5cfccc2799a2a48a33784fba59. The added commit changes only the consumer regression andfulltext2_asyncBVT SQL/expected result; production code is unchanged from the prior PR head.pkg/iscp,pkg/fulltext2, andpkg/vectorindex/cachecomplete package tests: PASS. Complete race runs for those packages: PASS. The focused consumer test also passed race-count=20. Owning-packagego vet, gofmt, andgit diff --check: PASS. Tests used the repositorymo-cgo-testwrapper and matching native dependencies.mo-servicefrom the exact source snapshot with Go 1.26.4 and GCC 11 in a private directory; binary SHA2564ff19931cb8468bd649ea5a91a5a49a576b8c6c6c76d33b741d9251bb8d43bf. The source files changed by this commit were SHA256-matched between the local worktree and the Linux build directory. The task'slibmo.soresolved from its own directory.test/distributed/cases/pessimistic_transaction/fulltext2/fulltext2_async.sql: PASS, 223/223 statements, 0 failed, 0 abnormal, exit 0, usingmatrixorigin/mo-tester309a0ca650e0c55e90292767fd61e4976818d66d(./run.sh -n -g -p ...). The 900-second poll crossed the warm CDC transition: the service marked the index stale at 16:00:02 and the test advanced after the refreshed query returned IDs1, 101before its deadline. Full test duration: 918 seconds. The isolated service shut down cleanly with no task ports or processes left running.@wait_expectand failed existing asynchronous waits immediately. Its 77% diagnostic run is not counted as product or BVT evidence; the passing result above uses the current tester from a fresh private runtime.The package test proves cache identity, Load/Destroy counts, commit/read ordering, and deterministic TTL replacement. The public SQL BVT proves ordinary stale-sweep eventual visibility. Neither implies immediate visibility or completes deployment QA for COPY ALTER, rollback, and concurrent production workloads. The separately skipped
fulltext2_copy_alterBVT remains under #28985 and is not claimed as passing.QA required: yes. The new head's GitHub CI and reviewer decision are separate gates; passing local/Linux validation does not imply either has cleared. No automatic issue closure or merge is intended.