From 51cc69342f66ddcc24fae966f24284c2992c4762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Sun, 2 Dec 2018 13:06:07 +0100 Subject: [PATCH] feat: Compacting "data-index" to avoid calling the merge operator --- src/index/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index/mod.rs b/src/index/mod.rs index 39372a53d..90a02e4d9 100644 --- a/src/index/mod.rs +++ b/src/index/mod.rs @@ -84,6 +84,9 @@ impl Index { let database = rocksdb::DB::open_cf(opts, &path, vec![("default", cf_opts)])?; + // compacting to avoid calling the merge operator + database.compact_range(Some(DATA_INDEX), Some(DATA_INDEX)); + let _schema = match database.get(DATA_SCHEMA)? { Some(value) => Schema::read_from(&*value)?, None => return Err(String::from("Database does not contain a schema").into()), @@ -102,6 +105,9 @@ impl Index { let cf_handle = self.database.cf_handle("default").unwrap(); self.database.ingest_external_file_optimized(&cf_handle, &options, &[&path])?; + // compacting to avoid calling the merge operator + self.database.compact_range(Some(DATA_INDEX), Some(DATA_INDEX)); + Ok(()) }