Skip to content

Commit 4ba0b6c

Browse files
mrcnskiordian
authored andcommitted
Remove mem_info and references to parity-util-mem (paritytech#12795)
* Remove mem_info and some references to parity-util-mem * [Draft] Finish removing references to `parity-util-mem` * Upgrade dependencies * Update scripts/ci/deny.toml Co-authored-by: ordian <write@reusable.software> * Fix Cargo.lock (remove unwanted dependency changes) * Removed unused argument * Run cargo fmt (didn't have pre-commit set up) * Fix some CI errors * Fix another CI error * Remove unused dependency Co-authored-by: ordian <write@reusable.software>
1 parent b14ecbd commit 4ba0b6c

File tree

46 files changed

+70
-426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+70
-426
lines changed

Cargo.lock

Lines changed: 10 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/node/bench/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ sp-state-machine = { version = "0.13.0", path = "../../../primitives/state-machi
2323
serde = "1.0.136"
2424
serde_json = "1.0.85"
2525
derive_more = { version = "0.99.17", default-features = false, features = ["display"] }
26-
kvdb = "0.12.0"
27-
kvdb-rocksdb = "0.16.0"
26+
kvdb = "0.13.0"
27+
kvdb-rocksdb = "0.17.0"
2828
sp-trie = { version = "7.0.0", path = "../../../primitives/trie" }
2929
sp-core = { version = "7.0.0", path = "../../../primitives/core" }
3030
sp-consensus = { version = "0.10.0-dev", path = "../../../primitives/consensus/common" }
@@ -37,7 +37,6 @@ tempfile = "3.1.0"
3737
fs_extra = "1"
3838
rand = { version = "0.7.2", features = ["small_rng"] }
3939
lazy_static = "1.4.0"
40-
parity-util-mem = { version = "0.12.0", default-features = false, features = ["primitive-types"] }
4140
parity-db = "0.4.2"
4241
sc-transaction-pool = { version = "4.0.0-dev", path = "../../../client/transaction-pool" }
4342
sc-transaction-pool-api = { version = "4.0.0-dev", path = "../../../client/transaction-pool/api" }

bin/node/bench/src/tempdb.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub enum DatabaseType {
2929
pub struct TempDatabase(tempfile::TempDir);
3030

3131
struct ParityDbWrapper(parity_db::Db);
32-
parity_util_mem::malloc_size_of_is_0!(ParityDbWrapper);
3332

3433
impl KeyValueDB for ParityDbWrapper {
3534
/// Get a value by key.

bin/node/cli/Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ node-inspect = { version = "0.9.0-dev", optional = true, path = "../inspect" }
101101
try-runtime-cli = { version = "0.10.0-dev", optional = true, path = "../../../utils/frame/try-runtime/cli" }
102102
serde_json = "1.0.85"
103103

104-
[target.'cfg(any(target_arch="x86_64", target_arch="aarch64"))'.dependencies]
105-
sp-trie = { version = "7.0.0", default-features = false, path = "../../../primitives/trie", features = [
106-
"memory-tracker",
107-
] }
108-
109104
[dev-dependencies]
110105
sc-keystore = { version = "4.0.0-dev", path = "../../../client/keystore" }
111106
sc-client-db = { version = "0.10.0-dev", path = "../../../client/db" }

client/api/src/client.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -197,26 +197,13 @@ impl fmt::Display for MemorySize {
197197
}
198198
}
199199

200-
/// Memory statistics for state db.
201-
#[derive(Default, Clone, Debug)]
202-
pub struct StateDbMemoryInfo {
203-
/// Memory usage of the non-canonical overlay
204-
pub non_canonical: MemorySize,
205-
/// Memory usage of the pruning window.
206-
pub pruning: Option<MemorySize>,
207-
/// Memory usage of the pinned blocks.
208-
pub pinned: MemorySize,
209-
}
210-
211200
/// Memory statistics for client instance.
212201
#[derive(Default, Clone, Debug)]
213202
pub struct MemoryInfo {
214203
/// Size of state cache.
215204
pub state_cache: MemorySize,
216205
/// Size of backend database cache.
217206
pub database_cache: MemorySize,
218-
/// Size of the state db.
219-
pub state_db: StateDbMemoryInfo,
220207
}
221208

222209
/// I/O statistics for client instance.
@@ -264,13 +251,9 @@ impl fmt::Display for UsageInfo {
264251
write!(
265252
f,
266253
"caches: ({} state, {} db overlay), \
267-
state db: ({} non-canonical, {} pruning, {} pinned), \
268254
i/o: ({} tx, {} write, {} read, {} avg tx, {}/{} key cache reads/total, {} trie nodes writes)",
269255
self.memory.state_cache,
270256
self.memory.database_cache,
271-
self.memory.state_db.non_canonical,
272-
self.memory.state_db.pruning.unwrap_or_default(),
273-
self.memory.state_db.pinned,
274257
self.io.transactions,
275258
self.io.bytes_written,
276259
self.io.bytes_read,

client/db/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = [
1717
"derive",
1818
] }
1919
hash-db = "0.15.2"
20-
kvdb = "0.12.0"
21-
kvdb-memorydb = "0.12.0"
22-
kvdb-rocksdb = { version = "0.16.0", optional = true }
20+
kvdb = "0.13.0"
21+
kvdb-memorydb = "0.13.0"
22+
kvdb-rocksdb = { version = "0.17.0", optional = true }
2323
linked-hash-map = "0.5.4"
2424
log = "0.4.17"
2525
parity-db = "0.4.2"
@@ -36,7 +36,7 @@ sp-trie = { version = "7.0.0", path = "../../primitives/trie" }
3636

3737
[dev-dependencies]
3838
criterion = "0.3.3"
39-
kvdb-rocksdb = "0.16.0"
39+
kvdb-rocksdb = "0.17.0"
4040
rand = "0.8.4"
4141
tempfile = "3.1.0"
4242
quickcheck = { version = "1.0.3", default-features = false }

client/db/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,10 +2086,9 @@ impl<Block: BlockT> sc_client_api::backend::Backend<Block> for Backend<Block> {
20862086
let state_cache = MemorySize::from_bytes(
20872087
self.shared_trie_cache.as_ref().map_or(0, |c| c.used_memory_size()),
20882088
);
2089-
let state_db = self.storage.state_db.memory_info();
20902089

20912090
Some(UsageInfo {
2092-
memory: MemoryInfo { state_cache, database_cache, state_db },
2091+
memory: MemoryInfo { state_cache, database_cache },
20932092
io: IoInfo {
20942093
transactions: io_stats.transactions,
20952094
bytes_read: io_stats.bytes_read,

client/db/src/storage_cache.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,11 @@ pub struct Cache<B: BlockT> {
5959

6060
struct LRUMap<K, V>(LinkedHashMap<K, V>, usize, usize);
6161

62-
/// Internal trait similar to `heapsize` but using
63-
/// a simply estimation.
62+
/// Internal trait similar to `heapsize` but using a simple estimation.
6463
///
65-
/// This should not be made public, it is implementation
66-
/// detail trait. If it need to become public please
67-
/// consider using `malloc_size_of`.
64+
/// This should not be made public, it is an implementation detail trait.
6865
trait EstimateSize {
69-
/// Return a size estimation of additional size needed
70-
/// to cache this struct (in bytes).
66+
/// Return a size estimation of the additional size needed to cache this struct (in bytes).
7167
fn estimate_size(&self) -> usize;
7268
}
7369

client/informant/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ ansi_term = "0.12.1"
1717
futures = "0.3.21"
1818
futures-timer = "3.0.1"
1919
log = "0.4.17"
20-
parity-util-mem = { version = "0.12.0", default-features = false, features = ["primitive-types"] }
2120
sc-client-api = { version = "4.0.0-dev", path = "../api" }
2221
sc-network-common = { version = "0.10.0-dev", path = "../network/common" }
2322
sc-transaction-pool-api = { version = "4.0.0-dev", path = "../transaction-pool/api" }

client/informant/src/lib.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ use ansi_term::Colour;
2222
use futures::prelude::*;
2323
use futures_timer::Delay;
2424
use log::{debug, info, trace};
25-
use parity_util_mem::MallocSizeOf;
2625
use sc_client_api::{BlockchainEvents, UsageProvider};
2726
use sc_network_common::service::NetworkStatusProvider;
28-
use sc_transaction_pool_api::TransactionPool;
2927
use sp_blockchain::HeaderMetadata;
3028
use sp_runtime::traits::{Block as BlockT, Header};
3129
use std::{collections::VecDeque, fmt::Display, sync::Arc, time::Duration};
@@ -53,16 +51,11 @@ impl Default for OutputFormat {
5351
}
5452

5553
/// Builds the informant and returns a `Future` that drives the informant.
56-
pub async fn build<B: BlockT, C, N, P>(
57-
client: Arc<C>,
58-
network: N,
59-
pool: Arc<P>,
60-
format: OutputFormat,
61-
) where
54+
pub async fn build<B: BlockT, C, N>(client: Arc<C>, network: N, format: OutputFormat)
55+
where
6256
N: NetworkStatusProvider<B>,
6357
C: UsageProvider<B> + HeaderMetadata<B> + BlockchainEvents<B>,
6458
<C as HeaderMetadata<B>>::Error: Display,
65-
P: TransactionPool + MallocSizeOf,
6659
{
6760
let mut display = display::InformantDisplay::new(format.clone());
6861

@@ -83,11 +76,6 @@ pub async fn build<B: BlockT, C, N, P>(
8376
"Usage statistics not displayed as backend does not provide it",
8477
)
8578
}
86-
trace!(
87-
target: "usage",
88-
"Subsystems memory [txpool: {} kB]",
89-
parity_util_mem::malloc_size(&*pool) / 1024,
90-
);
9179
display.display(&info, net_status);
9280
future::ready(())
9381
});

0 commit comments

Comments
 (0)