mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
feat: Make the RocksDB read-only after loading the SST file
This commit is contained in:
parent
c32f014108
commit
b91c4f89d5
@ -8,7 +8,7 @@ use std::str::from_utf8_unchecked;
|
|||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use elapsed::measure_time;
|
use elapsed::measure_time;
|
||||||
use fst::Streamer;
|
use fst::Streamer;
|
||||||
use rocksdb::{DB, IngestExternalFileOptions};
|
use rocksdb::{DB, DBOptions, IngestExternalFileOptions};
|
||||||
use raptor::{Metadata, RankedStream, LevBuilder};
|
use raptor::{Metadata, RankedStream, LevBuilder};
|
||||||
|
|
||||||
fn search(metadata: &Metadata, database: &DB, lev_builder: &LevBuilder, query: &str) {
|
fn search(metadata: &Metadata, database: &DB, lev_builder: &LevBuilder, query: &str) {
|
||||||
@ -50,9 +50,10 @@ fn main() {
|
|||||||
let (elapsed, db) = measure_time(|| {
|
let (elapsed, db) = measure_time(|| {
|
||||||
let db = DB::open_default(rocksdb).unwrap();
|
let db = DB::open_default(rocksdb).unwrap();
|
||||||
db.ingest_external_file(&IngestExternalFileOptions::new(), &[&sst_file]).unwrap();
|
db.ingest_external_file(&IngestExternalFileOptions::new(), &[&sst_file]).unwrap();
|
||||||
db
|
drop(db);
|
||||||
|
DB::open_for_read_only(DBOptions::default(), rocksdb, false).unwrap()
|
||||||
});
|
});
|
||||||
println!("{} to load the RocksDB database", elapsed);
|
println!("{} to load the SST file in RocksDB and reopen it for read-only", elapsed);
|
||||||
|
|
||||||
let (elapsed, lev_builder) = measure_time(|| LevBuilder::new());
|
let (elapsed, lev_builder) = measure_time(|| LevBuilder::new());
|
||||||
println!("{} to load the levenshtein automaton", elapsed);
|
println!("{} to load the levenshtein automaton", elapsed);
|
||||||
|
Loading…
Reference in New Issue
Block a user