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

storage: work around can't-swap-leaseholder #40363

Merged
merged 3 commits into from
Sep 3, 2019

Commits on Sep 3, 2019

  1. storage: remove errant log message

    There may be nothing to roll back, so don't log unconditionally.
    
    Release note: None
    tbg committed Sep 3, 2019
    Configuration menu
    Copy the full SHA
    9c6eca7 View commit details
    Browse the repository at this point in the history
  2. storage: make an error benign

    This was showing up a lot in TestInitialPartitioning. If we're trying to
    remove something but nothing needs to be removed, that seems OK (though
    there is some question of why we're hitting this regularly).
    
    Release note: None
    tbg committed Sep 3, 2019
    Configuration menu
    Copy the full SHA
    0e3f046 View commit details
    Browse the repository at this point in the history
  3. storage: work around can't-swap-leaseholder

    As of cockroachdb#40284, the replicate queue was issuing swaps (atomic add+remove)
    during rebalancing.
    TestInitialPartitioning helpfully points out (once you flip atomic
    rebalancing on) that when the replication factor is one, there is
    no way to perform such an atomic swap because it will necessarily
    have to remove the leaseholder.
    
    To work around this restriction (which, by the way, we dislike - see
    \cockroachdb#40333), fall back to just adding a replica in this case without also
    removing one. In the next scanner cycle (which should happen immediately
    since we requeue the range) the range will be over-replicated and
    hopefully the lease will be transferred over and then the original
    leaseholder removed. I would be very doubtful that this all works,
    but it is how things worked until cockroachdb#40284, so this PR really just
    falls back to the previous behavior in cases where we can't do
    better.
    
    Release note: None
    tbg committed Sep 3, 2019
    Configuration menu
    Copy the full SHA
    3686af8 View commit details
    Browse the repository at this point in the history