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

fix: fully clean up partially opened TSI #23430

Merged
merged 3 commits into from
Jun 10, 2022
Merged

Conversation

davidby-influx
Copy link
Contributor

When one partition in a TSI fails to open,
all previously opened partitions should be cleaned up, and remaining partitions should not be opened

closes #23427

When one partition in a TSI fails to open,
all previously opened partitions should be cleaned up, and remaining partitions should not be opened

closes #23427
f, err := os.Open(path)
if err != nil {
return nil, err
}
defer f.Close()
defer errors2.Capture(&err, f.Close)()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if err := <-errC; err != nil {
return err
}
g := new(errgroup.Group)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@lesam lesam Jun 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully agree (edit: with the linked article) but it is nice to use the pattern where it fits.

tsdb/index/tsi1/partition.go Outdated Show resolved Hide resolved
@@ -277,33 +278,21 @@ func (i *Index) Open() error {
i.partitions[j] = p
}

defer i.cleanUpFail(&rErr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to defer this only after the Wait on errGroup - otherwise we could accidentally add a return and run cleanUpFail concurrently with the partition opening, which would be bad.

As I understand it, the partition type assumes Close is never called concurrently with Open.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix pushed.

@davidby-influx davidby-influx merged commit d3db48e into master-1.x Jun 10, 2022
@davidby-influx davidby-influx deleted the DSB_tsi_cleanup branch June 10, 2022 18:33
davidby-influx added a commit that referenced this pull request Jun 13, 2022
When one partition in a TSI fails to open, all previously opened
partitions should be cleaned up, and remaining partitions
should not be opened

closes #23427

(cherry picked from commit d3db48e)

closes #23431
davidby-influx added a commit that referenced this pull request Jun 13, 2022
When one partition in a TSI fails to open, all previously opened
partitions should be cleaned up, and remaining partitions
should not be opened

closes #23427

(cherry picked from commit d3db48e)

closes #23431
davidby-influx added a commit that referenced this pull request Jun 14, 2022
When one partition in a TSI fails to open, all previously opened
partitions should be cleaned up, and remaining partitions
should not be opened

closes #23427

(cherry picked from commit d3db48e)

closes #23432
davidby-influx added a commit that referenced this pull request Jun 14, 2022
When one partition in a TSI fails to open, all previously opened
partitions should be cleaned up, and remaining partitions
should not be opened

closes #23427

(cherry picked from commit d3db48e)

closes #23432
chengshiwen pushed a commit to chengshiwen/influxdb that referenced this pull request Aug 11, 2024
When one partition in a TSI fails to open, all previously opened
partitions should be cleaned up, and remaining partitions 
should not be opened

closes influxdata#23427
chengshiwen pushed a commit to chengshiwen/influxdb that referenced this pull request Aug 27, 2024
When one partition in a TSI fails to open, all previously opened
partitions should be cleaned up, and remaining partitions 
should not be opened

closes influxdata#23427
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants