fix: ignore empty index error deleting last measurement#25037
Merged
davidby-influx merged 2 commits intomaster-1.xfrom Jun 4, 2024
Merged
fix: ignore empty index error deleting last measurement#25037davidby-influx merged 2 commits intomaster-1.xfrom
davidby-influx merged 2 commits intomaster-1.xfrom
Conversation
An empty index is appropriate when deleting the last measurement. Also clean up error handling, avoid duplicate calls to Close. closes #9929
gwossum
reviewed
Jun 3, 2024
Member
gwossum
left a comment
There was a problem hiding this comment.
Question about cleaning up if errors occur.
Comment on lines
+160
to
+163
| } else if err = os.RemoveAll(path); err != nil { | ||
| return fmt.Errorf("cannot remove %s: %w", path, err) | ||
| } else if err = os.RemoveAll(outputPath); err != nil { | ||
| return fmt.Errorf("cannot remove temporary file %s: %w", outputPath, err) |
Member
There was a problem hiding this comment.
If we can't remove path, then we won't try to remove outputPath? Should we be trying to delete outputPath even if we fail to remove path?
gwossum
reviewed
Jun 4, 2024
Comment on lines
+161
to
+169
| // Empty TSM file of size == 0, remove it | ||
| if err = os.RemoveAll(path); err != nil { | ||
| err = fmt.Errorf("cannot remove %s: %w", path, err) | ||
| } | ||
| if err2 := os.RemoveAll(outputPath); err2 != nil && err == nil { | ||
| return fmt.Errorf("cannot remove temporary file %s: %w", outputPath, err) | ||
| } else { | ||
| return err | ||
| } |
Member
There was a problem hiding this comment.
I probably would have preferred collecting the errors in a list and then calling errors.Join, but this is just as viable, especially for influx_inspect.
Contributor
Author
There was a problem hiding this comment.
Yeah, that would have been better.
davidby-influx
added a commit
that referenced
this pull request
Jun 4, 2024
davidby-influx
added a commit
that referenced
this pull request
Jun 4, 2024
chengshiwen
pushed a commit
to chengshiwen/influxdb
that referenced
this pull request
Aug 27, 2024
…5037) An empty index is appropriate when deleting the last measurement. Also clean up error handling, avoid duplicate calls to Close. closes influxdata#9929
chengshiwen
pushed a commit
to chengshiwen/influxdb
that referenced
this pull request
Aug 28, 2024
…5037) An empty index is appropriate when deleting the last measurement. Also clean up error handling, avoid duplicate calls to Close. closes influxdata#9929
2 tasks
davidby-influx
added a commit
that referenced
this pull request
Jan 6, 2026
davidby-influx
added a commit
that referenced
this pull request
Jan 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
An empty index is appropriate when deleting the last measurement. Also clean up error handling, avoid
duplicate calls to Close.
closes #9929