From bb8c2db771a95b6938d3e19fec4a0f3224ef9749 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Fri, 8 Dec 2023 16:42:47 +0800 Subject: [PATCH] scheduler(ticdc): Updating ReplicationSet.stats only when stats is not empty (#10225) (#10228) close pingcap/tiflow#10224 --- cdc/scheduler/internal/v3/replication/replication_set.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cdc/scheduler/internal/v3/replication/replication_set.go b/cdc/scheduler/internal/v3/replication/replication_set.go index 2dc92e75db5..45e0ff09d77 100644 --- a/cdc/scheduler/internal/v3/replication/replication_set.go +++ b/cdc/scheduler/internal/v3/replication/replication_set.go @@ -1014,7 +1014,11 @@ func (r *ReplicationSet) updateCheckpointAndStats( zap.Any("checkpointTs", r.Checkpoint.CheckpointTs), zap.Any("resolvedTs", r.Checkpoint.ResolvedTs)) } - r.Stats = stats + + // we only update stats when stats is not empty, because we only collect stats every 10s. + if stats.Size() > 0 { + r.Stats = stats + } } // SetHeap is a max-heap, it implements heap.Interface.