From f47d331e671d8835de010d3e9e1cbc6379e5ec27 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 21 Apr 2017 17:41:44 +1000 Subject: [PATCH] ctdb-daemon: Add AllowMixedVersions tunable This allows to mix CTDB major versions in a single cluster. Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke Autobuild-User(master): Amitay Isaacs Autobuild-Date(master): Wed May 24 21:06:28 CEST 2017 on sn-devel-144 --- ctdb/common/tunable.c | 2 ++ ctdb/doc/ctdb-tunables.7.xml | 24 ++++++++++++++++++++++++ ctdb/protocol/protocol.h | 1 + ctdb/server/ctdb_keepalive.c | 10 ++++++++++ ctdb/tests/tool/ctdb.listvars.001.sh | 1 + 5 files changed, 38 insertions(+) diff --git a/ctdb/common/tunable.c b/ctdb/common/tunable.c index 5b640d9a902..ed7a52da153 100644 --- a/ctdb/common/tunable.c +++ b/ctdb/common/tunable.c @@ -155,6 +155,8 @@ static struct { offsetof(struct ctdb_tunable_list, queue_buffer_size) }, { "IPAllocAlgorithm", 2, false, offsetof(struct ctdb_tunable_list, ip_alloc_algorithm) }, + { "AllowMixedVersions", 0, false, + offsetof(struct ctdb_tunable_list, allow_mixed_versions) }, { NULL, 0, true, } }; diff --git a/ctdb/doc/ctdb-tunables.7.xml b/ctdb/doc/ctdb-tunables.7.xml index e3d818049cd..d0bb4508e24 100644 --- a/ctdb/doc/ctdb-tunables.7.xml +++ b/ctdb/doc/ctdb-tunables.7.xml @@ -52,6 +52,30 @@ + + AllowMixedVersions + Default: 0 + + CTDB will not allow incompatible versions to co-exist in + a cluster. If a version mismatch is found, then losing CTDB + will shutdown. To disable the incompatible version check, + set this tunable to 1. + + + For version checking, CTDB uses major and minor version. + For example, CTDB 4.6.1 and CTDB CTDB 4.6.2 are matching versions; + CTDB 4.5.x and CTDB 4.6.y do not match. + + + CTDB with version check support will lose to CTDB without + version check support. Between two different CTDB versions with + version check support, one running for less time will lose. + If the running time for both CTDB versions with version check + support is equal (to seconds), then the older version will lose. + The losing CTDB daemon will shutdown. + + + AllowUnhealthyDBRead Default: 0 diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h index 13231536917..d405ea32f71 100644 --- a/ctdb/protocol/protocol.h +++ b/ctdb/protocol/protocol.h @@ -632,6 +632,7 @@ struct ctdb_tunable_list { uint32_t rec_buffer_size_limit; uint32_t queue_buffer_size; uint32_t ip_alloc_algorithm; + uint32_t allow_mixed_versions; }; struct ctdb_tickle_list { diff --git a/ctdb/server/ctdb_keepalive.c b/ctdb/server/ctdb_keepalive.c index 1a8f0f4f76e..a4569ec2502 100644 --- a/ctdb/server/ctdb_keepalive.c +++ b/ctdb/server/ctdb_keepalive.c @@ -153,6 +153,11 @@ void ctdb_start_keepalive(struct ctdb_context *ctdb) CTDB_NO_MEMORY_FATAL(ctdb, te); DEBUG(DEBUG_NOTICE,("Keepalive monitoring has been started\n")); + + if (ctdb->tunable.allow_mixed_versions == 1) { + DEBUG(DEBUG_WARNING, + ("CTDB cluster with mixed versions configured\n")); + } } void ctdb_stop_keepalive(struct ctdb_context *ctdb) @@ -169,6 +174,11 @@ void ctdb_request_keepalive(struct ctdb_context *ctdb, uint32_t my_version = keepalive_version(); uint32_t my_uptime = keepalive_uptime(ctdb); + /* Don't check anything if mixed versions are allowed */ + if (ctdb->tunable.allow_mixed_versions == 1) { + return; + } + if (hdr->length == sizeof(struct ctdb_req_header)) { /* Old keepalive */ goto fail1; diff --git a/ctdb/tests/tool/ctdb.listvars.001.sh b/ctdb/tests/tool/ctdb.listvars.001.sh index 03e2995db9b..f6010a45c77 100755 --- a/ctdb/tests/tool/ctdb.listvars.001.sh +++ b/ctdb/tests/tool/ctdb.listvars.001.sh @@ -64,6 +64,7 @@ LockProcessesPerDB = 200 RecBufferSizeLimit = 1000000 QueueBufferSize = 1024 IPAllocAlgorithm = 2 +AllowMixedVersions = 0 EOF simple_test -- 2.34.1