You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2023/03/31 22:28:46 UTC

[kudu] 02/02: KUDU-3437 Set default block_cache_metrics_policy to reset

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

commit e07c941aa6622efb758283cb2a583d0b90deb830
Author: Ádám Bakai <ab...@cloudera.com>
AuthorDate: Mon Mar 6 17:41:52 2023 +0100

    KUDU-3437 Set default block_cache_metrics_policy to reset
    
    If the master has empty local directories and connects to an existing
    cluster, it executes Master::Init twice, which executes
    StartInstrumentation twice, which is only allowed if it's a test or the
    policy is to reset the existing CacheMetrics. According to documentation
    ExistingMetricsPolicy::kKeep should only be used during tests, so the
    default value is set to kReset which fixes the original issue.
    
    Change-Id: Idc32d7ab02201382debcbe36311579550353bf71
    Reviewed-on: http://gerrit.cloudera.org:8080/19585
    Tested-by: Kudu Jenkins
    Reviewed-by: Yuqi Du <sh...@gmail.com>
    Reviewed-by: Alexey Serbin <al...@apache.org>
---
 src/kudu/master/master_options.cc | 2 +-
 src/kudu/master/mini_master.cc    | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/kudu/master/master_options.cc b/src/kudu/master/master_options.cc
index f95d2f090..73644669a 100644
--- a/src/kudu/master/master_options.cc
+++ b/src/kudu/master/master_options.cc
@@ -40,7 +40,7 @@ namespace kudu {
 namespace master {
 
 MasterOptions::MasterOptions()
-    : block_cache_metrics_policy_(Cache::ExistingMetricsPolicy::kKeep) {
+    : block_cache_metrics_policy_(Cache::ExistingMetricsPolicy::kReset) {
   rpc_opts.default_port = Master::kDefaultPort;
 
   if (!FLAGS_master_addresses.empty()) {
diff --git a/src/kudu/master/mini_master.cc b/src/kudu/master/mini_master.cc
index 19c26810d..e8bb0571f 100644
--- a/src/kudu/master/mini_master.cc
+++ b/src/kudu/master/mini_master.cc
@@ -31,6 +31,7 @@
 #include "kudu/master/master_options.h"
 #include "kudu/server/rpc_server.h"
 #include "kudu/server/webserver_options.h"
+#include "kudu/util/cache.h"
 #include "kudu/util/env.h"
 #include "kudu/util/env_util.h"
 #include "kudu/util/net/net_util.h"
@@ -59,6 +60,7 @@ MiniMaster::MiniMaster(string fs_root, HostPort rpc_bind_addr, int num_data_dirs
   opts_.rpc_opts.rpc_reuseport = true;
   opts_.webserver_opts.bind_interface = web_bind_addr.host();
   opts_.webserver_opts.port = web_bind_addr.port();
+  opts_.set_block_cache_metrics_policy(Cache::ExistingMetricsPolicy::kKeep);
   if (num_data_dirs == 1) {
     opts_.fs_opts.wal_root = fs_root_;
     opts_.fs_opts.data_roots = { fs_root_ };