Skip to content

Commit

Permalink
jsonrpc: don't explicitly remove old tables
Browse files Browse the repository at this point in the history
Don't explicitly remove old jsonrpc index tables as well as remove a
possible panic when reporting rocksdb metrics.
  • Loading branch information
bmwill committed Oct 21, 2024
1 parent 368fc4b commit 9e7d7eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
14 changes: 1 addition & 13 deletions crates/sui-core/src/jsonrpc_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ pub struct IndexStoreTables {

#[default_options_override_fn = "coin_index_table_default_config"]
#[deprecated]
#[allow(unused)]
coin_index: DBMap<CoinIndexKey, CoinInfo>,
#[default_options_override_fn = "coin_index_table_default_config"]
coin_index_2: DBMap<CoinIndexKey2, CoinInfo>,
Expand Down Expand Up @@ -340,19 +341,6 @@ impl IndexStoreTables {
// Commit to the DB that the indexes have been initialized
self.meta.insert(&(), &metadata)?;

// Clear old, deprecated and unused column families
if !self.coin_index.is_empty() {
self.coin_index.unsafe_clear()?;
}

if !self.loaded_child_object_versions.is_empty() {
self.loaded_child_object_versions.unsafe_clear()?;
}

if !self.timestamps.is_empty() {
self.timestamps.unsafe_clear()?;
}

Ok(())
}
}
Expand Down
9 changes: 8 additions & 1 deletion crates/typed-store/src/rocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,14 @@ impl<K, V> DBMap<K, V> {
}

fn report_metrics(rocksdb: &Arc<RocksDB>, cf_name: &str, db_metrics: &Arc<DBMetrics>) {
let cf = rocksdb.cf_handle(cf_name).expect("Failed to get cf");
let Some(cf) = rocksdb.cf_handle(cf_name) else {
tracing::warn!(
"unable to report metrics for cf {cf_name:?} in db {:?}",
rocksdb.db_name()
);
return;
};

db_metrics
.cf_metrics
.rocksdb_total_sst_files_size
Expand Down

0 comments on commit 9e7d7eb

Please sign in to comment.