From 079f5aeb6ce42d2794c3b34f0d81aa9bc129659e Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Mon, 1 Jun 2020 14:16:29 +0530 Subject: [PATCH] DefaultOptions: Set KeepL0InMemory to false (#1345) This commit sets the default value of KeepL0InMemory to false. There have been multiple reports of slow value log replays which is a side effect of keeping level 0 tables in memory. --- options.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/options.go b/options.go index fedb7cd98..fff7c65ab 100644 --- a/options.go +++ b/options.go @@ -133,7 +133,7 @@ func DefaultOptions(path string) Options { SyncWrites: true, NumVersionsToKeep: 1, CompactL0OnClose: true, - KeepL0InMemory: true, + KeepL0InMemory: false, VerifyValueChecksum: false, Compression: options.None, MaxCacheSize: 0, @@ -464,6 +464,7 @@ func (opt Options) WithNumCompactors(val int) Options { // CompactL0OnClose determines whether Level 0 should be compacted before closing the DB. // This ensures that both reads and writes are efficient when the DB is opened later. // CompactL0OnClose is set to true if KeepL0InMemory is set to true. +// // The default value of CompactL0OnClose is true. func (opt Options) WithCompactL0OnClose(val bool) Options { opt.CompactL0OnClose = val @@ -511,7 +512,7 @@ func (opt Options) WithEncryptionKeyRotationDuration(d time.Duration) Options { // will take longer to complete since memtables and all level 0 tables will have to be recreated. // This option also sets CompactL0OnClose option to true. // -// The default value of KeepL0InMemory is true. +// The default value of KeepL0InMemory is false. func (opt Options) WithKeepL0InMemory(val bool) Options { opt.KeepL0InMemory = val return opt