This is an automated email from the ASF dual-hosted git repository.

gehafearless pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f78d2255 fix(rocksdb): fix the problem that the usage of block cache 
is not set for the metric (#2060)
3f78d2255 is described below

commit 3f78d22553d5a0ee00873a42fa11d069ca71c0bd
Author: Dan Wang <[email protected]>
AuthorDate: Fri Jul 5 12:45:26 2024 +0800

    fix(rocksdb): fix the problem that the usage of block cache is not set for 
the metric (#2060)
    
    #2061
    
    The monitor of the block cache usage is server-level and created by
    std::call_once in a replica-level object, running periodically to update
    the block cache usage.
    
    However, once the replica-level object is stopped, the server-level
    monitor would be cancelled; as a result, the block cache usage would
    never be updated.
---
 src/server/pegasus_server_impl.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/server/pegasus_server_impl.cpp 
b/src/server/pegasus_server_impl.cpp
index 75c95a812..6a76679eb 100644
--- a/src/server/pegasus_server_impl.cpp
+++ b/src/server/pegasus_server_impl.cpp
@@ -1817,6 +1817,12 @@ dsn::error_code pegasus_server_impl::start(int argc, 
char **argv)
     std::call_once(flag, [&]() {
         // The timer task will always running even though there is no replicas
         CHECK_NE(kServerStatUpdateTimeSec.count(), 0);
+
+        // TODO(wangdan): _update_server_rdb_stat is server-level, thus it 
could not be simply
+        // cancelled in the destructor of pegasus_server_impl which is 
replica-level.
+        //
+        // We should refactor to make _update_server_rdb_stat exit gracefully 
by
+        // `_update_server_rdb_stat->cancel(true)`.
         _update_server_rdb_stat = dsn::tasking::enqueue_timer(
             LPC_REPLICATION_LONG_COMMON,
             nullptr, // TODO: the tracker is nullptr, we will fix it later
@@ -1869,10 +1875,7 @@ void pegasus_server_impl::cancel_background_work(bool 
wait)
         _update_replica_rdb_stat->cancel(true);
         _update_replica_rdb_stat = nullptr;
     }
-    if (_update_server_rdb_stat != nullptr) {
-        _update_server_rdb_stat->cancel(true);
-        _update_server_rdb_stat = nullptr;
-    }
+
     _tracker.cancel_outstanding_tasks();
 
     _context_cache.clear();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to