Skip to content

Commit

Permalink
Add WAL write duration metric (#153)
Browse files Browse the repository at this point in the history
Add WAL write duration metric

UCP tikv/tikv#6541

Signed-off-by: Wangweizhen <[email protected]>
Signed-off-by: tabokie <[email protected]>
  • Loading branch information
hawkingrei authored and tabokie committed May 12, 2022
1 parent 7c6dcaa commit e3c8f48
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions db/db_impl/db_impl_write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,7 @@ IOStatus DBImpl::WriteToWAL(const WriteThread::WriteGroup& write_group,
// Same holds for all in the batch group
size_t write_with_wal = 0;
WriteBatch* to_be_cached_state = nullptr;
StopWatch write_sw(immutable_db_options_.clock, stats_, DB_WRITE_WAL_TIME);
WriteBatch* merged_batch = MergeBatch(write_group, &tmp_batch_,
&write_with_wal, &to_be_cached_state);
if (merged_batch == write_group.leader->batch) {
Expand Down Expand Up @@ -1228,6 +1229,7 @@ IOStatus DBImpl::ConcurrentWriteToWAL(
WriteBatch tmp_batch;
size_t write_with_wal = 0;
WriteBatch* to_be_cached_state = nullptr;
StopWatch write_sw(immutable_db_options_.clock, stats_, DB_WRITE_WAL_TIME);
WriteBatch* merged_batch =
MergeBatch(write_group, &tmp_batch, &write_with_wal, &to_be_cached_state);

Expand Down
1 change: 1 addition & 0 deletions include/rocksdb/statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ enum Histograms : uint32_t {
// Time spent flushing memtable to disk
FLUSH_TIME,
SST_BATCH_SIZE,
DB_WRITE_WAL_TIME,

// MultiGet stats logged per level
// Num of index and filter blocks read from file system per level.
Expand Down
1 change: 1 addition & 0 deletions monitoring/statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ const std::vector<std::pair<Histograms, std::string>> HistogramsNameMap = {
{BLOB_DB_DECOMPRESSION_MICROS, "rocksdb.blobdb.decompression.micros"},
{FLUSH_TIME, "rocksdb.db.flush.micros"},
{SST_BATCH_SIZE, "rocksdb.sst.batch.size"},
{DB_WRITE_WAL_TIME, "rocksdb.db.write.wal.time"},
{NUM_INDEX_AND_FILTER_BLOCKS_READ_PER_LEVEL,
"rocksdb.num.index.and.filter.blocks.read.per.level"},
{NUM_DATA_BLOCKS_READ_PER_LEVEL, "rocksdb.num.data.blocks.read.per.level"},
Expand Down

0 comments on commit e3c8f48

Please sign in to comment.