Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#9174
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
asddongmen authored and ti-chi-bot committed Jun 12, 2023
1 parent 8c3a94b commit e9f579b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cdc/owner/changefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@ func (c *changefeed) cleanupMetrics() {

changefeedBarrierTsGauge.DeleteLabelValues(c.id.Namespace, c.id.ID)
c.metricsChangefeedBarrierTsGauge = nil

if c.isRemoved {
changefeedStatusGauge.DeleteLabelValues(c.id.Namespace, c.id.ID)
}
}

// cleanup redo logs if changefeed is removed and redo log is enabled
Expand Down
9 changes: 8 additions & 1 deletion cdc/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,15 @@ func (p *processor) Close() error {
zap.String("namespace", p.changefeedID.Namespace),
zap.String("changefeed", p.changefeedID.ID))

<<<<<<< HEAD
p.sinkManager.stop(p.changefeedID)
=======
// clean up metrics first to avoid some metrics are not cleaned up
// when error occurs during closing the processor
p.cleanupMetrics()

p.sinkManager.stop()
>>>>>>> a6939c3156 (changefeed (ticdc): remove status of a changefeed after it is removed (#9174))
p.sinkManager.r = nil
p.sourceManager.stop(p.changefeedID)
p.sourceManager.r = nil
Expand Down Expand Up @@ -949,7 +957,6 @@ func (p *processor) Close() error {
// mark tables share the same cdcContext with its original table, don't need to cancel
failpoint.Inject("processorStopDelay", nil)

p.cleanupMetrics()
log.Info("processor closed",
zap.String("namespace", p.changefeedID.Namespace),
zap.String("changefeed", p.changefeedID.ID))
Expand Down

0 comments on commit e9f579b

Please sign in to comment.