-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add safer locking to CreateFieldIfNotExists #6462
Add safer locking to CreateFieldIfNotExists #6462
Conversation
By analyzing the blame information on this pull request, we identified @jwilder, @benbjohnson and @pauldix to be potential reviewers |
6cccab3
to
bf33e0d
Compare
So far, this has stopped the issues I was seeing for #6096 |
@oldmantaiter That would make sense. It looks like the @jwilder We're already doing an |
The defer was removed to avoid an allocation. This code is actually called very frequently now. I'd prefer to explicitly unlock in the place where we missed it. |
bf33e0d
to
ad3d201
Compare
@jwilder Updated - on that note, let me rebase with a new subject line for the commit (so it makes more sense) |
ad3d201
to
ba1ab03
Compare
@jwilder The first lock seems like it would get called a lot: https://github.com/influxdata/influxdb/pull/6462/files#diff-5794b17db5ab55866ed4ee776df9a0eaR561 The second one would only get called on new fields. It doesn't seem like that would happen very often. |
@benbjohnson That's a good point. When I was looking at this code, it was in the context of speeding up shard loading when the DB starts up and new fields were getting created frequently. I'd still prefer the explicit unlock, but |
@jwilder I spent a full day trying to track this issue down (and was still unsuccessful). If we don't have a specific performance need for not using |
@benbjohnson OK w/ me. |
There's a bit of discussion on |
@oldmantaiter I didn't realize you had already updated the PR to remove the If you could switch the unlock back to using |
@jwilder Sure, I'll bring back the defer. |
ba1ab03
to
c531657
Compare
A deadlock can occur if the field was created while we were waiting for the lock.
c531657
to
df0e16a
Compare
Thanks @oldmantaiter! 👍 |
Required for all non-trivial PRs
A deadlock can occur if the field was created while we were waiting for the lock.