Skip to content

[Bug]: ISCP watermark flush resets initialized index stage and reruns IVF init #28175

Closed

Description

@XuPeng-SH

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_async initializes successfully (clusterCnt=5, vectorCnt=6) and status is persisted as LSN=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=0 and executes ivf_create again 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

  1. Start the multi-CN Docker Compose BVT environment.
  2. Run test/distributed/cases/pessimistic_transaction/vector/vector_ivf_async.sql.
  3. Create an async IVF index with LISTS=5, wait for the initial index build, then wait for the entries-count readiness assertion.
  4. Run the two nearest-neighbor queries in the case after the index watermark flush interval elapses.
  5. Observe number of centroids in db != Nlist; inspect mo_catalog.mo_iscp_log and see Stage transition 1 -> 0, followed by a second ivf_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.Stage in 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 InitSQL execution.
  • Keep the existing index freshness/performance benefit of the short watermark interval.

Activity

  1. added
    kind/bug
    on Sep 4, 2026
  2. added a commit that references this issue on Sep 5, 2026
    845fff8
  3. added 3 commits that reference this issue on Sep 17, 2026
    6f1453f
    248678e
    c909e58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions