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

release-22.2.0: kv: bypass lease transfer safety checks during joint consensus #89621

Merged

Conversation

nvanbenschoten
Copy link
Member

Backport 3/3 commits from #89340.

/cc @cockroachdb/release


This commit adds logic to bypass lease transfer safety checks (added in 034611b) when in a joint configuration and transferring the lease from a VOTER_DEMOTING to a VOTER_INCOMING. We do so because we could get stuck without a path to exit the joint configuration if we rejected this lease transfer while waiting to confirm that the target is up-to-date on its log. That confirmation may never arrive if the target is dead or partitioned away, and while we'd rather not transfer the lease to a dead node, at least we have a mechanism to recovery from that state. We also just sent the VOTER_INCOMING a snapshot (as a LEARNER, before promotion), so it is unlikely that the replica is actually dead or behind on its log.

A better alternative here would be to introduce a mechanism to choose an alternate lease transfer target after some amount of time, if the lease transfer to the VOTER_INCOMING cannot be confirmed to be safe. We may do this in the future, but given the proximity to the release and given that this matches the behavior in v22.1, we choose this approach for now.

Release note: None

Release justification: Needed to resolve release blocker.

Fixes: #88667
See also #89564

Fixes cockroachdb#88667.

This commit adds logic to bypass lease transfer safety checks (added in
034611b) when in a joint configuration and transferring the lease from a
VOTER_DEMOTING to a VOTER_INCOMING. We do so because we could get stuck
without a path to exit the joint configuration if we rejected this lease
transfer while waiting to confirm that the target is up-to-date on its
log. That confirmation may never arrive if the target is dead or
partitioned away, and while we'd rather not transfer the lease to a dead
node, at least we have a mechanism to recovery from that state. We also
just sent the VOTER_INCOMING a snapshot (as a LEARNER, before
promotion), so it is unlikely that the replica is actually dead or
behind on its log.

A better alternative here would be to introduce a mechanism to choose an
alternate lease transfer target after some amount of time, if the lease
transfer to the VOTER_INCOMING cannot be confirmed to be safe. We may do
this in the future, but given the proximity to the release and given that
this matches the behavior in v22.1, we choose this approach for now.

Release note: None

Release justification: Needed to resolve release blocker.
This commit adds a new test which ensures that the lease transfer
performed during a joint config replication change that is replacing the
existing leaseholder does not get stuck even if the existing leaseholder
cannot prove that the incoming leaseholder is caught up on its log. It
does so by killing the incoming leaseholder before it receives the lease
and ensuring that the range is able to exit the joint configuration.

Currently, the range exits by bypassing safety checks during the lease
transfer, sending the lease to the dead incoming voter, letting the
lease expire, acquiring the lease on one of the non-demoting voters, and
exiting. The details here may change in the future, but the goal of this
test will not.
@nvanbenschoten nvanbenschoten requested a review from shralex October 9, 2022 19:27
@nvanbenschoten nvanbenschoten requested a review from a team as a code owner October 9, 2022 19:27
@blathers-crl
Copy link

blathers-crl bot commented Oct 9, 2022

Thanks for opening a backport.

Please check the backport criteria before merging:

  • Patches should only be created for serious issues or test-only changes.
  • Patches should not break backwards-compatibility.
  • Patches should change as little code as possible.
  • Patches should not change on-disk formats or node communication protocols.
  • Patches should not add new functionality.
  • Patches must not add, edit, or otherwise modify cluster versions; or add version gates.
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
  • There is a high priority need for the functionality that cannot wait until the next release and is difficult to address in another way.
  • The new functionality is additive-only and only runs for clusters which have specifically “opted in” to it (e.g. by a cluster setting).
  • New code is protected by a conditional check that is trivial to verify and ensures that it only runs for opt-in clusters.
  • The PM and TL on the team that owns the changed code have signed off that the change obeys the above rules.

Add a brief release justification to the body of your PR to justify this backport.

Some other things to consider:

  • What did we do to ensure that a user that doesn’t know & care about this backport, has no idea that it happened?
  • Will this work in a cluster of mixed patch versions? Did we test that?
  • If a user upgrades a patch version, uses this feature, and then downgrades, what happens?

@cockroach-teamcity
Copy link
Member

This change is Reviewable

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.

3 participants