Skip to content

Commit

Permalink
kv: fix comment on AdminTransferLease
Browse files Browse the repository at this point in the history
Remove mention of LeaseStatus and rewrap.
  • Loading branch information
nvanbenschoten committed Feb 5, 2021
1 parent 222cded commit 98072ec
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions pkg/kv/kvserver/replica_range_lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,23 +750,21 @@ func (r *Replica) requestLeaseLocked(
ctx, repDesc, status, r.mu.state.Desc.StartKey.AsRawKey(), false /* transfer */)
}

// AdminTransferLease transfers the LeaderLease to another replica. A
// valid LeaseStatus must be supplied. Only the current holder of the
// LeaderLease can do a transfer, because it needs to stop serving
// reads and proposing Raft commands (CPut is a read) after sending
// the transfer command. If it did not stop serving reads immediately,
// it would potentially serve reads with timestamps greater than the
// start timestamp of the new (transferred) lease. More subtly, the
// replica can't even serve reads or propose commands with timestamps
// lower than the start of the new lease because it could lead to read
// your own write violations (see comments on the stasis period in
// IsLeaseValid). We could, in principle, serve reads more than the
// maximum clock offset in the past.
// AdminTransferLease transfers the LeaderLease to another replica. Only the
// current holder of the LeaderLease can do a transfer, because it needs to stop
// serving reads and proposing Raft commands (CPut is a read) after sending the
// transfer command. If it did not stop serving reads immediately, it would
// potentially serve reads with timestamps greater than the start timestamp of
// the new (transferred) lease. More subtly, the replica can't even serve reads
// or propose commands with timestamps lower than the start of the new lease
// because it could lead to read your own write violations (see comments on the
// stasis period in IsLeaseValid). We could, in principle, serve reads more than
// the maximum clock offset in the past.
//
// The method waits for any in-progress lease extension to be done, and it also
// blocks until the transfer is done. If a transfer is already in progress,
// this method joins in waiting for it to complete if it's transferring to the
// same replica. Otherwise, a NotLeaseHolderError is returned.
// blocks until the transfer is done. If a transfer is already in progress, this
// method joins in waiting for it to complete if it's transferring to the same
// replica. Otherwise, a NotLeaseHolderError is returned.
func (r *Replica) AdminTransferLease(ctx context.Context, target roachpb.StoreID) error {
// initTransferHelper inits a transfer if no extension is in progress.
// It returns a channel for waiting for the result of a pending
Expand Down

0 comments on commit 98072ec

Please sign in to comment.