Skip to content
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

Merged
merged 5 commits into from Nov 9, 2016
Merged

Conversation

disksing
Copy link
Contributor

@disksing disksing commented Nov 4, 2016

Resolve locks by batches to avoid generating a too huge write raft command.

@zhangjinpeng87
Copy link
Member

LGTM

}
}
}
let pr = ProcessResult::NextCommand {
Copy link
Contributor

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.

@disksing disksing changed the title [WIP] scheduler: resolve lock by batches. scheduler: resolve lock by batches. Nov 7, 2016
@disksing
Copy link
Contributor Author

disksing commented Nov 7, 2016

PTAL @zhangjinpeng1987 @siddontang

locks.push((key.clone(), lock));
if let Some(limit) = limit {
if locks.len() >= limit {
return Ok((locks, Some(key.append_ts(0))));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why append_ts(0)

Copy link
Contributor Author

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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about rollback?

Copy link
Contributor Author

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)),
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@siddontang
Copy link
Contributor

Please add a description for your PR.

@disksing
Copy link
Contributor Author

disksing commented Nov 9, 2016

PTAL @siddontang @zhangjinpeng1987

@zhangjinpeng87
Copy link
Member

LGTM

1 similar comment
@siddontang
Copy link
Contributor

LGTM

@disksing disksing merged commit a9c542b into master Nov 9, 2016
@disksing disksing deleted the disksing/batch-resolve-lock branch November 9, 2016 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants