From 2b70224f82210d27b87639c5ba49e1478b6936c3 Mon Sep 17 00:00:00 2001 From: leipeng Date: Mon, 1 Nov 2021 11:42:09 -0700 Subject: [PATCH] remove bad extra RecordTick(stats_, WRITE_WITH_WAL) (#9064) Summary: This PR fix wrong ticker `WRITE_WITH_WAL`. `RecordTick(WRITE_WITH_WAL)` will be called later in `WriteToWAL` and `ConcurrentWriteToWAL`. Fixes: 1. Delete these two extra `RecordTick(WRITE_WITH_WAL)` 2. Fix corresponding test case Pull Request resolved: https://github.com/facebook/rocksdb/pull/9064 Reviewed By: ajkr Differential Revision: D31944459 Pulled By: riversand963 fbshipit-source-id: f1aa8d2a4320456bc357bc5b0902032f7dcad086 --- HISTORY.md | 1 + db/db_impl/db_impl_write.cc | 6 ------ monitoring/stats_history_test.cc | 4 ++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index e20569d2a..5b0ae1bc2 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,7 @@ ### Bug Fixes * Prevent a `CompactRange()` with `CompactRangeOptions::change_level == true` from possibly causing corruption to the LSM state (overlapping files within a level) when run in parallel with another manual compaction. Note that setting `force_consistency_checks == true` (the default) would cause the DB to enter read-only mode in this scenario and return `Status::Corruption`, rather than committing any corruption. * Fixed a bug in CompactionIterator when write-prepared transaction is used. A released earliest write conflict snapshot may cause assertion failure in dbg mode and unexpected key in opt mode. +* Fix ticker WRITE_WITH_WAL("rocksdb.write.wal"), this bug is caused by a bad extra `RecordTick(stats_, WRITE_WITH_WAL)` (at 2 place), this fix remove the extra `RecordTick`s and fix the corresponding test case. ## 6.26.0 (2021-10-20) ### Bug Fixes diff --git a/db/db_impl/db_impl_write.cc b/db/db_impl/db_impl_write.cc index 73e2eeb7f..1eba26405 100644 --- a/db/db_impl/db_impl_write.cc +++ b/db/db_impl/db_impl_write.cc @@ -156,11 +156,6 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options, PERF_TIMER_GUARD(write_pre_and_post_process_time); WriteThread::Writer w(write_options, my_batch, callback, log_ref, disable_memtable, batch_cnt, pre_release_callback); - - if (!write_options.disableWAL) { - RecordTick(stats_, WRITE_WITH_WAL); - } - StopWatch write_sw(immutable_db_options_.clock, stats_, DB_WRITE); write_thread_.JoinBatchGroup(&w); @@ -681,7 +676,6 @@ Status DBImpl::WriteImplWALOnly( PERF_TIMER_GUARD(write_pre_and_post_process_time); WriteThread::Writer w(write_options, my_batch, callback, log_ref, disable_memtable, sub_batch_cnt, pre_release_callback); - RecordTick(stats_, WRITE_WITH_WAL); StopWatch write_sw(immutable_db_options_.clock, stats_, DB_WRITE); write_thread->JoinBatchGroup(&w); diff --git a/monitoring/stats_history_test.cc b/monitoring/stats_history_test.cc index 294b9ba68..59e7be3d9 100644 --- a/monitoring/stats_history_test.cc +++ b/monitoring/stats_history_test.cc @@ -506,7 +506,7 @@ TEST_F(StatsHistoryTest, PersistentStatsCreateColumnFamilies) { } } stats_iter.reset(); - ASSERT_EQ(num_write_wal, 2); + ASSERT_EQ(num_write_wal, 1); options.persist_stats_to_disk = false; ReopenWithColumnFamilies({"default", "one", "two", "three", "four"}, options); @@ -542,7 +542,7 @@ TEST_F(StatsHistoryTest, PersistentStatsCreateColumnFamilies) { } } } - ASSERT_EQ(num_write_wal, 2); + ASSERT_EQ(num_write_wal, 1); Close(); Destroy(options);