From 1dfb266038f6fdf971bb0ffe0726f778b986371d Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 10 Jan 2022 14:15:25 +1100 Subject: [PATCH] ctdb-config: [legacy] recmaster capability -> [cluster] leader capability Rename this configuration item and move it into the [cluster] configuration section. Update documentation to match. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/cluster/cluster_conf.c | 5 +++ ctdb/cluster/cluster_conf.h | 1 + ctdb/doc/ctdb.7.xml | 12 +++--- ctdb/doc/ctdb.conf.5.xml | 48 ++++++++++++------------ ctdb/server/ctdb_config.c | 8 ++-- ctdb/server/ctdb_config.h | 2 +- ctdb/server/ctdbd.c | 2 +- ctdb/server/legacy_conf.c | 5 --- ctdb/server/legacy_conf.h | 1 - ctdb/tests/UNIT/cunit/config_test_001.sh | 2 +- ctdb/tests/UNIT/cunit/config_test_004.sh | 14 +++++++ ctdb/tests/UNIT/cunit/config_test_006.sh | 5 --- 12 files changed, 57 insertions(+), 48 deletions(-) diff --git a/ctdb/cluster/cluster_conf.c b/ctdb/cluster/cluster_conf.c index 3b86bad80ef..c2fd3e1fe78 100644 --- a/ctdb/cluster/cluster_conf.c +++ b/ctdb/cluster/cluster_conf.c @@ -155,4 +155,9 @@ void cluster_conf_init(struct conf_context *conf) CLUSTER_CONF_RECOVERY_LOCK, NULL, validate_recovery_lock); + conf_define_boolean(conf, + CLUSTER_CONF_SECTION, + CLUSTER_CONF_LEADER_CAPABILITY, + true, + NULL); } diff --git a/ctdb/cluster/cluster_conf.h b/ctdb/cluster/cluster_conf.h index cdd42e15b7d..32334f1a5b4 100644 --- a/ctdb/cluster/cluster_conf.h +++ b/ctdb/cluster/cluster_conf.h @@ -28,6 +28,7 @@ #define CLUSTER_CONF_NODE_ADDRESS "node address" #define CLUSTER_CONF_CLUSTER_LOCK "cluster lock" #define CLUSTER_CONF_RECOVERY_LOCK "recovery lock" +#define CLUSTER_CONF_LEADER_CAPABILITY "leader capability" void cluster_conf_init(struct conf_context *conf); diff --git a/ctdb/doc/ctdb.7.xml b/ctdb/doc/ctdb.7.xml index 6b5391e9d44..74ec421a526 100644 --- a/ctdb/doc/ctdb.7.xml +++ b/ctdb/doc/ctdb.7.xml @@ -478,11 +478,11 @@ Node 3:/usr/local/etc/ctdb/public_addresses - RECMASTER + LEADER - Indicates that a node can become the CTDB cluster recovery - master. The current recovery master is decided via an + Indicates that a node can become the CTDB cluster leader. + The current leader is decided via an election held by all active nodes with this capability. @@ -508,7 +508,7 @@ Node 3:/usr/local/etc/ctdb/public_addresses - The RECMASTER and LMASTER capabilities can be disabled when CTDB + The LEADER and LMASTER capabilities can be disabled when CTDB is used to create a cluster spanning across WAN links. In this case CTDB acts as a WAN accelerator. @@ -1088,13 +1088,13 @@ correct CIFS semantics to clients. [legacy] lmaster capability = false - recmaster capability = false + leader capability = false Verify with the command "ctdb getcapabilities" that that node no longer - has the recmaster or the lmaster capabilities. + has the leader or the lmaster capabilities. diff --git a/ctdb/doc/ctdb.conf.5.xml b/ctdb/doc/ctdb.conf.5.xml index 910ac4102f6..ae65f8fae4b 100644 --- a/ctdb/doc/ctdb.conf.5.xml +++ b/ctdb/doc/ctdb.conf.5.xml @@ -194,6 +194,30 @@ + + leader capability = true|false + + + Indicates whether a node can become the leader + for the cluster. If this is set to + false then the node will not be able to + become the leader for the cluster. This feature + is primarily used for making a cluster span across a WAN + link and use CTDB as a WAN-accelerator. + + + Please see the REMOTE CLUSTER NODES + section in + ctdb + 7 for more + information. + + + Default: true + + + + node address = IPADDR @@ -497,30 +521,6 @@ - - recmaster capability = true|false - - - Indicates whether a node can become the recovery master - for the cluster. If this is set to - false then the node will not be able to - become the recovery master for the cluster. This feature - is primarily used for making a cluster span across a WAN - link and use CTDB as a WAN-accelerator. - - - Please see the REMOTE CLUSTER NODES - section in - ctdb - 7 for more - information. - - - Default: true - - - - lmaster capability = true|false diff --git a/ctdb/server/ctdb_config.c b/ctdb/server/ctdb_config.c index 17e697996ab..5eabf36501c 100644 --- a/ctdb/server/ctdb_config.c +++ b/ctdb/server/ctdb_config.c @@ -57,6 +57,10 @@ static void setup_config_pointers(struct conf_context *conf) CLUSTER_CONF_SECTION, CLUSTER_CONF_RECOVERY_LOCK, &ctdb_config.recovery_lock); + conf_assign_boolean_pointer(conf, + CLUSTER_CONF_SECTION, + CLUSTER_CONF_LEADER_CAPABILITY, + &ctdb_config.leader_capability); /* * Database @@ -107,10 +111,6 @@ static void setup_config_pointers(struct conf_context *conf) LEGACY_CONF_SECTION, LEGACY_CONF_REALTIME_SCHEDULING, &ctdb_config.realtime_scheduling); - conf_assign_boolean_pointer(conf, - LEGACY_CONF_SECTION, - LEGACY_CONF_RECMASTER_CAPABILITY, - &ctdb_config.recmaster_capability); conf_assign_boolean_pointer(conf, LEGACY_CONF_SECTION, LEGACY_CONF_LMASTER_CAPABILITY, diff --git a/ctdb/server/ctdb_config.h b/ctdb/server/ctdb_config.h index f079d495445..1749038617f 100644 --- a/ctdb/server/ctdb_config.h +++ b/ctdb/server/ctdb_config.h @@ -28,6 +28,7 @@ struct ctdb_config { const char *node_address; const char *cluster_lock; const char *recovery_lock; + bool leader_capability; /* Database */ const char *dbdir_volatile; @@ -44,7 +45,6 @@ struct ctdb_config { /* Legacy */ bool realtime_scheduling; - bool recmaster_capability; bool lmaster_capability; bool start_as_stopped; bool start_as_disabled; diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index e333d7cb7cb..3bb20450a7f 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -358,7 +358,7 @@ int main(int argc, const char *argv[]) if (!ctdb_config.lmaster_capability) { ctdb->capabilities &= ~CTDB_CAP_LMASTER; } - if (!ctdb_config.recmaster_capability) { + if (!ctdb_config.leader_capability) { ctdb->capabilities &= ~CTDB_CAP_RECMASTER; } diff --git a/ctdb/server/legacy_conf.c b/ctdb/server/legacy_conf.c index 5be8da0dab0..3391a3bdb54 100644 --- a/ctdb/server/legacy_conf.c +++ b/ctdb/server/legacy_conf.c @@ -57,11 +57,6 @@ void legacy_conf_init(struct conf_context *conf) LEGACY_CONF_REALTIME_SCHEDULING, true, NULL); - conf_define_boolean(conf, - LEGACY_CONF_SECTION, - LEGACY_CONF_RECMASTER_CAPABILITY, - true, - NULL); conf_define_boolean(conf, LEGACY_CONF_SECTION, LEGACY_CONF_LMASTER_CAPABILITY, diff --git a/ctdb/server/legacy_conf.h b/ctdb/server/legacy_conf.h index 5551f12d76c..b6b4b5738f6 100644 --- a/ctdb/server/legacy_conf.h +++ b/ctdb/server/legacy_conf.h @@ -25,7 +25,6 @@ #define LEGACY_CONF_SECTION "legacy" #define LEGACY_CONF_REALTIME_SCHEDULING "realtime scheduling" -#define LEGACY_CONF_RECMASTER_CAPABILITY "recmaster capability" #define LEGACY_CONF_LMASTER_CAPABILITY "lmaster capability" #define LEGACY_CONF_START_AS_STOPPED "start as stopped" #define LEGACY_CONF_START_AS_DISABLED "start as disabled" diff --git a/ctdb/tests/UNIT/cunit/config_test_001.sh b/ctdb/tests/UNIT/cunit/config_test_001.sh index b4a64ab790c..1f674a62b32 100755 --- a/ctdb/tests/UNIT/cunit/config_test_001.sh +++ b/ctdb/tests/UNIT/cunit/config_test_001.sh @@ -36,6 +36,7 @@ ok < "$conffile" < recovery lock is deprecated EOF unit_test ctdb-config -d WARNING validate + +cat > "$conffile" <