Skip to content

Commit

Permalink
sourcemanager(ticdc): close all pullers asyncrhonsly to prevent block…
Browse files Browse the repository at this point in the history
… too long (#11673)

close #11638
  • Loading branch information
3AceShowHand authored Nov 4, 2024
1 parent 805f0e9 commit 5177eb7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cdc/processor/sourcemanager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package sourcemanager

import (
"context"
"sync"
"time"

"github.com/pingcap/log"
Expand Down Expand Up @@ -220,10 +221,17 @@ func (m *SourceManager) Close() {
zap.String("namespace", m.changefeedID.Namespace),
zap.String("changefeed", m.changefeedID.ID))
start := time.Now()

var wg sync.WaitGroup
m.pullers.Range(func(span tablepb.Span, value interface{}) bool {
value.(pullerwrapper.Wrapper).Close()
wg.Add(1)
go func() {
defer wg.Done()
value.(pullerwrapper.Wrapper).Close()
}()
return true
})
wg.Wait()
log.Info("All pullers have been closed",
zap.String("namespace", m.changefeedID.Namespace),
zap.String("changefeed", m.changefeedID.ID),
Expand Down

0 comments on commit 5177eb7

Please sign in to comment.