-
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
Execute DeleteRetentionPolicy
and DeleteMeasurement
in parallel
#6847
Conversation
By analyzing the blame information on this pull request, we identified @e-dard and @joelegasse to be potential reviewers |
/cc @jwilder There's one caveat for something I saw in |
84caca7
to
8939d18
Compare
return err | ||
return func() error { | ||
// Delete the shard from disk. | ||
return s.DeleteShard(shardID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to avoid a data race, but I'm not sure how useful this is other than just ensuring the database doesn't get locked up while a retention policy is being removed from shards. This takes a lock on the tsdb.Store
instance so there's no way that this can be run in parallel.
8939d18
to
4422102
Compare
s.mu.Lock() | ||
defer s.mu.Unlock() | ||
m, err := func() (*Measurement, error) { | ||
s.mu.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a read-lock because the indexes have their own mutexs. It should be released after 492 too. Taking a write lock here will lock writes and queries for all databases until this completes which is not necessary.
Makes the code from `DeleteDatabase` that performed the parallel delete more general and reuses it for deleting a retention policy and a measurement.
4422102
to
6da3162
Compare
Fixed via #7015 |
Makes the code from
DeleteDatabase
that performed the parallel deletemore general and reuses it for deleting a retention policy and a
measurement.