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

laiyingchun 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 0ccf1108f fix(jemalloc): enlarge the buffer size to dump jemalloc 
stats (#1636)
0ccf1108f is described below

commit 0ccf1108f71252816d16fd23523adf197d00dd83
Author: Yingchun Lai <[email protected]>
AuthorDate: Thu Oct 12 10:52:43 2023 +0800

    fix(jemalloc): enlarge the buffer size to dump jemalloc stats (#1636)
    
    https://github.com/apache/incubator-pegasus/issues/1635
    
    - Enlarge the buffer size to dump jemalloc stats
    - Improve the jemalloc unit tests
---
 src/utils/je_ctl.cpp           |  2 +-
 src/utils/test/je_ctl_test.cpp | 33 +++++++++++++++++----------------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/utils/je_ctl.cpp b/src/utils/je_ctl.cpp
index fa6a7168d..38f5bb1be 100644
--- a/src/utils/je_ctl.cpp
+++ b/src/utils/je_ctl.cpp
@@ -75,7 +75,7 @@ const char *je_stats_type_to_opts(je_stats_type type)
 size_t je_stats_type_to_default_buf_sz(je_stats_type type)
 {
     static const size_t buf_sz_map[] = {
-        2 * 1024, 4 * 1024, 1024 * 1024, 2 * 1024 * 1024,
+        2 * 1024, 4 * 1024, 8 * 1024 * 1024, 8 * 1024 * 1024,
     };
 
     RETURN_ARRAY_ELEM_BY_ENUM_TYPE(type, buf_sz_map);
diff --git a/src/utils/test/je_ctl_test.cpp b/src/utils/test/je_ctl_test.cpp
index 06e64be17..b0e0db576 100644
--- a/src/utils/test/je_ctl_test.cpp
+++ b/src/utils/test/je_ctl_test.cpp
@@ -17,10 +17,11 @@
 
 #ifdef DSN_USE_JEMALLOC
 
-#include "utils/je_ctl.h"
-
 #include <gtest/gtest.h>
 
+#include "utils/je_ctl.h"
+#include "utils/test_macros.h"
+
 namespace dsn {
 
 namespace {
@@ -53,10 +54,10 @@ void check_configs_marks(const std::string &stats)
 void check_arena_marks(const std::string &stats)
 {
     // Marks for merged arenas.
-    ASSERT_NE(stats.find("Merged arenas stats:"), std::string::npos);
+    ASSERT_NE(stats.find("Merged arenas stats:"), std::string::npos) << stats;
 
     // Marks for each arena.
-    ASSERT_NE(stats.find("arenas[0]:"), std::string::npos);
+    ASSERT_NE(stats.find("arenas[0]:"), std::string::npos) << stats;
 }
 
 } // anonymous namespace
@@ -64,41 +65,41 @@ void check_arena_marks(const std::string &stats)
 TEST(je_ctl_test, dump_summary_stats)
 {
     std::string stats;
-    je_dump_stats(je_stats_type::SUMMARY_STATS, stats);
+    NO_FATALS(je_dump_stats(je_stats_type::SUMMARY_STATS, stats));
 
-    check_base_stats_marks_with_end(stats);
+    NO_FATALS(check_base_stats_marks_with_end(stats));
 }
 
 TEST(je_ctl_test, dump_configs)
 {
     std::string stats;
-    je_dump_stats(je_stats_type::CONFIGS, stats);
+    NO_FATALS(je_dump_stats(je_stats_type::CONFIGS, stats));
 
-    check_base_stats_marks_with_end(stats);
-    check_configs_marks(stats);
+    NO_FATALS(check_base_stats_marks_with_end(stats));
+    NO_FATALS(check_configs_marks(stats));
 }
 
 TEST(je_ctl_test, dump_brief_arena_stats)
 {
     std::string stats;
-    je_dump_stats(je_stats_type::BRIEF_ARENA_STATS, stats);
+    NO_FATALS(je_dump_stats(je_stats_type::BRIEF_ARENA_STATS, stats));
 
     // Since there may be many arenas, "End" mark is not required to be 
checked here.
-    check_base_stats_marks(stats);
-    check_arena_marks(stats);
+    NO_FATALS(check_base_stats_marks(stats));
+    NO_FATALS(check_arena_marks(stats));
 }
 
 TEST(je_ctl_test, dump_detailed_stats)
 {
     std::string stats;
-    je_dump_stats(je_stats_type::DETAILED_STATS, stats);
+    NO_FATALS(je_dump_stats(je_stats_type::DETAILED_STATS, stats));
 
     // Since there may be many arenas, "End" mark is not required to be 
checked here.
-    check_base_stats_marks(stats);
+    NO_FATALS(check_base_stats_marks(stats));
 
     // Detailed stats will contain all information, therefore everything 
should be checked.
-    check_configs_marks(stats);
-    check_arena_marks(stats);
+    NO_FATALS(check_configs_marks(stats));
+    NO_FATALS(check_arena_marks(stats));
     ASSERT_NE(stats.find("bins:"), std::string::npos);
     ASSERT_NE(stats.find("extents:"), std::string::npos);
 }


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

Reply via email to