You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by la...@apache.org on 2023/02/23 03:23:04 UTC

[kudu] branch master updated (9fa18d2bd -> 80009d6af)

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

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


    from 9fa18d2bd KUDU-3451 fix memory leak in scan_token-test
     new 38b864082 KUDU-3418 Improve hole punching error message description.
     new 97ec58742 [www] add slow scans show control
     new 80009d6af [compaction] support turn on/off FLAGS_enable_maintenance_manager at runtime

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/kudu/client/scan_token-test.cc   | 21 +++++++++++++++++++++
 src/kudu/fs/dir_util.cc              |  5 ++++-
 src/kudu/tserver/scanners.cc         | 24 +++++++++++++++++++-----
 src/kudu/util/maintenance_manager.cc | 20 +++++++++++++++-----
 4 files changed, 59 insertions(+), 11 deletions(-)


[kudu] 01/03: KUDU-3418 Improve hole punching error message description.

Posted by la...@apache.org.
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/kudu.git

commit 38b864082f1e230c181d89b8d1a764c6af7b7506
Author: Ashwani Raina <ar...@cloudera.com>
AuthorDate: Tue Feb 21 20:20:11 2023 +0530

    KUDU-3418 Improve hole punching error message description.
    
    Kudu LBM relies on hole punching support from filesystem.
    However, it is possible that even with supported kernel version
    and fileystem type, hole punching feature may not work.
    Hole punching uses fallocate system call to do its job.
    But it is evident from fallocate system call implementation of
    ext4, that encrypted inodes are not supported.
    Refer: https://elixir.bootlin.com/linux/latest/source/fs/ext4/extents.c#L4685
    
    The same description is added to kHolePunchErrorMsg used by
    CheckHolePunch method that checks for hole punching support.
    
    Change-Id: If87401012052508b9cdf394cd33dc32fb58659d4
    Reviewed-on: http://gerrit.cloudera.org:8080/19525
    Reviewed-by: Mahesh Reddy <mr...@cloudera.com>
    Reviewed-by: Yingchun Lai <la...@apache.org>
    Tested-by: Yingchun Lai <la...@apache.org>
---
 src/kudu/fs/dir_util.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/kudu/fs/dir_util.cc b/src/kudu/fs/dir_util.cc
index 75aa76486..fabcf80a8 100644
--- a/src/kudu/fs/dir_util.cc
+++ b/src/kudu/fs/dir_util.cc
@@ -49,7 +49,10 @@ namespace {
 
 const char kHolePunchErrorMsg[] =
     "Error during hole punch test. The log block manager requires a "
-    "filesystem with hole punching support such as ext4 or xfs. On el6, "
+    "filesystem with hole punching support such as ext4 or xfs. ext4 filesystem "
+    "does not support hole punching for encrypted inodes because encrypted "
+    "inodes can't handle collapse/insert range as it would require re-encryption "
+    "of blocks with a different tweak based on the logical block number. On el6, "
     "kernel version 2.6.32-358 or newer is required. To run without hole "
     "punching (at the cost of some efficiency and scalability), reconfigure "
     "Kudu to use the file block manager. Refer to the Kudu documentation for "


[kudu] 03/03: [compaction] support turn on/off FLAGS_enable_maintenance_manager at runtime

Posted by la...@apache.org.
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/kudu.git

commit 80009d6af30f3b19bb547efc92d6558a30d49db3
Author: shenxingwuying <sh...@gmail.com>
AuthorDate: Wed Jan 4 15:52:06 2023 +0800

    [compaction] support turn on/off FLAGS_enable_maintenance_manager at runtime
    
    Now the gflags FLAGS_enable_maintenance_manager can be on/off, it should set
    before start. So if we want to change it, we must restart tservers. But
    restarting a tablet server can sometimes be quite time consuming due to
    various factors.
    
    This patch adds ability to change FLAGS_enable_maintenance_manager at runtime,
    that can help in avoiding slow restart operations caused due to external factors.
    
    Change-Id: I7f7029b22a4c8ce58094501e71a6c22271d4f0b2
    Reviewed-on: http://gerrit.cloudera.org:8080/19398
    Tested-by: Kudu Jenkins
    Reviewed-by: Yingchun Lai <la...@apache.org>
---
 src/kudu/util/maintenance_manager.cc | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/kudu/util/maintenance_manager.cc b/src/kudu/util/maintenance_manager.cc
index 9529d1582..ec245adb8 100644
--- a/src/kudu/util/maintenance_manager.cc
+++ b/src/kudu/util/maintenance_manager.cc
@@ -44,6 +44,7 @@
 #include "kudu/util/logging.h"
 #include "kudu/util/maintenance_manager.pb.h"
 #include "kudu/util/metrics.h"
+#include "kudu/util/monotime.h"
 #include "kudu/util/process_memory.h"
 #include "kudu/util/random_util.h"
 #include "kudu/util/scoped_cleanup.h"
@@ -79,6 +80,7 @@ DEFINE_bool(enable_maintenance_manager, true,
             "Enable the maintenance manager, which runs flush, compaction, "
             "and garbage collection operations on tablets.");
 TAG_FLAG(enable_maintenance_manager, unsafe);
+TAG_FLAG(enable_maintenance_manager, runtime);
 
 DEFINE_int64(log_target_replay_size_mb, 1024,
              "The target maximum size of logs to be replayed at startup. If a tablet "
@@ -302,15 +304,23 @@ bool MaintenanceManager::disabled_for_tests() const {
 }
 
 void MaintenanceManager::RunSchedulerThread() {
-  if (!FLAGS_enable_maintenance_manager) {
-    LOG(INFO) << "Maintenance manager is disabled. Stopping thread.";
-    return;
-  }
-
   // Set to true if the scheduler runs and finds that there is no work to do.
   bool prev_iter_found_no_work = false;
 
   while (true) {
+    if (!FLAGS_enable_maintenance_manager) {
+      {
+        std::unique_lock<Mutex> guard(lock_);
+        if (shutdown_) {
+          VLOG_AND_TRACE_WITH_PREFIX("maintenance", 1) << "Shutting down maintenance manager.";
+          return;
+        }
+      }
+      KLOG_EVERY_N_SECS(INFO, 1200)
+          << "Maintenance manager is disabled (check --enable_maintenance_manager).";
+      SleepFor(polling_interval_);
+      continue;
+    }
     MaintenanceOp* op = nullptr;
     string op_note;
     {


[kudu] 02/03: [www] add slow scans show control

Posted by la...@apache.org.
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/kudu.git

commit 97ec58742182bb8175dbf38a94027f845e806926
Author: kedeng <kd...@gmail.com>
AuthorDate: Tue Feb 7 17:07:49 2023 +0800

    [www] add slow scans show control
    
    The slow scans show functionality may lead to full scanning and affecting
    normal Kudu service unexpectedly. Add --show_slow_scans flag to control
    whether to show slow scans on the /scans page of web and record the
    slow scans in the log.
    
    The default value of the flag --show_slow_scans is false, which means
    slow scans show is disabled by default.
    
    Change-Id: Ia96f80561a4c889cbdd1c6dc992184981be86fb6
    Reviewed-on: http://gerrit.cloudera.org:8080/19480
    Reviewed-by: Yingchun Lai <la...@apache.org>
    Tested-by: Kudu Jenkins
---
 src/kudu/client/scan_token-test.cc | 21 +++++++++++++++++++++
 src/kudu/tserver/scanners.cc       | 24 +++++++++++++++++++-----
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/src/kudu/client/scan_token-test.cc b/src/kudu/client/scan_token-test.cc
index 165190fe7..0caba95ec 100644
--- a/src/kudu/client/scan_token-test.cc
+++ b/src/kudu/client/scan_token-test.cc
@@ -75,6 +75,7 @@
 DECLARE_bool(tserver_enforce_access_control);
 DECLARE_int32(scanner_inject_latency_on_each_batch_ms);
 DECLARE_int32(slow_scanner_threshold_ms);
+DECLARE_bool(show_slow_scans);
 
 METRIC_DECLARE_histogram(handler_latency_kudu_master_MasterService_GetTableSchema);
 METRIC_DECLARE_histogram(handler_latency_kudu_master_MasterService_GetTableLocations);
@@ -367,6 +368,10 @@ class ScanTokenTest : public KuduTest {
 };
 
 TEST_F(ScanTokenTest, SlowScansListTest) {
+  // Slow scans show is disabled by default.
+  ASSERT_FALSE(FLAGS_show_slow_scans);
+  FLAGS_show_slow_scans = true;
+
   constexpr const char* const kTableName = "slow_scans_show";
   // Create schema
   KuduSchema schema;
@@ -418,6 +423,22 @@ TEST_F(ScanTokenTest, SlowScansListTest) {
     ASSERT_EQ(2, GetCompletedScansCount());
     ASSERT_EQ(1, GetSlowScansCount());
   }
+
+  {
+    // Disable the slow scans show.
+    FLAGS_show_slow_scans = false;
+    vector<KuduScanToken*> tokens;
+    ElementDeleter deleter(&tokens);
+    ASSERT_OK(KuduScanTokenBuilder(table.get()).Build(&tokens));
+
+    // Create a slow scan scenarios.
+    FLAGS_scanner_inject_latency_on_each_batch_ms = 50;
+    FLAGS_slow_scanner_threshold_ms = 40;
+    ASSERT_EQ(200, CountRows(tokens));
+    ASSERT_EQ(3, GetCompletedScansCount());
+    // If disable the slow scans, we can only get 0, which represents the count of slow scans.
+    ASSERT_EQ(0, GetSlowScansCount());
+  }
 }
 
 TEST_F(ScanTokenTest, TestScanTokens) {
diff --git a/src/kudu/tserver/scanners.cc b/src/kudu/tserver/scanners.cc
index d68aa161b..d28f1a4aa 100644
--- a/src/kudu/tserver/scanners.cc
+++ b/src/kudu/tserver/scanners.cc
@@ -65,8 +65,13 @@ DEFINE_int32(completed_scan_history_count, 10,
              "latest scans will be shown on the tablet server's scans dashboard.");
 TAG_FLAG(completed_scan_history_count, experimental);
 
-// TODO(kedeng) : Add flag to control the display of slow scans, and avoid full scanning
-//                affecting normal Kudu service without perception.
+DEFINE_bool(show_slow_scans, false,
+            "Whether to show slow scans on the /scans page of web or record it in the log. "
+            "Please note that once set to true, full table scans may occur, which may affect "
+            "the normal Kudu service unexpectedly.");
+TAG_FLAG(show_slow_scans, advanced);
+TAG_FLAG(show_slow_scans, runtime);
+
 DEFINE_int32(slow_scanner_threshold_ms, 60 * 1000L, // 1 minute
              "Number of milliseconds for the threshold of slow scan.");
 TAG_FLAG(slow_scanner_threshold_ms, advanced);
@@ -171,7 +176,12 @@ void ScannerManager::RunCollectAndRemovalThread() {
       }
       shutdown_cv_.WaitFor(MonoDelta::FromMicroseconds(FLAGS_scanner_gc_check_interval_us));
     }
-    CollectSlowScanners();
+
+    if (FLAGS_show_slow_scans) {
+      // Control the collection of slow scans to avoid full scanning affecting normal Kudu
+      // service without perception.
+      CollectSlowScanners();
+    }
     RemoveExpiredScanners();
   }
 }
@@ -315,6 +325,12 @@ vector<SharedScanDescriptor> ScannerManager::ListScans() const {
 }
 
 vector<SharedScanDescriptor> ScannerManager::ListSlowScans() const {
+  vector<SharedScanDescriptor> ret;
+  if (!FLAGS_show_slow_scans) {
+    LOG(INFO) << "Slow scans show is disabled. Set --show_slow_scans to enable it.";
+    return ret;
+  }
+
   // Get all the scans first.
   unordered_map<string, SharedScanDescriptor> scans;
   {
@@ -324,7 +340,6 @@ vector<SharedScanDescriptor> ScannerManager::ListSlowScans() const {
     }
   }
 
-  vector<SharedScanDescriptor> ret;
   ret.reserve(scans.size());
   AppendValuesFromMap(scans, &ret);
 
@@ -357,7 +372,6 @@ void ScannerManager::CollectSlowScanners() {
 
       MonoDelta delta_time = now - start_time -
           MonoDelta::FromMilliseconds(slow_scanner_threshold);
-      // TODO(kedeng) : Add flag to control whether to print this log.
       LOG(INFO) << Substitute(
           "Slow scanner id: $0, of tablet $1, "
           "exceed the time threshold $2 ms for $3 ms.",