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: only call Desc() if needed in queues #7888

Merged
merged 1 commit into from
Jul 19, 2016

Conversation

BramGruneir
Copy link
Member

@BramGruneir BramGruneir commented Jul 18, 2016

It requires getting a lock, so we should avoid calling it unnecessarily.


This change is Reviewable

It requires getting a lock, so we should avoid calling it unnecessarily.
@BramGruneir
Copy link
Member Author

It might not be a bad idea to spend some time looking for all calls that require a lock and see if any other calls around it acquire the same look right after, or if they're actually required. Desc() I'll bet is going to be one of the biggest culprits.

@rjnn
Copy link
Contributor

rjnn commented Jul 18, 2016

Take a look at the refactor of String() in #7871 - we haven't refactored Desc(), but perhaps we should do so now that we have atomic non-locking reads of the RangeDescriptor, rather than spending some time and refactoring all calls to Desc().


Comments from Reviewable

@BramGruneir
Copy link
Member Author

As discussed, I like that idea.

But as far this change is concerned, there's an early exit condition that seems to make sense to move it up.


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


Comments from Reviewable

@petermattis
Copy link
Collaborator

:lgtm:


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


Comments from Reviewable

rjnn pushed a commit to rjnn/cockroach that referenced this pull request Jul 18, 2016
In cockroachdb#7871, replica.String() was refactored to use a new atomically
readable copy of the RangeDescriptor. replica.Desc() could use this as
well (so as to not lock replica.mu), but this change was
conservatively deferred. However, with the issue of replica.Desc()
acquiring locks being raised in cockroachdb#7888, and after discussion with
@bdarnell, it should be safe to refactor replica.Desc() as well.

Finally replica.mu.rangeDesc is moved outside mu to replica.rangeDesc
to maintain the semantics of replica.mu
rjnn pushed a commit to rjnn/cockroach that referenced this pull request Jul 19, 2016
In cockroachdb#7871, replica.String() was refactored to use a new atomically
readable copy of the RangeDescriptor. replica.Desc() could use this as
well (so as to not lock replica.mu), but this change was
conservatively deferred. However, with the issue of replica.Desc()
acquiring locks being raised in cockroachdb#7888, and after discussion with
@bdarnell, it should be safe to refactor replica.Desc() as well.

Finally replica.mu.rangeDesc is moved outside mu to replica.rangeDesc
to maintain the semantics of replica.mu
@BramGruneir BramGruneir merged commit b4104bc into cockroachdb:master Jul 19, 2016
@BramGruneir BramGruneir deleted the queue branch July 19, 2016 15:32
rjnn pushed a commit to rjnn/cockroach that referenced this pull request Jul 19, 2016
In cockroachdb#7871, replica.String() was refactored to use a new atomically
readable copy of the RangeDescriptor. replica.Desc() could use this as
well (so as to not lock replica.mu), but this change was
conservatively deferred. However, with the issue of replica.Desc()
acquiring locks being raised in cockroachdb#7888, and after discussion with
@bdarnell, it should be safe to refactor replica.Desc() as well.

Finally replica.mu.rangeDesc is moved outside mu to replica.rangeDesc
to maintain the semantics of replica.mu
rjnn pushed a commit that referenced this pull request Jul 20, 2016
storage: prepend replica descriptors in panics
all logs and errors with it. Prepend panics as well.
storage: move rangeDesc out of replica.mu, use in Desc()
readable copy of the RangeDescriptor. replica.Desc() could use this as
well (so as to not lock replica.mu), but this change was
conservatively deferred. However, with the issue of replica.Desc()
acquiring locks being raised in #7888, and after discussion with
@bdarnell, it should be safe to refactor replica.Desc() as well.
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