Zero fill bug fix

This commit is contained in:
Andrey Kostov 2014-12-21 18:37:49 +02:00
parent ea24d0f735
commit a32e6125e0
2 changed files with 5 additions and 16 deletions

View file

@ -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
}

View file

@ -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