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

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 1bb65c06 fix(log): fix rocksdb stall condition string output (#2651)
1bb65c06 is described below

commit 1bb65c0635a925296566becbdd0329abf3f244ea
Author: mwish <[email protected]>
AuthorDate: Fri Nov 8 14:32:53 2024 +0800

    fix(log): fix rocksdb stall condition string output (#2651)
---
 src/storage/event_listener.cc | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/storage/event_listener.cc b/src/storage/event_listener.cc
index ab1c4233..e5861d20 100644
--- a/src/storage/event_listener.cc
+++ b/src/storage/event_listener.cc
@@ -43,9 +43,13 @@ std::string FileCreatedReason2String(const 
rocksdb::TableFileCreationReason reas
 }
 
 std::string StallConditionType2String(const rocksdb::WriteStallCondition type) 
{
-  std::vector<std::string> stall_condition_strings = {"normal", "delay", 
"stop"};
-  if (static_cast<size_t>(type) < stall_condition_strings.size()) {
-    return stall_condition_strings[static_cast<size_t>(type)];
+  switch (type) {
+    case rocksdb::WriteStallCondition::kDelayed:
+      return "delay";
+    case rocksdb::WriteStallCondition::kStopped:
+      return "stop";
+    case rocksdb::WriteStallCondition::kNormal:
+      return "normal";
   }
   return "unknown";
 }

Reply via email to