mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-11 06:39:08 -07:00
store: remove rotate_memtable as could be the root cause of the issue
This commit is contained in:
@@ -597,12 +597,6 @@ impl Stores {
|
||||
.map_err(|e| e.into())
|
||||
}
|
||||
|
||||
pub fn rotate_memtables(&self) {
|
||||
self.as_slice()
|
||||
.into_iter()
|
||||
.for_each(|store| store.rotate_memtable());
|
||||
}
|
||||
|
||||
pub fn as_slice(&self) -> [&(dyn AnyStore + Send + Sync); 16] {
|
||||
[
|
||||
&self.p2aaddressindex_to_addressdata,
|
||||
|
||||
@@ -1210,8 +1210,7 @@ impl Vecs {
|
||||
let height_to_realized_cap_ref = height_to_realized_cap.as_ref();
|
||||
let dateindex_to_realized_cap_ref = dateindex_to_realized_cap.as_ref();
|
||||
|
||||
let vecs = self
|
||||
.utxo_vecs
|
||||
self.utxo_vecs
|
||||
.as_mut_vecs()
|
||||
.into_iter()
|
||||
.map(|(_, v)| v)
|
||||
@@ -1223,40 +1222,33 @@ impl Vecs {
|
||||
.map(|(_, v)| v)
|
||||
.map(Either::Right),
|
||||
)
|
||||
.collect::<Vec<Either<&mut utxo_cohort::Vecs, &mut address_cohort::Vecs>>>();
|
||||
|
||||
// Capped as external drives (even thunderbolt 4 SSDs) can be overwhelmed
|
||||
let chunk_size = (vecs.len() as f64 / 3.0).ceil() as usize;
|
||||
vecs.into_par_iter()
|
||||
// .into_iter()
|
||||
.chunks(chunk_size)
|
||||
.try_for_each(|v| {
|
||||
v.into_iter().try_for_each(|either| match either {
|
||||
Either::Left(v) => v.compute_rest_part2(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
market,
|
||||
&height_to_supply,
|
||||
dateindex_to_supply_ref,
|
||||
height_to_realized_cap_ref,
|
||||
dateindex_to_realized_cap_ref,
|
||||
exit,
|
||||
),
|
||||
Either::Right(v) => v.compute_rest_part2(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
market,
|
||||
&height_to_supply,
|
||||
dateindex_to_supply_ref,
|
||||
height_to_realized_cap_ref,
|
||||
dateindex_to_realized_cap_ref,
|
||||
exit,
|
||||
),
|
||||
})
|
||||
.collect::<Vec<Either<&mut utxo_cohort::Vecs, &mut address_cohort::Vecs>>>()
|
||||
.into_par_iter()
|
||||
.try_for_each(|either| match either {
|
||||
Either::Left(v) => v.compute_rest_part2(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
market,
|
||||
&height_to_supply,
|
||||
dateindex_to_supply_ref,
|
||||
height_to_realized_cap_ref,
|
||||
dateindex_to_realized_cap_ref,
|
||||
exit,
|
||||
),
|
||||
Either::Right(v) => v.compute_rest_part2(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
market,
|
||||
&height_to_supply,
|
||||
dateindex_to_supply_ref,
|
||||
height_to_realized_cap_ref,
|
||||
dateindex_to_realized_cap_ref,
|
||||
exit,
|
||||
),
|
||||
})?;
|
||||
|
||||
self.indexes_to_unspendable_supply.compute_rest(
|
||||
@@ -1276,8 +1268,6 @@ impl Vecs {
|
||||
Some(&self.height_to_opreturn_supply),
|
||||
)?;
|
||||
|
||||
stores.rotate_memtables();
|
||||
|
||||
exit.release();
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -761,8 +761,6 @@ impl Indexer {
|
||||
|
||||
export_if_needed(stores, vecs, idxs.height, true, exit)?;
|
||||
|
||||
stores.rotate_memtables();
|
||||
|
||||
Ok(starting_indexes)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,12 +181,6 @@ impl Stores {
|
||||
.map_err(|e| e.into())
|
||||
}
|
||||
|
||||
pub fn rotate_memtables(&self) {
|
||||
self.as_slice()
|
||||
.into_iter()
|
||||
.for_each(|store| store.rotate_memtable());
|
||||
}
|
||||
|
||||
fn as_slice(&self) -> [&(dyn AnyStore + Send + Sync); 11] {
|
||||
[
|
||||
&self.addressbyteshash_to_typeindex,
|
||||
|
||||
@@ -277,10 +277,6 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn rotate_memtable(&self) {
|
||||
let _ = self.partition.as_ref().unwrap().inner().rotate_memtable();
|
||||
}
|
||||
|
||||
fn height(&self) -> Option<Height> {
|
||||
self.meta.height()
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ pub trait AnyStore {
|
||||
|
||||
fn name(&self) -> &'static str;
|
||||
|
||||
fn rotate_memtable(&self);
|
||||
|
||||
fn height(&self) -> Option<Height>;
|
||||
|
||||
fn has(&self, height: Height) -> bool;
|
||||
|
||||
Reference in New Issue
Block a user