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 2020/11/20 04:19:01 UTC
[kudu] branch master updated: KUDU-2612 flag for txn status table's
replication factor
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 0c6afda KUDU-2612 flag for txn status table's replication factor
0c6afda is described below
commit 0c6afda4ce30703fdb49248d0ac4a8fdd89be466
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Thu Nov 19 14:42:50 2020 -0800
KUDU-2612 flag for txn status table's replication factor
This patch adds --txn_manager_status_table_num_replicas flag to control
the replication factor of the transaction status table. By default,
the flag is set to 3. It is a kudu-master's flag since TxnManager is
hosted by kudu-master process.
Change-Id: Ic5f76122ea1ef56f72e416ab12f6908703fc610e
Reviewed-on: http://gerrit.cloudera.org:8080/16750
Tested-by: Kudu Jenkins
Reviewed-by: Andrew Wong <aw...@cloudera.com>
---
src/kudu/client/client-test.cc | 4 ++++
src/kudu/master/txn_manager-test.cc | 4 ++++
src/kudu/master/txn_manager.cc | 8 +++++++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index 4d2a2d7..9d4c13a 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -162,6 +162,7 @@ DECLARE_int64(on_disk_size_for_testing);
DECLARE_string(location_mapping_cmd);
DECLARE_string(superuser_acl);
DECLARE_string(user_acl);
+DECLARE_uint32(txn_manager_status_table_num_replicas);
DEFINE_int32(test_scan_num_rows, 1000, "Number of rows to insert and scan");
METRIC_DECLARE_counter(block_manager_total_bytes_read);
@@ -231,6 +232,9 @@ class ClientTest : public KuduTest {
// Enable TxnManager in Kudu master.
FLAGS_txn_manager_enabled = true;
+ // Basic txn-related scenarios in this test assume there is only one
+ // replica of the transaction status table.
+ FLAGS_txn_manager_status_table_num_replicas = 1;
SetLocationMappingCmd();
diff --git a/src/kudu/master/txn_manager-test.cc b/src/kudu/master/txn_manager-test.cc
index 034ae89..6d12306 100644
--- a/src/kudu/master/txn_manager-test.cc
+++ b/src/kudu/master/txn_manager-test.cc
@@ -61,6 +61,7 @@ DECLARE_bool(txn_manager_enabled);
DECLARE_bool(txn_manager_lazily_initialized);
DECLARE_int32(rpc_service_queue_length);
DECLARE_int64(txn_manager_status_table_range_partition_span);
+DECLARE_uint32(txn_manager_status_table_num_replicas);
DECLARE_uint32(transaction_keepalive_interval_ms);
namespace kudu {
@@ -82,6 +83,9 @@ class TxnManagerTest : public KuduTest {
FLAGS_txn_manager_enabled = true;
FLAGS_txn_manager_lazily_initialized = true;
+ // In this test, there is just a single tablet servers in the cluster.
+ FLAGS_txn_manager_status_table_num_replicas = 1;
+
// Make TxnManager creating new ranges in the transaction status table more
// often, so it's not necessary to start too many transactions to see it
// switching to a new tablet of the transaction status table.
diff --git a/src/kudu/master/txn_manager.cc b/src/kudu/master/txn_manager.cc
index f67d942..7d6596d 100644
--- a/src/kudu/master/txn_manager.cc
+++ b/src/kudu/master/txn_manager.cc
@@ -73,6 +73,11 @@ DEFINE_int64(txn_manager_status_table_range_partition_span, 1000000,
TAG_FLAG(txn_manager_status_table_range_partition_span, advanced);
TAG_FLAG(txn_manager_status_table_range_partition_span, experimental);
+DEFINE_uint32(txn_manager_status_table_num_replicas, 3,
+ "Number of replicas for transaction status table");
+TAG_FLAG(txn_manager_status_table_num_replicas, advanced);
+TAG_FLAG(txn_manager_status_table_num_replicas, experimental);
+
namespace kudu {
namespace transactions {
@@ -250,7 +255,8 @@ Status TxnManager::Init() {
RETURN_NOT_OK(TxnSystemClient::Create(master_addrs, &txn_sys_client_));
DCHECK(txn_sys_client_);
auto s = txn_sys_client_->CreateTxnStatusTable(
- FLAGS_txn_manager_status_table_range_partition_span);
+ FLAGS_txn_manager_status_table_range_partition_span,
+ FLAGS_txn_manager_status_table_num_replicas);
if (!s.ok() && !s.IsAlreadyPresent()) {
// Status::OK() is expected only on the very first call to Init() before
// the transaction status table is created.