changeset 383:80fb047381b6

options: Set reuse_logs to true by default and only save manifest if really necessary. Change d2a96a moved a save_manifest assignment erroneously.
author Lewin Bormann <lbo@spheniscida.de>
date Sun, 08 Oct 2017 19:26:48 +0200
parents be463e80eb25
children cac919a0a15f
files src/db_impl.rs src/options.rs
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/db_impl.rs	Sun Oct 08 17:33:37 2017 +0200
+++ b/src/db_impl.rs	Sun Oct 08 19:26:48 2017 +0200
@@ -237,7 +237,6 @@
 
             batch.set_contents(&scratch);
             batch.insert_into_memtable(batch.sequence(), &mut mem);
-            save_manifest = true;
 
             let last_seq = batch.sequence() + batch.count() as u64 - 1;
             if last_seq > max_seq {
@@ -246,6 +245,7 @@
             if mem.approx_mem_usage() > self.opt.write_buffer_size {
                 compactions += 1;
                 self.write_l0_table(&mem, ve, None)?;
+                save_manifest = true;
                 mem = MemTable::new(cmp.clone());
             }
             batch.clear();
@@ -1107,6 +1107,7 @@
                      env.children(Path::new("db/")).unwrap());
             let mut opt = opt.clone();
             opt.reuse_manifest = false;
+            opt.reuse_logs = false;
             let mut db = DB::open("db", opt.clone()).unwrap();
 
             println!("children after: {:?}",
--- a/src/options.rs	Sun Oct 08 17:33:37 2017 +0200
+++ b/src/options.rs	Sun Oct 08 19:26:48 2017 +0200
@@ -73,7 +73,7 @@
             block_cache: share(Cache::new(BLOCK_CACHE_CAPACITY / BLOCK_MAX_SIZE)),
             block_size: BLOCK_MAX_SIZE,
             block_restart_interval: 16,
-            reuse_logs: false,
+            reuse_logs: true,
             reuse_manifest: true,
             compression_type: CompressionType::CompressionNone,
             filter_policy: Rc::new(Box::new(filter::BloomPolicy::new(DEFAULT_BITS_PER_KEY))),