ctdb-daemon: Add AllowMixedVersions tunable
authorAmitay Isaacs <amitay@gmail.com>
Fri, 21 Apr 2017 07:41:44 +0000 (17:41 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 24 May 2017 19:06:28 +0000 (21:06 +0200)
This allows to mix CTDB major versions in a single cluster.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed May 24 21:06:28 CEST 2017 on sn-devel-144

ctdb/common/tunable.c
ctdb/doc/ctdb-tunables.7.xml
ctdb/protocol/protocol.h
ctdb/server/ctdb_keepalive.c
ctdb/tests/tool/ctdb.listvars.001.sh

index 5b640d9a902daf4cb8c8d7d31740e7c1ad8846b7..ed7a52da15382ab7e550e5a8e614d40ba7d37c86 100644 (file)
@@ -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, }
 };
 
index e3d818049cd8e2d1a048899384818dfbf41b2fde..d0bb4508e240753bc639ef59d45f47d7a77e5e88 100644 (file)
       </para>
     </refsect2>
 
+    <refsect2>
+      <title>AllowMixedVersions</title>
+      <para>Default: 0</para>
+      <para>
+       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.
+      </para>
+      <para>
+       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.
+      </para>
+      <para>
+       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.
+      </para>
+    </refsect2>
+
     <refsect2>
       <title>AllowUnhealthyDBRead</title>
       <para>Default: 0</para>
index 13231536917e6e7a200119c8d077375108ec9fc5..d405ea32f7143dc91f50f7d3de14bf55c1ee59d9 100644 (file)
@@ -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 {
index 1a8f0f4f76e588ee72daf2cfc6d93e34df3ac71e..a4569ec2502265af2d0ebed32e8a210339a24ad1 100644 (file)
@@ -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;
index 03e2995db9b3f0eda3b153333dcc0697c156ec3d..f6010a45c774eaad675c01e973571fdbc96b92ae 100755 (executable)
@@ -64,6 +64,7 @@ LockProcessesPerDB         = 200
 RecBufferSizeLimit         = 1000000
 QueueBufferSize            = 1024
 IPAllocAlgorithm           = 2
+AllowMixedVersions         = 0
 EOF
 
 simple_test