Skip to content

Commit 03aaf2d

Browse files
gokhan-simsek-iotamuXxer
authored andcommitted
node-upstream-change([v1.32.2, v1.33.3)): [rocksdb] add metric for num level 0 files (#6791)
## Description Port [MystenLabs/sui@262390b](MystenLabs/sui@262390b) Too many level 0 files can be a trigger to write stall & stop as well ## Links to any relevant issues Part of #3990 ## Type of change - Enhancement (a non-breaking change which adds functionality) ## How the change has been tested ``` cargo r --bin iota-node -- --config-path fullnode.yaml ``` ``` RUST_LOG=info cargo r --bin iota start --force-regenesis --with-faucet ```
1 parent cf5f172 commit 03aaf2d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

crates/typed-store/src/metrics.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ pub struct ColumnFamilyMetrics {
8484
pub rocksdb_total_sst_files_size: IntGaugeVec,
8585
pub rocksdb_total_blob_files_size: IntGaugeVec,
8686
pub rocksdb_total_num_files: IntGaugeVec,
87+
pub rocksdb_num_level0_files: IntGaugeVec,
8788
pub rocksdb_current_size_active_mem_tables: IntGaugeVec,
8889
pub rocksdb_size_all_mem_tables: IntGaugeVec,
8990
pub rocksdb_num_snapshots: IntGaugeVec,
@@ -130,6 +131,13 @@ impl ColumnFamilyMetrics {
130131
registry,
131132
)
132133
.unwrap(),
134+
rocksdb_num_level0_files: register_int_gauge_vec_with_registry!(
135+
"rocksdb_num_level0_files",
136+
"Number of level 0 files in the column family",
137+
&["cf_name"],
138+
registry,
139+
)
140+
.unwrap(),
133141
rocksdb_current_size_active_mem_tables: register_int_gauge_vec_with_registry!(
134142
"rocksdb_current_size_active_mem_tables",
135143
"The current approximate size of active memtable (bytes).",

crates/typed-store/src/rocks/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,14 @@ impl<K, V> DBMap<K, V> {
10341034
.rocksdb_total_num_files
10351035
.with_label_values(&[cf_name])
10361036
.set(total_num_files);
1037+
db_metrics
1038+
.cf_metrics
1039+
.rocksdb_num_level0_files
1040+
.with_label_values(&[cf_name])
1041+
.set(
1042+
Self::get_int_property(rocksdb, &cf, &num_files_at_level(0))
1043+
.unwrap_or(METRICS_ERROR),
1044+
);
10371045
db_metrics
10381046
.cf_metrics
10391047
.rocksdb_current_size_active_mem_tables

0 commit comments

Comments
 (0)