]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Fixed a bug which causes rocksdb.flush.write.bytes stat is always zero
authorYueh-Hsuan Chiang <yhchiang@fb.com>
Fri, 25 Sep 2015 20:34:49 +0000 (13:34 -0700)
committerIslam AbdelRahman <tec@fb.com>
Tue, 29 Sep 2015 01:39:35 +0000 (18:39 -0700)
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

db/builder.cc
db/db_test.cc
db/flush_job.cc

index a40a9564a44f2501a73854572fc01b46e52b09ca..5d3247ff7f2c10f0b8044670d4cbec59d15874fc 100644 (file)
@@ -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);
       }
     }
 
index 5ceda2d7132d226c0a2c440596cbfe152e0238b3..98bfefcbca67cd48e738dc637a443bf6d43d0589 100644 (file)
@@ -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) {
index e42e3c0e4becaa119a0f47b580d66d3f77e44c9b..410108a051301296aedc458987131c5496876fe1 100644 (file)
@@ -111,9 +111,8 @@ void FlushJob::ReportFlushInputSize(const autovector<MemTable*>& 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) {