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: Add comments about leases and liveness #36984

Merged
merged 1 commit into from
Apr 24, 2019

Conversation

bdarnell
Copy link
Contributor

I had to study this code for #35986, so I took the opportunity to
update the documentation while it's fresh in my mind.

Release note: None

@bdarnell bdarnell requested review from tbg and a team April 21, 2019 16:59
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@tbg tbg left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @bdarnell)


pkg/storage/node_liveness.go, line 132 at r1 (raw file):

it is


pkg/storage/node_liveness.go, line 145 at r1 (raw file):

// not working. Transactions were used only to piggyback on the
// transaction commit trigger). The leaseholder of the liveness range
// gossips its contents whenever they change; no other node reads from

You could mention that we don't blindly gossip everything but attempt to gossip only that which has changed.


pkg/storage/node_liveness.go, line 146 at r1 (raw file):

// transaction commit trigger). The leaseholder of the liveness range
// gossips its contents whenever they change; no other node reads from
// this range directly.

var oldLiveness storagepb.Liveness
if err := nl.db.GetProto(ctx, keys.NodeLivenessKey(nodeID), &oldLiveness); err != nil {
return false, errors.Wrap(err, "unable to get liveness")
}


pkg/storage/node_liveness.go, line 544 at r1 (raw file):

// This method is rarely called directly; heartbeats are normally sent
// by the StartHeartbeat loop.
// TODO(bdarnell): Should we just remove this synchronous heartbeat completely?

Sounds like it, though you'll probably run into trouble actually doing so.


pkg/storage/node_liveness.go, line 620 at r1 (raw file):

		// expired while in flight, so maybe we don't have to care about
		// that and only need to distinguish between same and different
		// epochs in our return value.

Anything in git blame for this check?


pkg/storage/replica_range_lease.go, line 25 at r1 (raw file):

, and any

I had to study this code for cockroachdb#35986, so I took the opportunity to
update the documentation while it's fresh in my mind.

Release note: None
Copy link
Contributor Author

@bdarnell bdarnell left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @bdarnell and @tbg)


pkg/storage/node_liveness.go, line 132 at r1 (raw file):

Previously, tbg (Tobias Grieger) wrote…

it is

Done.


pkg/storage/node_liveness.go, line 145 at r1 (raw file):

Previously, tbg (Tobias Grieger) wrote…

You could mention that we don't blindly gossip everything but attempt to gossip only that which has changed.

Done.


pkg/storage/node_liveness.go, line 146 at r1 (raw file):

Previously, tbg (Tobias Grieger) wrote…

var oldLiveness storagepb.Liveness
if err := nl.db.GetProto(ctx, keys.NodeLivenessKey(nodeID), &oldLiveness); err != nil {
return false, errors.Wrap(err, "unable to get liveness")
}

Oops. Changed to "other nodes rarely read from this range directly", and added a todo to consider making the stronger form true.


pkg/storage/node_liveness.go, line 620 at r1 (raw file):

Previously, tbg (Tobias Grieger) wrote…

Anything in git blame for this check?

It's been there since the beginning (#10305) without much discussion.


pkg/storage/replica_range_lease.go, line 25 at r1 (raw file):

Previously, tbg (Tobias Grieger) wrote…

, and any

I mean "but any". Reworded to "The current arrangement is not perfect, and some opportunities for improvement appear, but any changes must be made very carefully".

@bdarnell
Copy link
Contributor Author

bors r=tbg

@craig
Copy link
Contributor

craig bot commented Apr 24, 2019

Timed out

@bdarnell
Copy link
Contributor Author

bors r=tbg

@craig
Copy link
Contributor

craig bot commented Apr 24, 2019

Build failed (retrying...)

craig bot pushed a commit that referenced this pull request Apr 24, 2019
36984: storage: Add comments about leases and liveness r=tbg a=bdarnell

I had to study this code for #35986, so I took the opportunity to
update the documentation while it's fresh in my mind.

Release note: None

37100: roachtest: Hopefully deflake election-after-restart r=tbg a=bdarnell

Logs suggest that we're seeing failures when nodes aren't caught up on
all the split processing before the restart, so give this a chance to
finish.

Updates #35047

Release note: None

Co-authored-by: Ben Darnell <[email protected]>
@craig
Copy link
Contributor

craig bot commented Apr 24, 2019

Build succeeded

@craig craig bot merged commit 8a239fa into cockroachdb:master Apr 24, 2019
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