Skip to content

Commit

Permalink
blobs,changefeedccl: append ".tmp" to temp files + deflake TestChange…
Browse files Browse the repository at this point in the history
…feedNemeses

Prior to this test the blob storage would merely append random numbers
at the end of the file name to generate temp file names.  This was
confusing TestChangefeedNemeses which checks the validity of the
various files in the target directory.

This patch fixes it by using a `.tmp` suffix for temp files. These are
already properly ignored by the walk performed by
TestChangefeedNemeses.

Release note: None
  • Loading branch information
knz committed Dec 5, 2019
1 parent e1c1a9a commit edc2386
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/blobs/local_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ func (l *LocalStorage) WriteFile(filename string, content io.Reader) (err error)
// - it avoids a cross-filesystem rename in the common case.
// (There can still be cross-filesystem renames in very
// exotic edge cases, hence the use fileutil.Move below.)
tmpFile, err := ioutil.TempFile(targetDir, filepath.Base(fullPath))
// See the explanatory comment for ioutil.TempFile to understand
// what the "*" in the suffix means.
tmpFile, err := ioutil.TempFile(targetDir, filepath.Base(fullPath)+"*.tmp")
if err != nil {
return errors.Wrap(err, "creating temporary file")
}
Expand Down

0 comments on commit edc2386

Please sign in to comment.