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