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

Execute DeleteRetentionPolicy and DeleteMeasurement in parallel #6847

Closed
wants to merge 1 commit into from

Conversation

jsternberg
Copy link
Contributor

Makes the code from DeleteDatabase that performed the parallel delete
more general and reuses it for deleting a retention policy and a
measurement.

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @e-dard and @joelegasse to be potential reviewers

@jsternberg
Copy link
Contributor Author

jsternberg commented Jun 15, 2016

/cc @jwilder

There's one caveat for something I saw in DeleteMeasurement. The old and new version both drop the measurement from the index before trying to drop it from the shards. If one of the shard deletes fails, the measurement is still removed from the database and it is now impossible to retry the delete.

@jsternberg jsternberg force-pushed the js-parallel-database-deletes branch 3 times, most recently from 84caca7 to 8939d18 Compare June 15, 2016 23:23
return err
return func() error {
// Delete the shard from disk.
return s.DeleteShard(shardID)
Copy link
Contributor Author

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.

@jsternberg jsternberg force-pushed the js-parallel-database-deletes branch from 8939d18 to 4422102 Compare June 15, 2016 23:37
s.mu.Lock()
defer s.mu.Unlock()
m, err := func() (*Measurement, error) {
s.mu.Lock()
Copy link
Contributor

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.
@jsternberg jsternberg force-pushed the js-parallel-database-deletes branch from 4422102 to 6da3162 Compare June 16, 2016 17:54
@jwilder
Copy link
Contributor

jwilder commented Jul 18, 2016

Fixed via #7015

@jwilder jwilder closed this Jul 18, 2016
@jsternberg jsternberg deleted the js-parallel-database-deletes branch April 20, 2018 14:16
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