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: don't down-replicate the range holding range lease #7918

Merged
merged 2 commits into from
Jul 20, 2016

Conversation

BramGruneir
Copy link
Member

@BramGruneir BramGruneir commented Jul 19, 2016

This is the preventative measure for stopping a down-replication of the range
lease holder's replica. RemoveTarget will pick the worst replica from the list
that does not contain the lease holder's replica.
Part of #5737


This change is Reviewable

@petermattis
Copy link
Collaborator

Review status: 0 of 3 files reviewed at latest revision, 3 unresolved discussions, all commit checks successful.


storage/replicate_queue.go, line 165 [r1] (raw file):

      lease, _ := repl.getLease()
      if lease == nil {
          return errors.Errorf("range %d: could not get current lease", repl.RangeID)

We should be using "%s: ", repl everywhere. See #7871. Do you mind fixing up the errors and log messages in this file?


storage/replicate_queue.go, line 167 [r1] (raw file):

          return errors.Errorf("range %d: could not get current lease", repl.RangeID)
      }
      if lease.OwnedBy(removeReplica.StoreID) {

Rather than checking afterwards, an alternative approach would be to strip the lease holder from the list of replicas passed to RemoveTarget.


storage/replicate_queue.go, line 168 [r1] (raw file):

      }
      if lease.OwnedBy(removeReplica.StoreID) {
          return errors.Errorf("range %d: can't remove the replica with the current range lease", repl.RangeID)

s/replica with the current/replica holding the/g


Comments from Reviewable

@BramGruneir
Copy link
Member Author

Review status: 0 of 6 files reviewed at latest revision, 3 unresolved discussions, some commit checks pending.


storage/replicate_queue.go, line 165 [r1] (raw file):

Previously, petermattis (Peter Mattis) wrote…

We should be using "%s: ", repl everywhere. See #7871. Do you mind fixing up the errors and log messages in this file?

Done.

storage/replicate_queue.go, line 167 [r1] (raw file):

Previously, petermattis (Peter Mattis) wrote…

Rather than checking afterwards, an alternative approach would be to strip the lease holder from the list of replicas passed to RemoveTarget.

That's a lot cleaner. Done.

storage/replicate_queue.go, line 168 [r1] (raw file):

Previously, petermattis (Peter Mattis) wrote…

s/replica with the current/replica holding the/g

removed the error message

Comments from Reviewable

@petermattis
Copy link
Collaborator

:lgtm:


Review status: 0 of 6 files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@bdarnell
Copy link
Contributor

:lgtm:


Reviewed 2 of 3 files at r1, 4 of 4 files at r2.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@BramGruneir BramGruneir force-pushed the rebalance branch 2 times, most recently from 918d7f5 to fb98911 Compare July 19, 2016 20:17
This won't matter once cockroachdb#7904 is in, but there's no need to use Desc() if we're
already locked.
This is the preventative measure for stopping a down-replication of the range
lease holder's replica.  RemoveTarget will pick the worst replica from the list
that does not contain the lease holder's replica.

Part of cockroachdb#5737
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