From 610f5fc9291ffda8ec983666bca5b027e5bde308 Mon Sep 17 00:00:00 2001 From: Yash Kothari Date: Fri, 19 Jun 2020 12:02:36 +0530 Subject: [PATCH] Force KeepL0InMemory to be true when InMemory is true (#1375) InMemory mode would create L0 sst tables when KeepL0InMemory was false as mentioned in #1374 This commit will keep L0 in memory if either KeepL0InMemory is set or InMemory is set. On running ` go test .` Before: sst files were visible for a second Now: sst files won't created/visible Fixes #1374 --- db.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db.go b/db.go index fd3e85ace..2234843f2 100644 --- a/db.go +++ b/db.go @@ -218,6 +218,8 @@ func Open(opt Options) (db *DB, err error) { if opt.Compression == options.ZSTD && !y.CgoEnabled { return nil, y.ErrZstdCgo } + // Keep L0 in memory if either KeepL0InMemory is set or if InMemory is set. + opt.KeepL0InMemory = opt.KeepL0InMemory || opt.InMemory // Compact L0 on close if either it is set or if KeepL0InMemory is set. When // keepL0InMemory is set we need to compact L0 on close otherwise we might lose data.