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) (#9184)

close #9173, ref #9177
  • Loading branch information
ti-chi-bot authored Jun 30, 2023
1 parent a217fc5 commit 2779568
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 @@ -805,6 +805,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 @@ -912,6 +912,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.changefeedID)
p.sinkManager.r = nil
p.sourceManager.stop(p.changefeedID)
Expand Down Expand Up @@ -949,7 +953,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 2779568

Please sign in to comment.