Skip to content

Commit

Permalink
changefeed (ticdc): remove status of a changefeed after it is removed (
Browse files Browse the repository at this point in the history
…#9174)

close #9173, ref #9177
  • Loading branch information
asddongmen authored Jun 12, 2023
1 parent dbe5cc1 commit a6939c3
Show file tree
Hide file tree
Showing 2 changed files with 8 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 @@ -759,6 +759,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
5 changes: 4 additions & 1 deletion cdc/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,10 @@ func (p *processor) Close() error {
zap.String("namespace", p.changefeedID.Namespace),
zap.String("changefeed", p.changefeedID.ID))

// clean up metrics first to avoid some metrics are not cleaned up
// when error occurs during closing the processor
p.cleanupMetrics()

p.sinkManager.stop()
p.sinkManager.r = nil
p.sourceManager.stop()
Expand Down Expand Up @@ -941,7 +945,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 a6939c3

Please sign in to comment.