Skip to content

Commit

Permalink
compaction allow threads
Browse files Browse the repository at this point in the history
  • Loading branch information
Congyuwang committed Mar 1, 2024
1 parent bf13ac7 commit 6feda48
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/rdict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,8 @@ impl Rdict {
py: Python,
) -> PyResult<()> {
let db = self.get_db()?;
let opt = compact_opt.borrow(py);
let opt_ref = opt.deref();
let from = if begin.is_none() {
None
} else {
Expand All @@ -1045,13 +1047,13 @@ impl Rdict {
} else {
Some(encode_key(end, self.opt_py.raw_mode)?)
};
let opt = compact_opt.borrow(py);
let opt_ref = opt.deref();
if let Some(cf) = &self.column_family {
db.compact_range_cf_opt(cf, from, to, &opt_ref.0)
} else {
db.compact_range_opt(from, to, &opt_ref.0)
};
py.allow_threads(|| {
if let Some(cf) = &self.column_family {
db.compact_range_cf_opt(cf, from, to, &opt_ref.0)
} else {
db.compact_range_opt(from, to, &opt_ref.0)
};
});
Ok(())
}

Expand Down

0 comments on commit 6feda48

Please sign in to comment.