diff --git a/CHANGELOG.md b/CHANGELOG.md index fea0632aaf..dc026ad682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - [#7305](https://github.com/influxdata/influxdb/pull/7305): UDP Client: Split large points. Thanks @vlasad - [#7115](https://github.com/influxdata/influxdb/issues/7115): Feature request: `influx inspect -export` should dump WAL files. - [#7388](https://github.com/influxdata/influxdb/pull/7388): Implement cumulative_sum() function. +- [#7441](https://github.com/influxdata/influxdb/pull/7441): Speed up shutdown by closing shards concurrently. ### Bugfixes diff --git a/tsdb/store.go b/tsdb/store.go index 2550f73d5d..7cca6a2147 100644 --- a/tsdb/store.go +++ b/tsdb/store.go @@ -229,11 +229,13 @@ func (s *Store) Close() error { } s.wg.Wait() - for _, sh := range s.shards { - if err := sh.Close(); err != nil { - return err - } + // Close all the shards in parallel. + if err := s.walkShards(s.shardsSlice(), func(sh *Shard) error { + return sh.Close() + }); err != nil { + return err } + s.opened = false s.shards = nil s.databaseIndexes = nil