mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
feat: Compacting "data-index" to avoid calling the merge operator
This commit is contained in:
parent
0680f8f4cd
commit
51cc69342f
@ -84,6 +84,9 @@ impl Index {
|
|||||||
|
|
||||||
let database = rocksdb::DB::open_cf(opts, &path, vec![("default", cf_opts)])?;
|
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)? {
|
let _schema = match database.get(DATA_SCHEMA)? {
|
||||||
Some(value) => Schema::read_from(&*value)?,
|
Some(value) => Schema::read_from(&*value)?,
|
||||||
None => return Err(String::from("Database does not contain a schema").into()),
|
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();
|
let cf_handle = self.database.cf_handle("default").unwrap();
|
||||||
self.database.ingest_external_file_optimized(&cf_handle, &options, &[&path])?;
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user