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

maintainer: mainter manager use parallel DS #706

Merged
merged 2 commits into from
Dec 20, 2024
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
1 change: 0 additions & 1 deletion .github/workflows/uint_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,4 @@ jobs:
- name: Unit Test
run: |
go test --tags=intest -timeout 120s github.com/pingcap/ticdc/coordinator/...
go test --tags=intest -timeout 120s github.com/pingcap/ticdc/pkg/eventservice...

2 changes: 1 addition & 1 deletion maintainer/maintainer_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func NewMaintainerManager(selfNode *node.Info,
tsoClient: pdClient,
regionCache: regionCache,
}
m.stream = dynstream.NewDynamicStream(NewStreamHandler())
m.stream = dynstream.NewParallelDynamicStream(func(path common.GID) uint64 { return path.FastHash() }, NewStreamHandler())
m.stream.Start()

mc.RegisterHandler(messaging.MaintainerManagerTopic, m.recvMessages)
Expand Down
4 changes: 3 additions & 1 deletion utils/dynstream/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,17 @@ func (f *Feedback[A, P, D]) String() string {
return fmt.Sprintf("DynamicStream Feedback{Area: %v, Path: %v, Pause: %v}", f.Area, f.Path, f.Pause)
}

// NewDynamicStream creates a new dynamic stream with a single stream by default.
func NewDynamicStream[A Area, P Path, T Event, D Dest, H Handler[A, P, T, D]](handler H, option ...Option) DynamicStream[A, P, T, D, H] {
opt := NewOption()
opt.StreamCount = 1
if len(option) > 0 {
opt = option[0]
}
opt.StreamCount = 1
return newParallelDynamicStream(func(path P) uint64 { return 0 }, handler, opt)
}

// NewParallelDynamicStream creates a new dynamic stream with CPU number streams by default.
func NewParallelDynamicStream[A Area, P Path, T Event, D Dest, H Handler[A, P, T, D]](hasher PathHasher[P], handler H, option ...Option) DynamicStream[A, P, T, D, H] {
opt := NewOption()
if len(option) > 0 {
Expand Down
Loading