X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c5eed3ffad31ff92f8399d32c57a710681c79caa..8626abb0a44cfc303bef3552a7bc57163c79231a:/services/keepstore/volume_unix.go diff --git a/services/keepstore/volume_unix.go b/services/keepstore/volume_unix.go index f4b49710e9..6c0f5c4e97 100644 --- a/services/keepstore/volume_unix.go +++ b/services/keepstore/volume_unix.go @@ -122,6 +122,13 @@ func (v *UnixVolume) Compare(loc string, expect []byte) error { bufLen := 1 << 20 if int64(bufLen) > stat.Size() { bufLen = int(stat.Size()) + if bufLen < 1 { + // len(buf)==0 would prevent us from handling + // empty files the same way as non-empty + // files, because reading 0 bytes at a time + // never reaches EOF. + bufLen = 1 + } } cmp := expect buf := make([]byte, bufLen) @@ -318,7 +325,7 @@ func (v *UnixVolume) Delete(loc string) error { } defer unlockfile(f) - // If the block has been PUT in the last blob_signature_ttl + // If the block has been PUT in the last blobSignatureTTL // seconds, return success without removing the block. This // protects data from garbage collection until it is no longer // possible for clients to retrieve the unreferenced blocks @@ -326,7 +333,7 @@ func (v *UnixVolume) Delete(loc string) error { if fi, err := os.Stat(p); err != nil { return err } else { - if time.Since(fi.ModTime()) < blob_signature_ttl { + if time.Since(fi.ModTime()) < blobSignatureTTL { return nil } }