You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by zh...@apache.org on 2022/11/19 06:38:38 UTC
[kudu] 02/02: [master] set tablet_history_max_age_sec for master
This is an automated email from the ASF dual-hosted git repository.
zhangyifan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 4537be98d0542d99ecbe4674197b9d894c3eb4e5
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Fri Nov 18 15:31:57 2022 -0800
[master] set tablet_history_max_age_sec for master
This patch sets --tablet_history_max_age_sec to 300 seconds by default
for kudu-master process. Since masters always scan data at the latest
available snapshot, keeping long history of the system tablet doesn't
make much sense.
The default setting of --tablet_history_max_age_sec for tablet servers
has been set to 7 days since logical backup/restore has been
implemented, but storing that much history for system catalog doesn't
make much sense.
Change-Id: I289b68638230b71f36064b7ce61602ba9b4d3456
Reviewed-on: http://gerrit.cloudera.org:8080/19256
Tested-by: Alexey Serbin <al...@apache.org>
Reviewed-by: Yifan Zhang <ch...@163.com>
---
src/kudu/master/master_runner.cc | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/kudu/master/master_runner.cc b/src/kudu/master/master_runner.cc
index 2a2e7277d..851531257 100644
--- a/src/kudu/master/master_runner.cc
+++ b/src/kudu/master/master_runner.cc
@@ -39,6 +39,7 @@
#include "kudu/consensus/consensus.proxy.h"
#include "kudu/consensus/consensus_meta_manager.h"
#include "kudu/consensus/metadata.pb.h"
+#include "kudu/consensus/opid.pb.h"
#include "kudu/fs/fs_manager.h"
#include "kudu/gutil/macros.h"
#include "kudu/gutil/map-util.h"
@@ -52,7 +53,6 @@
#include "kudu/master/master_options.h"
#include "kudu/master/sys_catalog.h"
#include "kudu/rpc/messenger.h"
-#include "kudu/rpc/response_callback.h"
#include "kudu/rpc/rpc.h"
#include "kudu/rpc/rpc_controller.h"
#include "kudu/tablet/metadata.pb.h"
@@ -326,6 +326,7 @@ Status ClearLocalSystemCatalogAndCopy(const HostPort& src_hp) {
void SetMasterFlagDefaults() {
constexpr int32_t kDefaultRpcServiceQueueLength = 100;
+ constexpr int32_t kDefaultTabletHistoryMaxAgeSec = 300;
// Reset some default values before parsing gflags.
CHECK_NE("", SetCommandLineOptionWithMode(
@@ -346,6 +347,17 @@ void SetMasterFlagDefaults() {
"rpc_service_queue_length",
to_string(kDefaultRpcServiceQueueLength).c_str(),
SET_FLAGS_DEFAULT));
+ // Master always reads the latest data snapshot from the system catalog and
+ // never uses any specific timestatmp in past for a read snapshot. With that,
+ // here isn't much sense to keep long chain of UNDO deltas in addition to the
+ // latest version in the MVCC. Keeping short history of deltas frees CPU
+ // cycles, memory, and IO bandwidth that otherwise would be consumed by
+ // background maintenance jobs running compactions. In addition, less disk
+ // space is consumed to store the system tablet's data.
+ CHECK_NE("", SetCommandLineOptionWithMode(
+ "tablet_history_max_age_sec",
+ to_string(kDefaultTabletHistoryMaxAgeSec).c_str(),
+ SET_FLAGS_DEFAULT));
// Setting the default value of the 'force_block_cache_capacity' flag to
// 'false' makes the corresponding group validator enforce proper settings
// for the memory limit and the cfile cache capacity.