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

sinkV2(ticdc): sink manager close the sink factory at the last #8219

Merged
merged 3 commits into from
Feb 10, 2023
Merged
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
7 changes: 5 additions & 2 deletions cdc/processor/sinkmanager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,6 @@ func (m *SinkManager) Close() error {
}
m.sinkMemQuota.Close()
m.redoMemQuota.Close()
m.sinkFactory.Close()
m.tableSinks.Range(func(_ tablepb.Span, value interface{}) bool {
sink := value.(*tableSinkWrapper)
sink.close(m.ctx)
Expand All @@ -887,11 +886,15 @@ func (m *SinkManager) Close() error {
}
return true
})
m.wg.Wait()
log.Info("All table sinks closed",
zap.String("namespace", m.changefeedID.Namespace),
zap.String("changefeed", m.changefeedID.ID),
zap.Duration("cost", time.Since(start)))
m.wg.Wait()
// todo: Add a unit test to cover this,
// Make sure all sink workers exited before closing the sink factory.
// Otherwise, it would panic in the sink when you try to write some data to a closed sink.
m.sinkFactory.Close()
3AceShowHand marked this conversation as resolved.
Show resolved Hide resolved
log.Info("Closed sink manager",
zap.String("namespace", m.changefeedID.Namespace),
zap.String("changefeed", m.changefeedID.ID),
Expand Down