-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
raftstore: remove uuid #1953
raftstore: remove uuid #1953
Conversation
Do we need to update the kvproto? |
PTAL @hhkbp2 @javaforfun |
src/raftstore/store/peer.rs
Outdated
// It's ok to overflow. If there are two entries share same id, then | ||
// there should be u64::MAX entries kept in memory in which case TiKV | ||
// should oom already. At lease true for amd64 architect. | ||
self.pending_reads.id_allocator = id.overflowing_add(1).0; |
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 abstract alloc method for id allocator, and use it instead of overflowing_add.
impl ReadIndexRequest { | ||
fn binary_id(&self) -> &[u8] { | ||
unsafe { | ||
let id = &self.id as *const u64 as *const u8; |
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 not use transmute here?
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.
Because I need a slice rather than an array.
LGTM |
PTAL @hhkbp2 |
need use pingcap/kvproto#171 here? |
It doesn't have to be included. It will be both source and binary compatible. |
LGTM |
UUID is used for two reason in our project:
The first goal can be achieved via index + term. The second implementation is not complete and redundant request can still happen when leadership is changed or instance gets restarted. A complete correct implementation is not necessary and probably reduce performance.
Hence UUID is not necessary in our project, and sometimes it occupies a lot of CPU of scheduler thread and raftstore thread in our benches and tests. So let's remove it.