Skip to content

transfer raft leadership to range leadership#5973

Merged
bdarnell merged 1 commit intocockroachdb:masterfrom
es-chow:transfer-raft-leadership
Apr 12, 2016
Merged

transfer raft leadership to range leadership#5973
bdarnell merged 1 commit intocockroachdb:masterfrom
es-chow:transfer-raft-leadership

Conversation

@es-chow
Copy link
Copy Markdown
Contributor

@es-chow es-chow commented Apr 11, 2016

transfer raft leadership to range leadership if these two are not located on the same store, based on raft transfer-leadership etcd-io/etcd#4916. Use the up-to-date etcd commit which fix the spell error.


This change is Reviewable

const numStores = 3
mtc := startMultiTestContext(t, numStores)
defer mtc.Stop()
// Setup replication of ramge 1 on store 0 to stores 1 and 2.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/ramge/range/

// Force the read command request a new lease.
clock := mtc.clocks[0]
header := roachpb.Header{}
header.Timestamp = clock.Update(clock.Now().Add(int64(storage.DefaultLeaderLeaseDuration), 0))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use mtc.expireLeaderLeases() instead of adding the lease duration manually. Or is there some reason this is acting on clocks[0] instead of either mtc.manualClock or the clock corresponding to the store you target in the next line?

@bdarnell
Copy link
Copy Markdown
Contributor

LGTM

@es-chow es-chow force-pushed the transfer-raft-leadership branch from 1f22bbf to ab90a69 Compare April 12, 2016 09:32
@es-chow
Copy link
Copy Markdown
Contributor Author

es-chow commented Apr 12, 2016

updated as per comments. And removed raftStatusLocked. PTAL.

@bdarnell
Copy link
Copy Markdown
Contributor

LGTM

@bdarnell bdarnell merged commit b6cb613 into cockroachdb:master Apr 12, 2016
@es-chow es-chow deleted the transfer-raft-leadership branch April 13, 2016 01:20
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.

4 participants