From 2516ab53ab00d22263bb239a2f535a7720a022fc Mon Sep 17 00:00:00 2001 From: Ryan Kim Date: Wed, 3 Jul 2019 14:45:58 -0400 Subject: [PATCH] Remove L0SlowdownThreshold --- cmd/pebble/db.go | 1 - db.go | 22 +--------------------- internal/base/options.go | 8 -------- internal/base/options_test.go | 1 - 4 files changed, 1 insertion(+), 31 deletions(-) diff --git a/cmd/pebble/db.go b/cmd/pebble/db.go index 6d6093282e4..75153bcea2f 100644 --- a/cmd/pebble/db.go +++ b/cmd/pebble/db.go @@ -56,7 +56,6 @@ func newPebbleDB(dir string) DB { MemTableStopWritesThreshold: 4, MinFlushRate: 4 << 20, L0CompactionThreshold: 2, - L0SlowdownWritesThreshold: 20, L0StopWritesThreshold: 32, LBaseMaxBytes: 64 << 20, // 64 MB Levels: []pebble.LevelOptions{{ diff --git a/db.go b/db.go index 06ddad361cb..2d59fdcdeee 100644 --- a/db.go +++ b/db.go @@ -8,14 +8,13 @@ package pebble // import "github.com/petermattis/pebble" import ( "errors" "fmt" - "github.com/petermattis/pebble/internal/rate" "io" "sync" "sync/atomic" - "time" "github.com/petermattis/pebble/internal/arenaskl" "github.com/petermattis/pebble/internal/base" + "github.com/petermattis/pebble/internal/rate" "github.com/petermattis/pebble/internal/record" "github.com/petermattis/pebble/vfs" ) @@ -399,9 +398,6 @@ func (d *DB) commitApply(b *Batch, mem *memTable) error { func (d *DB) commitWrite(b *Batch, wg *sync.WaitGroup) (*memTable, error) { d.mu.Lock() - // Throttle writes if there are too many L0 tables. - d.throttleWrite() - if b.flushable != nil { b.flushable.seqNum = b.seqNum() } @@ -797,22 +793,6 @@ func (d *DB) walPreallocateSize() int { return size } -func (d *DB) throttleWrite() { - if len(d.mu.versions.currentVersion().files[0]) <= d.opts.L0SlowdownWritesThreshold { - return - } - // fmt.Printf("L0 slowdown writes threshold\n") - // We are getting close to hitting a hard limit on the number of L0 - // files. Rather than delaying a single write by several seconds when we hit - // the hard limit, start delaying each individual write by 1ms to reduce - // latency variance. - // - // TODO(peter): Use more sophisticated rate limiting. - d.mu.Unlock() - time.Sleep(1 * time.Millisecond) - d.mu.Lock() -} - func (d *DB) makeRoomForWrite(b *Batch) error { force := b == nil || b.flushable != nil for { diff --git a/internal/base/options.go b/internal/base/options.go index e407abec876..cdf489f9022 100644 --- a/internal/base/options.go +++ b/internal/base/options.go @@ -247,10 +247,6 @@ type Options struct { // The number of files necessary to trigger an L0 compaction. L0CompactionThreshold int - // Soft limit on the number of L0 files. Writes are slowed down when this - // threshold is reached. - L0SlowdownWritesThreshold int - // Hard limit on the number of L0 files. Writes are stopped when this // threshold is reached. L0StopWritesThreshold int @@ -340,9 +336,6 @@ func (o *Options) EnsureDefaults() *Options { if o.L0CompactionThreshold <= 0 { o.L0CompactionThreshold = 4 } - if o.L0SlowdownWritesThreshold <= 0 { - o.L0SlowdownWritesThreshold = 8 - } if o.L0StopWritesThreshold <= 0 { o.L0StopWritesThreshold = 12 } @@ -418,7 +411,6 @@ func (o *Options) String() string { fmt.Fprintf(&buf, " comparer=%s\n", o.Comparer.Name) fmt.Fprintf(&buf, " disable_wal=%t\n", o.DisableWAL) fmt.Fprintf(&buf, " l0_compaction_threshold=%d\n", o.L0CompactionThreshold) - fmt.Fprintf(&buf, " l0_slowdown_writes_threshold=%d\n", o.L0SlowdownWritesThreshold) fmt.Fprintf(&buf, " l0_stop_writes_threshold=%d\n", o.L0StopWritesThreshold) fmt.Fprintf(&buf, " lbase_max_bytes=%d\n", o.LBaseMaxBytes) fmt.Fprintf(&buf, " max_manifest_file_size=%d\n", o.MaxManifestFileSize) diff --git a/internal/base/options_test.go b/internal/base/options_test.go index ce7efbb2b21..bab7b649315 100644 --- a/internal/base/options_test.go +++ b/internal/base/options_test.go @@ -45,7 +45,6 @@ func TestOptionsString(t *testing.T) { comparer=leveldb.BytewiseComparator disable_wal=false l0_compaction_threshold=4 - l0_slowdown_writes_threshold=8 l0_stop_writes_threshold=12 lbase_max_bytes=67108864 max_manifest_file_size=134217728