fix(store/v2): error info maybe covered by err = batch.Close() (#21727)

Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Marko <marko@baricevic.me>
This commit is contained in:
lfz941 2024-09-17 17:21:01 +08:00 committed by GitHub
parent 3314cfb899
commit 6aaa935019
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -113,7 +113,10 @@ func (m *MetadataStore) flushCommitInfo(version uint64, cInfo *proof.CommitInfo)
func (m *MetadataStore) flushRemovedStoreKeys(version uint64, storeKeys []string) (err error) {
batch := m.kv.NewBatch()
defer func() {
err = batch.Close()
cErr := batch.Close()
if err == nil {
err = cErr
}
}()
for _, storeKey := range storeKeys {