mirror of
https://github.com/milvus-io/milvus.git
synced 2026-07-21 10:15:43 +00:00
## Summary The documented CDC lag PromQL subtracted two independently scraped time-tick gauges, which caused idle oscillation and misleading restart behavior. This PR fixes the query and hardens the lag metric lifecycle without introducing a new metric. ### #50633 — idle oscillation Subtract each gauge timestamp before calculating the difference, canceling the cross-target scrape-phase offset: ```promql clamp_min( max by (channel_name) (milvus_wal_last_confirmed_time_tick - timestamp(milvus_wal_last_confirmed_time_tick)) - min by (channel_name) (milvus_cdc_last_replicated_time_tick - timestamp(milvus_cdc_last_replicated_time_tick)), 0) ``` ### #51048 — restart and switchover lag lifecycle - Seed `milvus_cdc_last_replicated_time_tick` from `InitializedCheckpoint` before target-client initialization, so target-unavailable startup exposes a conservative lag instead of an absent series. - Overwrite the seed with the target-confirmed checkpoint after `GetReplicateInfo` succeeds. - Ignore nil and zero checkpoints to avoid creating an epoch-valued series. - Remove lag-series deletion from generic stream `OnClose`. - Delete the lag series only from `ReplicateManager.RemoveReplicator`, the genuine etcd DELETE path. Outdated revision cleanup therefore cannot delete the live revisions shared label pair. issue: #50633 issue: #51048 ### Test Plan - [x] Added unit-test coverage for initialized-checkpoint seeding and nil/zero guards. - [x] Added regression coverage for genuine removal versus outdated revision cleanup. - [ ] Local Go tests and static check. - [ ] Confirm the lag lifecycle on a live switchover environment. --------- Signed-off-by: Yihao Dai <yihao.dai@zilliz.com> Signed-off-by: bigsheeper <yihao.dai@zilliz.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>