feat: Compacting "data-index" to avoid calling the merge operator

This commit is contained in:
Clément Renault 2018-12-02 13:06:07 +01:00
parent 0680f8f4cd
commit 51cc69342f
No known key found for this signature in database
GPG Key ID: 0151CDAB43460DAE

View File

@ -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(())
}