diff --git a/ledger/src/blockstore_db.rs b/ledger/src/blockstore_db.rs index cc89d5d752..aa29de561d 100644 --- a/ledger/src/blockstore_db.rs +++ b/ledger/src/blockstore_db.rs @@ -800,6 +800,8 @@ pub trait ColumnMetrics { ); fn rocksdb_get_perf_metric_header(column_options: &Arc) -> &'static str; fn rocksdb_put_perf_metric_header(column_options: &Arc) -> &'static str; + fn rocksdb_delete_perf_metric_header(column_options: &Arc) + -> &'static str; } pub trait ColumnName { @@ -911,6 +913,15 @@ impl ColumnMetrics for columns::TransactionStatus { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "transaction_status", + column_options + ) + } } impl ColumnName for columns::TransactionStatus { const NAME: &'static str = TRANSACTION_STATUS_CF; @@ -977,6 +988,15 @@ impl ColumnMetrics for columns::AddressSignatures { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "address_signatures", + column_options + ) + } } impl ColumnName for columns::AddressSignatures { const NAME: &'static str = ADDRESS_SIGNATURES_CF; @@ -1033,6 +1053,15 @@ impl ColumnMetrics for columns::TransactionMemos { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "transaction_memos", + column_options + ) + } } impl ColumnName for columns::TransactionMemos { const NAME: &'static str = TRANSACTION_MEMOS_CF; @@ -1089,6 +1118,15 @@ impl ColumnMetrics for columns::TransactionStatusIndex { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "transaction_status_index", + column_options + ) + } } impl ColumnName for columns::TransactionStatusIndex { const NAME: &'static str = TRANSACTION_STATUS_INDEX_CF; @@ -1120,6 +1158,15 @@ impl ColumnMetrics for columns::Rewards { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "rewards", + column_options + ) + } } impl ColumnName for columns::Rewards { const NAME: &'static str = REWARDS_CF; @@ -1154,6 +1201,15 @@ impl ColumnMetrics for columns::Blocktime { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "blocktime", + column_options + ) + } } impl ColumnName for columns::Blocktime { const NAME: &'static str = BLOCKTIME_CF; @@ -1188,6 +1244,15 @@ impl ColumnMetrics for columns::PerfSamples { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "perf_samples", + column_options + ) + } } impl ColumnName for columns::PerfSamples { const NAME: &'static str = PERF_SAMPLES_CF; @@ -1222,6 +1287,15 @@ impl ColumnMetrics for columns::BlockHeight { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "block_height", + column_options + ) + } } impl ColumnName for columns::BlockHeight { const NAME: &'static str = BLOCK_HEIGHT_CF; @@ -1255,6 +1329,15 @@ impl ColumnMetrics for columns::ProgramCosts { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "program_costs", + column_options + ) + } } impl ColumnName for columns::ProgramCosts { @@ -1335,6 +1418,15 @@ impl ColumnMetrics for columns::ShredCode { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "shred_code", + column_options + ) + } } impl ColumnName for columns::ShredCode { const NAME: &'static str = CODE_SHRED_CF; @@ -1390,6 +1482,15 @@ impl ColumnMetrics for columns::ShredData { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "shred_data", + column_options + ) + } } impl ColumnName for columns::ShredData { const NAME: &'static str = DATA_SHRED_CF; @@ -1421,6 +1522,15 @@ impl ColumnMetrics for columns::Index { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "index", + column_options + ) + } } impl ColumnName for columns::Index { const NAME: &'static str = INDEX_CF; @@ -1455,6 +1565,15 @@ impl ColumnMetrics for columns::DeadSlots { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "dead_slots", + column_options + ) + } } impl ColumnName for columns::DeadSlots { const NAME: &'static str = DEAD_SLOTS_CF; @@ -1489,6 +1608,15 @@ impl ColumnMetrics for columns::DuplicateSlots { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "duplicate_slots", + column_options + ) + } } impl ColumnName for columns::DuplicateSlots { const NAME: &'static str = DUPLICATE_SLOTS_CF; @@ -1523,6 +1651,15 @@ impl ColumnMetrics for columns::Orphans { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "orphans", + column_options + ) + } } impl ColumnName for columns::Orphans { const NAME: &'static str = ORPHANS_CF; @@ -1557,6 +1694,15 @@ impl ColumnMetrics for columns::BankHash { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "bank_hash", + column_options + ) + } } impl ColumnName for columns::BankHash { const NAME: &'static str = BANK_HASH_CF; @@ -1591,6 +1737,15 @@ impl ColumnMetrics for columns::Root { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "root", + column_options + ) + } } impl ColumnName for columns::Root { const NAME: &'static str = ROOT_CF; @@ -1625,6 +1780,15 @@ impl ColumnMetrics for columns::SlotMeta { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "slot_meta", + column_options + ) + } } impl ColumnName for columns::SlotMeta { const NAME: &'static str = META_CF; @@ -1684,6 +1848,15 @@ impl ColumnMetrics for columns::ErasureMeta { column_options ) } + fn rocksdb_delete_perf_metric_header( + column_options: &Arc, + ) -> &'static str { + rocksdb_metric_header!( + "blockstore_rocksdb_write_perf,op=delete", + "erasure_meta", + column_options + ) + } } impl ColumnName for columns::ErasureMeta { const NAME: &'static str = ERASURE_META_CF; @@ -2416,7 +2589,12 @@ where } pub fn delete(&self, key: C::Index) -> Result<()> { - self.backend.delete_cf(self.handle(), &C::key(key)) + let is_perf_context_enabled = maybe_collect_perf_context(); + let result = self.backend.delete_cf(self.handle(), &C::key(key)); + if is_perf_context_enabled { + report_write_perf_context(C::rocksdb_delete_perf_metric_header(&self.column_options)); + } + result } }