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

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new de1960871 KUDU-2501 more instrumentation for 
TestNonRandomWorkloadLoadgen
de1960871 is described below

commit de1960871a2f035cf10fde55b0269a751e3493c1
Author: Alexey Serbin <[email protected]>
AuthorDate: Sat Nov 22 21:04:42 2025 -0800

    KUDU-2501 more instrumentation for TestNonRandomWorkloadLoadgen
    
    This patch adds a bit of instrumentation to help with troubleshooting
    of the ToolTest.TestNonRandomWorkloadLoadgen scenario when it fails.
    
    Also, with this patch now all the test table's tablets are verified
    to have zero bloom filter lookups after the test workload completes:
    this is done by using '*' pattern for tablet identifier instead of
    'nullptr' in the original version.  The original version verified only
    the very first tablet in the metrics output, and that wasn't correct.
    
    Change-Id: Ia9b4a63a00ecbf9af9151fef8eead10c627688c5
    Reviewed-on: http://gerrit.cloudera.org:8080/23708
    Tested-by: Alexey Serbin <[email protected]>
    Reviewed-by: Alexey Serbin <[email protected]>
---
 src/kudu/integration-tests/cluster_itest_util.cc | 10 +++++++++-
 src/kudu/integration-tests/cluster_itest_util.h  |  4 +++-
 src/kudu/tools/kudu-tool-test.cc                 | 25 ++++++++++++++++--------
 3 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/src/kudu/integration-tests/cluster_itest_util.cc 
b/src/kudu/integration-tests/cluster_itest_util.cc
index 315530bb9..ef93f1eaf 100644
--- a/src/kudu/integration-tests/cluster_itest_util.cc
+++ b/src/kudu/integration-tests/cluster_itest_util.cc
@@ -65,6 +65,7 @@
 #include "kudu/util/net/net_util.h"
 #include "kudu/util/net/sockaddr.h"
 #include "kudu/util/pb_util.h"
+#include "kudu/util/scoped_cleanup.h"
 #include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
@@ -1249,7 +1250,8 @@ Status GetInt64Metric(const HostPort& http_hp,
                       const MetricPrototype* metric_proto,
                       const char* value_field,
                       int64_t* value,
-                      bool is_secure) {
+                      bool is_secure,
+                      faststring* raw_json_metrics) {
   *value = 0;
   bool found = false;
   // Fetch metrics whose name matches the given prototype.
@@ -1262,6 +1264,12 @@ Status GetInt64Metric(const HostPort& http_hp,
   }
   faststring dst;
   RETURN_NOT_OK(curl.FetchURL(url, &dst));
+  SCOPED_CLEANUP({
+    // Upon return, fill in the `raw_json_metrics` parameter, if necessary.
+    if (raw_json_metrics) {
+      *raw_json_metrics = std::move(dst);
+    }
+  });
 
   // Parse the results, beginning with the top-level entity array.
   JsonReader r(dst.ToString());
diff --git a/src/kudu/integration-tests/cluster_itest_util.h 
b/src/kudu/integration-tests/cluster_itest_util.h
index 8f27aeb43..5ef7cc673 100644
--- a/src/kudu/integration-tests/cluster_itest_util.h
+++ b/src/kudu/integration-tests/cluster_itest_util.h
@@ -52,6 +52,7 @@ class MetricEntityPrototype;
 class MetricPrototype;
 class MonoDelta;
 class Status;
+class faststring;
 
 namespace client {
 class KuduSchema;
@@ -451,7 +452,8 @@ Status GetInt64Metric(const HostPort& http_hp,
                       const MetricPrototype* metric_proto,
                       const char* value_field,
                       int64_t* value,
-                      bool is_secure = false);
+                      bool is_secure = false,
+                      faststring* raw_json_metrics = nullptr);
 
 // Retrieve the value of a given metric from tserver. The metric must be of
 // int64_t type.
diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc
index b8f040a92..a5518e016 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -130,6 +130,7 @@
 #include "kudu/tserver/tserver_admin.proxy.h"
 #include "kudu/util/async_util.h"
 #include "kudu/util/env.h"
+#include "kudu/util/faststring.h"
 #include "kudu/util/jsonreader.h"
 #include "kudu/util/logging_test_util.h"
 #include "kudu/util/metrics.h"
@@ -4312,7 +4313,7 @@ TEST_F(ToolTest, TestNonRandomWorkloadLoadgen) {
     };
     NO_FATALS(StartExternalMiniCluster(std::move(opts)));
   }
-  const vector<string> base_args = {
+  const vector<string> args = {
     "perf", "loadgen",
     cluster_->master()->bound_rpc_addr().ToString(),
     "--keep_auto_table",
@@ -4329,20 +4330,28 @@ TEST_F(ToolTest, TestNonRandomWorkloadLoadgen) {
     // Since we're using such large payloads, flush more frequently so the
     // client doesn't run out of memory.
     "--flush_per_n_rows=1",
+
+    // Partition the auto-created table so each thread inserts to a single 
range.
+    "--table_num_range_partitions=4",
+    "--table_num_hash_partitions=1",
   };
 
-  // Partition the table so each thread inserts to a single range.
-  vector<string> args = base_args;
-  args.emplace_back("--table_num_range_partitions=4");
-  args.emplace_back("--table_num_hash_partitions=1");
   ASSERT_OK(RunKuduTool(args));
 
   // Check that the insert workload didn't require any bloom lookups.
   ExternalTabletServer* ts = cluster_->tablet_server(0);
   int64_t bloom_lookups = 0;
-  ASSERT_OK(itest::GetInt64Metric(ts->bound_http_hostport(),
-      &METRIC_ENTITY_tablet, nullptr, &METRIC_bloom_lookups, "value", 
&bloom_lookups));
-  ASSERT_EQ(0, bloom_lookups);
+  faststring raw_metrics_output;
+  ASSERT_OK(itest::GetInt64Metric(
+      ts->bound_http_hostport(),
+      &METRIC_ENTITY_tablet,
+      "*",  // sum up accross all the tablets of the auto-created table
+      &METRIC_bloom_lookups,
+      "value",
+      &bloom_lookups,
+      /*is_secure=*/false,
+      &raw_metrics_output));
+  ASSERT_EQ(0, bloom_lookups) << raw_metrics_output.ToString();
 }
 
 TEST_F(ToolTest, TestPerfTableScan) {

Reply via email to