-
Notifications
You must be signed in to change notification settings - Fork 198
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
pump client: support change select pump's strategy #221
Conversation
@@ -241,14 +242,19 @@ func (c *PumpsClient) getPumpStatus(pctx context.Context) (revision int64, err e | |||
|
|||
// WriteBinlog writes binlog to a situable pump. Tips: will never return error for commit/rollback binlog. | |||
func (c *PumpsClient) WriteBinlog(binlog *pb.Binlog) error { | |||
c.RLock() | |||
pumpNum := len(c.Pumps.AvaliablePumps) | |||
selector := c.Selector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why putting it into a lock scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok,I think you can put lock in selector, and provide an update function. it's better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when change strategy will create a new selector. And selector is a member of pump client. so I think lock pump client seems better
Rest LGTM |
@july2993 Please take a careful look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
- you should try avoid global var tsMap, selectorLock which is shard by multi client.
- currently support
range
andhash
, but i think no different for usage, maybe just confuse people, test more abouthash
if expose this to user.
|
i know it it doesn't matter now, you should encapsulate such thinks in your |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In addition to the poor packaging, LGTM |
OK, I will refactor these code later. @GregoryIan |
… strategy config (#223) * pump client: compatible with kafka version tidb-binlog && add unit test (#139) * pump client: write commit binlog will never return error (#148) * pkg watcher: move watcher from tidb-enterprise-tools (#146) * pump client: increase retry time, and refine some code (#158) * pump client: add initial log function (#165) * pump client: support change select pump's strategy (#221)
What problem does this PR solve?
support change select pump's strategy
proposal: pingcap/tidb#9201
What is changed and how it works?
create a new selector when change strategy
Check List
Tests
Code changes