Skip to content

Commit

Permalink
Merge #104187
Browse files Browse the repository at this point in the history
104187: backupccl: always track opened writer r=dt a=dt

Previously we would do things -- like wrap the opened writer with an encryption shim -- after opening the writer but before storing it in the sink. This could mean that if the sink opened a writer, but failed to save it, and was then closed it would fail to close the writer. This changes that, so that as soon as the writer is opened it is saved and then if it is later wrapped, saved again, to ensure that we cannot lose track of any successfully opened writer.

Fixes: #103597.

Release note: none.

Co-authored-by: David Taylor <[email protected]>
  • Loading branch information
craig[bot] and dt committed Jun 1, 2023
2 parents 294edf6 + 64dea46 commit 6088d66
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/ccl/backupccl/file_sst_sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ func (s *fileSSTSink) open(ctx context.Context) error {
if err != nil {
return err
}
s.out = w
if s.conf.enc != nil {
var err error
w, err = storageccl.EncryptingWriter(w, s.conf.enc.Key)
e, err := storageccl.EncryptingWriter(w, s.conf.enc.Key)
if err != nil {
return err
}
s.out = e
}
s.out = w
s.sst = storage.MakeBackupSSTWriter(ctx, s.dest.Settings(), s.out)

return nil
Expand Down

0 comments on commit 6088d66

Please sign in to comment.