diff --git a/cdc/owner/changefeed.go b/cdc/owner/changefeed.go index 8572cc10236..6210415435e 100755 --- a/cdc/owner/changefeed.go +++ b/cdc/owner/changefeed.go @@ -927,8 +927,6 @@ func (c *changefeed) handleBarrier(ctx context.Context, barrier *schedulepb.BarrierWithMinTs, ) error { barrierTp, barrierTs := c.barriers.Min() - c.metricsChangefeedBarrierTsGauge.Set(float64(oracle.ExtractPhysical(barrierTs))) - // It means: // 1. All data before the barrierTs was sent to downstream. // 2. No more data after barrierTs was sent to downstream. @@ -970,6 +968,8 @@ func (c *changefeed) handleBarrier(ctx context.Context, barrier.MinTableBarrierTs = barrierTs } + // MinTableBarrierTs is always the next barrier that blocking the global resolvedTs. + c.metricsChangefeedBarrierTsGauge.Set(float64(oracle.ExtractPhysical(barrier.MinTableBarrierTs))) return nil }