Repository navigation
Description
Summary
The ISCP watermark-only flush writes a new JobStatus containing only LSN. Because JobStage_Init is the zero value, an already initialized asynchronous IVF index (Stage=Running) is persisted as Stage=Init. The next ISCP iteration reruns InitSQL (ivf_create) for the same index generation.
Evidence
Observed in PR #28173 CI job, BVT test/distributed/cases/pessimistic_transaction/vector/vector_ivf_async.sql:
- 23:17:51:
ivf1_asyncinitializes successfully (clusterCnt=5,vectorCnt=6) and status is persisted asLSN=1, Stage=1. - 23:18:01: entries are synchronized and status advances to
LSN=2, Stage=1. - 23:18:11: watermark-only flush persists
LSN=3, Stage=0. - 23:18:21: the scheduler reads
Stage=0and executesivf_createagain for the same table/version. - 23:18:23: both vector searches fail with
internal error: number of centroids in db != Nlist(LISTS=5).
The failure is in production ISCP/IVF behavior, not in PR #28173; that PR only changes CDC, lockservice, and engine tests.
Root cause
pkg/iscp/consumer_entry.go:tryFlushWatermark constructs &JobStatus{LSN: currentLSN + 1} without copying the current durable stage. The catalog update therefore resets Stage=Running to its zero value Stage=Init. ExecuteIteration treats Stage=Init as permission to execute ConsumerInfo.InitSQL again.
This latent bug became much easier to trigger after #27821 changed index watermark flushing to a 5-second interval.
Expected behavior
A watermark-only flush may advance LSN/watermark, but must preserve the job stage and must never cause InitSQL to run again for the same job generation. IVF centroid metadata and entries must remain consistent with LISTS.
Reproduction
- Start the multi-CN Docker Compose BVT environment.
- Run
test/distributed/cases/pessimistic_transaction/vector/vector_ivf_async.sql. - Create an async IVF index with
LISTS=5, wait for the initial index build, then wait for the entries-count readiness assertion. - Run the two nearest-neighbor queries in the case after the index watermark flush interval elapses.
- Observe
number of centroids in db != Nlist; inspectmo_catalog.mo_iscp_logand seeStagetransition1 -> 0, followed by a secondivf_create.
Impact
Recently created or rebuilt asynchronous IVF indexes can become temporarily unavailable and return an internal error on vector search. Base-table data is not lost, but index serving is broken until the index is rebuilt or the task is cleaned up.
Acceptance criteria
- Preserve the current
JobStatus.Stagein watermark-only updates. - Enforce monotonic stage progression per job generation during catalog replay/update.
- Add deterministic regression coverage for init -> watermark flush -> next iteration, including restart/replay and multi-CN execution.
- Verify IVF centroid count, entries, and vector-search correctness after the flush; no duplicate
InitSQLexecution. - Keep the existing index freshness/performance benefit of the short watermark interval.
Activity
fix(iscp): preserve initialization lifecycle atomically (#28176)
fix(iscp): preserve initialization lifecycle atomically (matrixorigin…
fix(iscp): preserve initialization lifecycle atomically (matrixorigin…
fix(iscp): preserve initialization lifecycle atomically (matrixorigin…