Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changefeed (ticdc): remove status of a changefeed after it is removed #9174

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cdc/owner/changefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,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.sinkManager.r = nil
p.sourceManager.stop()
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