Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions br/pkg/lightning/backend/external/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ func mergeOverlappingFilesInternal(
if err != nil {
return nil
}
defer func() {
err2 := writer.Close(ctx)
if err2 == nil {
return
}

if err == nil {
err = err2
} else {
logutil.Logger(ctx).Warn("close writer failed", zap.Error(err2))
}
}()

// currently use same goroutine to do read and write. The main advantage is
// there's no KV copy and iter can reuse the buffer.
Expand All @@ -133,10 +145,5 @@ func mergeOverlappingFilesInternal(
return err
}
}
err = iter.Error()
if err != nil {
return err
}

return writer.Close(ctx)
return iter.Error()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can add UT?

}