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

Leader lease revocation #933

Closed
spolitov opened this issue Mar 5, 2019 · 0 comments
Closed

Leader lease revocation #933

spolitov opened this issue Mar 5, 2019 · 0 comments
Assignees
Labels
kind/enhancement This is an enhancement of an existing feature

Comments

@spolitov
Copy link
Contributor

spolitov commented Mar 5, 2019

To serve reads leader need to have active leases, but also leases of old leader should expire.
We take lease for 2 seconds, so after leader change we could not serve reads for this time.
In case when leader change was caused by leader step down, new leader could contact old leader and ask him to revoke his lease.
So new leader could start serving requests as soon as old leader approves lease revocation.

@spolitov spolitov added the kind/enhancement This is an enhancement of an existing feature label Mar 5, 2019
@spolitov spolitov self-assigned this Mar 5, 2019
@robertpang robertpang changed the title Leader lease revokation Leader lease revocation Mar 6, 2019
yugabyte-ci pushed a commit that referenced this issue Mar 13, 2019
Summary:
To serve up-to-date read requests, the leader need to have active leases (a regular lease and a
hybrid-time lease), but also any leases held by any old leader of that tablet should have already
expired. The latter condition is also a requirement for processing write requests. We use a
two-second lease interval by default, so after a leader change we might not be able to serve reads
and accept writes for this amount of time.

This revision introduces the following changes:

- In case when a leader change was caused by a leader step-down, the new leader will contact the old
  leader and ask it to revoke its lease. The new leader could start serving requests as soon as the
  old leader approves the lease revocation.

- The old leader will automatically revoke its leases when it receives a consensus update from the
  new leader.

- The new leader will understand that the old leader does not have a lease anymore as soon as the
  old leader replies to a consensus update.

Test Plan:
ybd --cxx-test snapshot-txn-test --gtest_filter SnapshotTxnTest.BankAccountsWithTimeJump

Time jumps produces a lot of leader changes. So leader lease revocation allows us to write about three times more values than w/o revocation.

Reviewers: timur, mikhail

Reviewed By: mikhail

Subscribers: bogdan, ybase, bharat

Differential Revision: https://phabricator.dev.yugabyte.com/D6278
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement This is an enhancement of an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant