From a32e6125e0b3b72ba1a9e2efe80e81dc194eceec Mon Sep 17 00:00:00 2001 From: Andrey Kostov Date: Sun, 21 Dec 2014 18:37:49 +0200 Subject: [PATCH] Zero fill bug fix --- storagedriver/s3/s3.go | 16 ---------------- storagedriver/testsuites/testsuites.go | 5 +++++ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/storagedriver/s3/s3.go b/storagedriver/s3/s3.go index 1754938a1..f8f647385 100644 --- a/storagedriver/s3/s3.go +++ b/storagedriver/s3/s3.go @@ -355,14 +355,6 @@ func (d *Driver) WriteStream(path string, offset int64, reader io.Reader) (total return totalRead, err } - part, err = multi.PutPart(int(partNumber), bytes.NewReader(buf)) - if err != nil { - return totalRead, err - } - - parts = append(parts, part) - partNumber++ - if totalRead+offset < chunkSize { return totalRead, nil } @@ -393,14 +385,6 @@ func (d *Driver) WriteStream(path string, offset int64, reader io.Reader) (total return totalRead, err } - part, err = multi.PutPart(int(partNumber), bytes.NewReader(buf)) - if err != nil { - return totalRead, err - } - - parts = append(parts, part) - partNumber++ - if totalRead+(offset%chunkSize) < chunkSize { return totalRead, nil } diff --git a/storagedriver/testsuites/testsuites.go b/storagedriver/testsuites/testsuites.go index 26862a234..617c77941 100644 --- a/storagedriver/testsuites/testsuites.go +++ b/storagedriver/testsuites/testsuites.go @@ -774,6 +774,7 @@ func (suite *DriverSuite) TestEventualConsistency(c *check.C) { defer suite.StorageDriver.Delete(firstPart(filename)) var offset int64 + var misswrites int var chunkSize int64 = 32 for i := 0; i < 1024; i++ { @@ -795,8 +796,12 @@ func (suite *DriverSuite) TestEventualConsistency(c *check.C) { reader.Close() offset += read + } else { + misswrites++ } } + + c.Assert(misswrites, check.Not(check.Equals), 1024) } // BenchmarkPutGetEmptyFiles benchmarks PutContent/GetContent for 0B files