-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Conversation
It requires getting a lock, so we should avoid calling it unnecessarily.
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. |
Take a look at the refactor of Comments from Reviewable |
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 |
Review status: 0 of 1 files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from Reviewable |
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
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
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
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.
It requires getting a lock, so we should avoid calling it unnecessarily.
This change is