From bc72e34d559bfdc12319a3b1b141f1b735cdd69e Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:49:01 +0700 Subject: [PATCH] fix(storev2/snapshots): Close `StateChanges` channel in `doRestoreSnapshot` (#21106) --- store/v2/snapshots/manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/v2/snapshots/manager.go b/store/v2/snapshots/manager.go index 9380b3021b4d..7e12e4503de8 100644 --- a/store/v2/snapshots/manager.go +++ b/store/v2/snapshots/manager.go @@ -400,7 +400,6 @@ func (m *Manager) doRestoreSnapshot(snapshot types.Snapshot, chChunks <-chan io. // chStorage is the channel to pass the KV pairs to the storage snapshotter. chStorage := make(chan *corestore.StateChanges, defaultStorageChannelBufferSize) - defer close(chStorage) storageErrs := make(chan error, 1) go func() { @@ -415,6 +414,7 @@ func (m *Manager) doRestoreSnapshot(snapshot types.Snapshot, chChunks <-chan io. if err != nil { return errorsmod.Wrap(err, "multistore restore") } + close(chStorage) for { if nextItem.Item == nil {