-
Notifications
You must be signed in to change notification settings - Fork 720
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
id: make id allocator general purpose #5284
Conversation
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov Report
@@ Coverage Diff @@
## master #5284 +/- ##
==========================================
+ Coverage 75.70% 75.84% +0.13%
==========================================
Files 311 312 +1
Lines 30826 30978 +152
==========================================
+ Hits 23338 23496 +158
- Misses 5485 5487 +2
+ Partials 2003 1995 -8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Can you describe more details of your use case? |
This is mostly for the Keyspace management in PD. |
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
LGTM |
@ystaticy: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
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.
The rest LGTM.
server/id/id.go
Outdated
metrics *metrics | ||
member string |
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.
please reorder these two fields
@@ -119,13 +135,13 @@ func (alloc *allocatorImpl) rebaseLocked() error { | |||
return errs.ErrEtcdTxnConflict.FastGenByArgs() | |||
} | |||
|
|||
log.Info("idAllocator allocates a new id", zap.Uint64("alloc-id", end)) | |||
idallocGauge.Set(float64(end)) | |||
log.Info("idAllocator allocates a new id", zap.String("label", alloc.label), zap.Uint64("alloc-id", end)) |
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.
The docs of the PD recovery process may need to be updated.
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.
Curiously, is there anything broken so we have to update PD recovery 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.
Curiously, is there anything broken so we have to update PD recovery process?
It's this block related to finding the maximum allocated ID
https://github.com/pingcap/docs/blob/master/pd-recover.md#get-allocated-id-from-pd-log
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.
Once we recover PD, do we also need to recover all id allocators?
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
} | ||
|
||
// metrics is a collection of idAllocator's metrics | ||
type metrics struct { |
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 we need to have this type instead of using prometheus.Guage directly?
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 was to improve the readability and make it easier to add more metrics, as suggested #5284 (comment)
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
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
ptal @sunxiaoguang |
/merge |
@nolouch: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 9e82cfb
|
close tikv#5294 make id allocator general purpose Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
close tikv#5294 make id allocator general purpose Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
close #5898 The old version of idalloc is a globally unique path, and keyspace needs to use id allocator to allocate keyspaceID, so in this pr the id allocator is changed to a general purpose, but not sync metrics. #5284 Signed-off-by: husharp <jinhao.hu@pingcap.com> Co-authored-by: JmPotato <ghzpotato@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
…6016) close #5898, ref #5899 The old version of idalloc is a globally unique path, and keyspace needs to use id allocator to allocate keyspaceID, so in this pr the id allocator is changed to a general purpose, but not sync metrics. #5284 Signed-off-by: husharp <jinhao.hu@pingcap.com> Co-authored-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: David 8039876+AmoebaProtozoa@users.noreply.github.com
What problem does this PR solve?
The current implementation of id allocator permits only one id allocator due to fixed alloc path
$rootPath/alloc_id
and metrics label.This PR attempts to make it more general purpose by parametrize its alloc path and metrics label.
Issue Number: Close #5294
What is changed and how does it work?
Check List
Tests
Release note