14538: Reduce max writeahead to 1.
authorTom Clegg <tclegg@veritasgenetics.com>
Thu, 29 Nov 2018 20:12:25 +0000 (15:12 -0500)
committerTom Clegg <tclegg@veritasgenetics.com>
Thu, 29 Nov 2018 20:12:25 +0000 (15:12 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

sdk/go/arvados/fs_collection.go
sdk/go/arvados/fs_collection_test.go

index bc4e4acfa05a222689dfda0ed8b4bdedc21026ad..6a9a00aa780de24ee1ef655c1473e513faf4f251 100644 (file)
@@ -19,9 +19,11 @@ import (
        "time"
 )
 
-var maxBlockSize = 1 << 26
-
-var concurrentWriters = 4
+var (
+       maxBlockSize      = 1 << 26
+       concurrentWriters = 4 // max goroutines writing to Keep during sync()
+       writeAheadBlocks  = 1 // max background jobs flushing to Keep before blocking writes
+)
 
 // A CollectionFileSystem is a FileSystem that can be serialized as a
 // manifest and stored as a collection.
@@ -498,7 +500,7 @@ func (fn *filenode) pruneMemSegments() {
        // TODO: pack/flush small blocks too, when fragmented
        if fn.throttle == nil {
                // TODO: share a throttle with filesystem
-               fn.throttle = newThrottle(concurrentWriters)
+               fn.throttle = newThrottle(writeAheadBlocks)
        }
        for idx, seg := range fn.segments {
                seg, ok := seg.(*memSegment)
index 73f7efda3d901cc62901673947a03f5a3013bc6e..8567a830c513bfa6447268d36d11a2768d68c4be 100644 (file)
@@ -1057,7 +1057,7 @@ func (s *CollectionFSSuite) TestFlushFullBlocks(c *check.C) {
                return
        }
 
-       c.Check(len(currentMemExtents()) <= concurrentWriters+1, check.Equals, true)
+       c.Check(len(currentMemExtents()) <= writeAheadBlocks+1, check.Equals, true)
        f.(*filehandle).inode.(*filenode).waitPrune()
        c.Check(currentMemExtents(), check.HasLen, 1)