global: snap

This commit is contained in:
nym21
2026-04-03 15:51:27 +02:00
parent 79829ddd53
commit 768e6870cb
15 changed files with 1706 additions and 4878 deletions

View File

@@ -308,35 +308,13 @@ impl Indexer {
drop(readers);
let lock = exit.lock();
let tasks = self.stores.take_all_pending_ingests(indexes.height)?;
self.stores.commit(indexes.height)?;
self.vecs.stamped_write(indexes.height)?;
let fjall_db = self.stores.db.clone();
self.vecs.db.run_bg(move |db| {
let _lock = lock;
sleep(Duration::from_secs(5));
info!("Exporting...");
let i = Instant::now();
if !tasks.is_empty() {
let i = Instant::now();
for task in tasks {
task().map_err(vecdb::RawDBError::other)?;
}
debug!("Stores committed in {:?}", i.elapsed());
let i = Instant::now();
fjall_db
.persist(PersistMode::SyncData)
.map_err(RawDBError::other)?;
debug!("Stores persisted in {:?}", i.elapsed());
}
db.compact()?;
info!("Exported in {:?}", i.elapsed());
Ok(())
});

View File

@@ -42,7 +42,8 @@ impl Stores {
let database = match brk_store::open_database(path) {
Ok(database) => database,
Err(_) if can_retry => {
Err(err) if can_retry => {
info!("Failed to open stores at {path:?}: {err:?}, deleting and retrying");
fs::remove_dir_all(path)?;
return Self::forced_import_inner(parent, version, false);
}
@@ -84,7 +85,7 @@ impl Stores {
)
};
Ok(Self {
let stores = Self {
db: database.clone(),
addr_type_to_addr_hash_to_addr_index: ByAddrType::new_with_index(
@@ -113,7 +114,16 @@ impl Stores {
Kind::Recent,
5,
)?,
})
};
debug!(
"Stores imported: txid_prefix empty={}, blockhash empty={}, keyspace_count={}",
stores.txid_prefix_to_tx_index.is_empty()?,
stores.blockhash_prefix_to_height.is_empty()?,
database.keyspace_count(),
);
Ok(stores)
}
pub fn starting_height(&self) -> Height {
@@ -412,3 +422,4 @@ impl Stores {
Ok(())
}
}