From: Yueh-Hsuan Chiang Date: Fri, 25 Sep 2015 20:34:49 +0000 (-0700) Subject: Fixed a bug which causes rocksdb.flush.write.bytes stat is always zero X-Git-Tag: v4.0~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0b7dd9131ff5c503116394937deee314f3eda062;p=rocksdb.git Fixed a bug which causes rocksdb.flush.write.bytes stat is always zero Summary: Fixed a bug which causes rocksdb.flush.write.bytes stat is always zero Test Plan: augment existing db_test Reviewers: sdong, anthony, IslamAbdelRahman, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D47595 --- diff --git a/db/builder.cc b/db/builder.cc index a40a9564a..5d3247ff7 100644 --- a/db/builder.cc +++ b/db/builder.cc @@ -103,9 +103,8 @@ Status BuildTable( // TODO(noetzli): Update stats after flush, too. if (io_priority == Env::IO_HIGH && IOSTATS(bytes_written) >= kReportFlushIOStatsEvery) { - ThreadStatusUtil::IncreaseThreadOperationProperty( + ThreadStatusUtil::SetThreadOperationProperty( ThreadStatus::FLUSH_BYTES_WRITTEN, IOSTATS(bytes_written)); - IOSTATS_RESET(bytes_written); } } diff --git a/db/db_test.cc b/db/db_test.cc index 5ceda2d71..98bfefcbc 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -7949,6 +7949,9 @@ TEST_F(DBTest, MergeTestTime) { ASSERT_LT(TestGetTickerCount(options, MERGE_OPERATION_TOTAL_TIME), 6000000); ASSERT_GT(TestGetTickerCount(options, MERGE_OPERATION_TOTAL_TIME), 3200000); +#if ROCKSDB_USING_THREAD_STATUS + ASSERT_GT(TestGetTickerCount(options, FLUSH_WRITE_BYTES), 0); +#endif // ROCKSDB_USING_THREAD_STATUS } TEST_P(DBTestWithParam, MergeCompactionTimeTest) { diff --git a/db/flush_job.cc b/db/flush_job.cc index e42e3c0e4..410108a05 100644 --- a/db/flush_job.cc +++ b/db/flush_job.cc @@ -111,9 +111,8 @@ void FlushJob::ReportFlushInputSize(const autovector& mems) { } void FlushJob::RecordFlushIOStats() { - ThreadStatusUtil::IncreaseThreadOperationProperty( + ThreadStatusUtil::SetThreadOperationProperty( ThreadStatus::FLUSH_BYTES_WRITTEN, IOSTATS(bytes_written)); - IOSTATS_RESET(bytes_written); } Status FlushJob::Run(FileMetaData* file_meta) {