-
Notifications
You must be signed in to change notification settings - Fork 188
worker: use random value as server-id if server-id is not set #329
Conversation
Codecov Report
@@ Coverage Diff @@
## master #329 +/- ##
================================================
- Coverage 59.9403% 59.9221% -0.0183%
================================================
Files 135 135
Lines 15090 15158 +68
================================================
+ Hits 9045 9083 +38
- Misses 5166 5182 +16
- Partials 879 893 +14 |
/run-all-tests |
/run-all-tests |
/run-all-tests |
1 similar comment
/run-all-tests |
Co-Authored-By: Xuecheng Zhang <[email protected]>
@csuzhangxc all addressed, PTAL again |
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
dm/worker/config.go
Outdated
c.Flavor, err = utils.GetFlavor(ctx, fromDB.DB) | ||
if ctx.Err() != nil { | ||
err = terror.Annotatef(err, "time cost to get flavor info exceeds %s", flavorGetTimeout) | ||
rand.Seed(time.Now().UnixNano()) |
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.
can we do this when starting the process?
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.
address comment b1a8fbd
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.
dm/worker/config.go
Outdated
rand.Seed(time.Now().UnixNano()) | ||
for i := 0; i < 5; i++ { | ||
randomValue := uint32(rand.Intn(100000)) | ||
randomServerID := maxServerID/10 + randomValue |
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.
It sames that the only use of maxServerID
is maxServerID/10
. How about set maxServerID
directly to math.MaxUint32/10
?
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.
update 354a2fc
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.
What about storing math.MaxUint32/10
into a variable so that we don't need to compute it every time?
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.
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.
done 9b89300
@csuzhangxc @lichunzhu PTAL again |
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
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
/run-all-tests |
cherry pick to release-1.0 failed |
@WangXiangUSTC Please cherry-pick to release-1.0 manually. |
What problem does this PR solve?
use random value as server-id if server-id is not set
What is changed and how it works?
if server id is not set, generate a random value for it
Check List
Tests
Related changes