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
scheduler: resolve lock by batches. #1271
Conversation
LGTM |
} | ||
} | ||
} | ||
let pr = ProcessResult::NextCommand { |
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.
Will the next rolled back seek the locks from the beginning? If yes, we may skip many tombstone keys.
locks.push((key.clone(), lock)); | ||
if let Some(limit) = limit { | ||
if locks.len() >= limit { | ||
return Ok((locks, Some(key.append_ts(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.
why append_ts(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.
To make next batch skip current key.
b"k1", | ||
5); | ||
} | ||
store.resolve_lock_ok(5, Some(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.
How about rollback?
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.
Rollback is covered by other tests, this is just for testing the batch process works right.
where F: Fn(&Lock) -> bool | ||
{ | ||
try!(self.create_lock_cursor()); | ||
let mut cursor = self.lock_cursor.as_mut().unwrap(); | ||
cursor.seek_to_first(); | ||
let ok = match start { | ||
Some(ref x) => try!(cursor.seek(x)), |
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.
do we have test to cover start
key?
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.
https://github.com/pingcap/tikv/pull/1271/files#diff-a581b51c6f8b34d75b3ce3e7c8037894R494
This test uses different count of locks to test ResolveLock, different values of start
should be covered.
Please add a description for your PR. |
LGTM |
1 similar comment
LGTM |
Resolve locks by batches to avoid generating a too huge write raft command.