mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 18:41:05 +00:00
state-db: Print warning when using large pruning window on RocksDb (#13414)
* state-db: Print warning when using large pruning window on RocksDb This pr changes state-db to print a warning when using a large pruning window and running with a database that isn't supporting ref-counting like RocksDb. This makes the user aware of potential out of memory errors because this option together with RocksDb etc puts the entire pruning window into memory. Besides that the pr introduces `LOG_TARGET` for having the target declared central! * Review comments
This commit is contained in:
@@ -56,6 +56,8 @@ use std::{
|
||||
fmt,
|
||||
};
|
||||
|
||||
const LOG_TARGET: &str = "state-db";
|
||||
const LOG_TARGET_PIN: &str = "state-db::pin";
|
||||
const PRUNING_MODE: &[u8] = b"mode";
|
||||
const PRUNING_MODE_ARCHIVE: &[u8] = b"archive";
|
||||
const PRUNING_MODE_ARCHIVE_CANON: &[u8] = b"archive_canonical";
|
||||
@@ -309,7 +311,7 @@ impl<BlockHash: Hash, Key: Hash, D: MetaDb> StateDbSync<BlockHash, Key, D> {
|
||||
ref_counting: bool,
|
||||
db: D,
|
||||
) -> Result<StateDbSync<BlockHash, Key, D>, Error<D::Error>> {
|
||||
trace!(target: "state-db", "StateDb settings: {:?}. Ref-counting: {}", mode, ref_counting);
|
||||
trace!(target: LOG_TARGET, "StateDb settings: {:?}. Ref-counting: {}", mode, ref_counting);
|
||||
|
||||
let non_canonical: NonCanonicalOverlay<BlockHash, Key> = NonCanonicalOverlay::new(&db)?;
|
||||
let pruning: Option<RefWindow<BlockHash, Key, D>> = match mode {
|
||||
|
||||
Reference in New Issue
Block a user