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. DetailsReviewer 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. DetailsIn 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. |
| metrics *metrics | ||
| member string |
There was a problem hiding this comment.
please reorder these two fields
|
|
||
| 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.
The docs of the PD recovery process may need to be updated.
There was a problem hiding this comment.
Curiously, is there anything broken so we have to update PD recovery process?
There was a problem hiding this comment.
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.
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.
Why we need to have this type instead of using prometheus.Guage directly?
There was a problem hiding this comment.
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>
|
ptal @sunxiaoguang |
|
/merge |
|
@nolouch: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests DetailsInstructions 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. DetailsCommit 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 #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_idand 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