TSM: TSMReader.Close blocks until reads complete #9792
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #9786
TSMReader.Close
returns an error when queries are referencing the TSM file, butFileStore.Close
ignores the error.In this change,
FileStore.Close
checks the error, andTSMReader.Close
blocks, rather than returning the error. This makes it clear to the caller ofFileStore.Close
(drop shard X
for example) that the file is safely closed, rather than requiring the caller to retry up to thousands of times when the query load is constantly high.After this change, TSM files are always closed when
drop shard X
returns, and writing to a shard that is currently being deleted returns a partial error.