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: do not use non-authoritative Desc() #8283

Merged
merged 1 commit into from
Aug 3, 2016

Conversation

tbg
Copy link
Member

@tbg tbg commented Aug 3, 2016

After ec00732, we were using a denormalized
copy of the descriptor which is not protected by the same mutex in places
where we shouldn't, resulting in subtle races. Change it back to use the
authoritative one almost everywhere, except for informational callsites
(such as stringifying a Replica).

Fixes #8086.
Fixes #8157.


This change is Reviewable

After ec00732, we were using a denormalized
copy of the descriptor which is not protected by the same mutex in places
where we shouldn't, resulting in subtle races. Change it back to use the
authoritative one almost everywhere, except for informational callsites
(such as stringifying a `Replica`).

Fixes cockroachdb#8086.
Fixes cockroachdb#8157.
@tbg tbg assigned rjnn Aug 3, 2016
@tamird
Copy link
Contributor

tamird commented Aug 3, 2016

:lgtm:


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


Comments from Reviewable

@tbg tbg merged commit f542487 into cockroachdb:master Aug 3, 2016
@tbg tbg deleted the double-desc branch August 3, 2016 11:38
@petermattis
Copy link
Collaborator

Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


storage/replica.go, line 718 [r1] (raw file):

// does not acquire a lock and is to be used whenever a descriptor is needed
// for informational purposes.
func (r *Replica) InformalDesc() *roachpb.RangeDescriptor {

Informal is an unusual term to use here. It doesn't adequately convey when this should be used. NonAuthoritative would be more accurate, but a mouthful. How about UnsafeDesc?


storage/store_test.go, line 1065 [r1] (raw file):

  if r := store.LookupReplica(roachpb.RKey("0"), nil); r != r0 {
      t.Errorf("mismatched range %+v != %+v", r.InformalDesc(), r0.InformalDesc())

I'm curious why these couldn't remain as .Desc().


Comments from Reviewable

@tamird
Copy link
Contributor

tamird commented Aug 3, 2016

Unsafe implies something different. Inconsistent?

@petermattis
Copy link
Collaborator

Inconsistent is good.

@tbg
Copy link
Member Author

tbg commented Aug 4, 2016

Can one of you take this setting that I'm out?

On Wed, Aug 3, 2016, 09:55 Peter Mattis [email protected] wrote:

Inconsistent is good.


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#8283 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AE135GMMSkjlgfdmAqO-nQdSa_BB7Bf-ks5qcMS9gaJpZM4JbhCB
.

-- Tobias

@tamird
Copy link
Contributor

tamird commented Aug 4, 2016

I got it.

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