The Samba-Bugzilla – Attachment 14448 Details for
Bug 13589
Fix CTDB configuration issues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patches for 4.9.x
BZ13589-v4-9.patch (text/plain), 55.14 KB, created by
Amitay Isaacs
on 2018-08-27 05:29:28 UTC
(
hide
)
Description:
Patches for 4.9.x
Filename:
MIME Type:
Creator:
Amitay Isaacs
Created:
2018-08-27 05:29:28 UTC
Size:
55.14 KB
patch
obsolete
>From 000845750579e8ef458259c7e1a3579695594bbd Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 20 Aug 2018 13:38:25 +1000 >Subject: [PATCH 01/17] ctdb-doc: Make config migration script notice removed > CTDB_BASE option > >This should never have been a user-level option, but some people used >it. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit d4afb60a24b932a0b7a0c2f27526f41d0bf38fc2) >--- > ctdb/doc/examples/config_migrate.sh | 1 + > ctdb/doc/examples/config_migrate.test_input | 2 ++ > 2 files changed, 3 insertions(+) > >diff --git a/ctdb/doc/examples/config_migrate.sh b/ctdb/doc/examples/config_migrate.sh >index 8eefd031a79..d9d71da39a2 100755 >--- a/ctdb/doc/examples/config_migrate.sh >+++ b/ctdb/doc/examples/config_migrate.sh >@@ -155,6 +155,7 @@ check_removed_option () > _option="$1" > > grep -Fqx "$_option" <<EOF >+CTDB_BASE > CTDB_PIDFILE > CTDB_SOCKET > CTDB_EVENT_SCRIPT_DIR >diff --git a/ctdb/doc/examples/config_migrate.test_input b/ctdb/doc/examples/config_migrate.test_input >index 593ca4c697c..6c4b5a239f6 100644 >--- a/ctdb/doc/examples/config_migrate.test_input >+++ b/ctdb/doc/examples/config_migrate.test_input >@@ -1,3 +1,5 @@ >+CTDB_BASE="/etc/ctdb" >+ > CTDB_RECOVERY_LOCK="/some/place/on/shared/storage" > > CTDB_NODES="/etc/ctdb/nodes" >-- >2.17.1 > > >From b95a1d0e3b1fd75edd2a07d99b5f815c9af4c464 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 20 Aug 2018 13:29:52 +1000 >Subject: [PATCH 02/17] ctdb-doc: Handle boolean options in config migration > more carefully > >Values for ctdb.conf options are now returned by >get_ctdb_conf_option(). The main goal is to allow old boolean options >to be replaced by new logically negated options. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 64d4a7ae5ac3aed2b1b9e7ab85c372e6900826ac) >--- > ctdb/doc/examples/config_migrate.sh | 56 ++++++++++++++++------------- > 1 file changed, 31 insertions(+), 25 deletions(-) > >diff --git a/ctdb/doc/examples/config_migrate.sh b/ctdb/doc/examples/config_migrate.sh >index d9d71da39a2..00896577aad 100755 >--- a/ctdb/doc/examples/config_migrate.sh >+++ b/ctdb/doc/examples/config_migrate.sh >@@ -109,33 +109,44 @@ out_file_remove_if_empty () > # script > # > >-# Convert a ctdbd.conf opt+val into a ctdb.conf section+opt >+# Convert a ctdbd.conf opt+val into a ctdb.conf section+opt+val > # > # If opt is matched and val is empty then output is printed, allowing > # this function to be reused to check if opt is valid. >+# >+# Note that for boolean options, the expected value and the new value >+# form part of the data. > get_ctdb_conf_option () > { > _opt="$1" > _val="$2" > > awk -v opt="${_opt}" -v val="${_val}" \ >- '$3 == opt { if (!$4 || !val || val ==$4) { print $1, $2 } }' <<EOF >-cluster node-address CTDB_NODE_ADDRESS >-cluster recovery-lock CTDB_RECOVERY_LOCK >-cluster transport CTDB_TRANSPORT >-database lock-debug-script CTDB_DEBUG_LOCKS >-database persistent-database-directory CTDB_DBDIR_PERSISTENT >-database state-database-directory CTDB_DBDIR_STATE >-database volatile-database-directory CTDB_DBDIR >-event debug-script CTDB_DEBUG_HUNG_SCRIPT >-legacy lmaster-capability CTDB_CAPABILITY_LMASTER no >-legacy no-realtime CTDB_NOSETSCHED yes >-legacy recmaster-capability CTDB_CAPABILITY_RECMASTER no >-legacy script-log-level CTDB_SCRIPT_LOG_LEVEL >-legacy start-as-disabled CTDB_START_AS_DISABLED yes >-legacy start-as-stopped CTDB_START_AS_STOPPED yes >-logging location CTDB_LOGGING >-logging log-level CTDB_DEBUGLEVEL >+ '$3 == opt { >+ if (!$4 || !val || val == $4) { >+ if ($5) { >+ print $1, $2, $5 >+ } else { >+ print $1, $2, val >+ } >+ } >+ }' <<EOF >+cluster node-address CTDB_NODE_ADDRESS >+cluster recovery-lock CTDB_RECOVERY_LOCK >+cluster transport CTDB_TRANSPORT >+database lock-debug-script CTDB_DEBUG_LOCKS >+database persistent-database-directory CTDB_DBDIR_PERSISTENT >+database state-database-directory CTDB_DBDIR_STATE >+database volatile-database-directory CTDB_DBDIR >+event debug-script CTDB_DEBUG_HUNG_SCRIPT >+legacy lmaster-capability CTDB_CAPABILITY_LMASTER no false >+legacy no-realtime CTDB_NOSETSCHED yes true >+legacy recmaster-capability CTDB_CAPABILITY_RECMASTER no false >+legacy script-log-level CTDB_SCRIPT_LOG_LEVEL >+legacy start-as-disabled CTDB_START_AS_DISABLED yes true >+legacy start-as-stopped CTDB_START_AS_STOPPED yes true >+logging location CTDB_LOGGING >+logging log-level CTDB_DEBUGLEVEL > EOF > > } >@@ -502,18 +513,13 @@ build_ctdb_conf () > continue > fi > >- # ctdb.conf needs true/false, not yes/no >- case "$_val" in >- yes) _val="true" ;; >- no) _val="false" ;; >- esac >- > # $_out is section and key, replace dashes with spaces > # Intentional word splitting > # shellcheck disable=SC2086 > set -- $_out > _section=$(echo "$1" | sed -e 's|-| |g') > _key=$(echo "$2" | sed -e 's|-| |g') >+ _newval="$3" > > if ! grep -Fqx "[${_section}]" "$_out_file" ; then > # Add blank line if file is not empty >@@ -526,7 +532,7 @@ build_ctdb_conf () > > # Must escape leading TAB or sed eats it > sed -i -e "/\\[${_section}\\]/a\ >-\\ ${_key} = ${_val} >+\\ ${_key} = ${_newval} > " "$_out_file" > > done >-- >2.17.1 > > >From cf1b27023fc4cdae954a977a93b416b57c6a4af0 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 20 Aug 2018 13:35:33 +1000 >Subject: [PATCH 03/17] ctdb-config: Change option "no realtime" option to > "realtime scheduling" > >Negative options can be confusing, so switch to a positive option. > >This was supposed to be done months ago but was forgotten. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 17068e756b9e46f7a6c77d533ef1777173bb3795) >--- > ctdb/doc/ctdb.conf.5.xml | 6 +++--- > ctdb/server/ctdb_config.c | 4 ++-- > ctdb/server/ctdb_config.h | 2 +- > ctdb/server/ctdbd.c | 2 +- > ctdb/server/legacy_conf.c | 4 ++-- > ctdb/server/legacy_conf.h | 2 +- > ctdb/tests/cunit/config_test_001.sh | 2 +- > ctdb/tests/cunit/config_test_006.sh | 4 ++-- > 8 files changed, 13 insertions(+), 13 deletions(-) > >diff --git a/ctdb/doc/ctdb.conf.5.xml b/ctdb/doc/ctdb.conf.5.xml >index bcb67b35795..840d46d86a3 100644 >--- a/ctdb/doc/ctdb.conf.5.xml >+++ b/ctdb/doc/ctdb.conf.5.xml >@@ -436,17 +436,17 @@ > </varlistentry> > > <varlistentry> >- <term>no realtime = true|false</term> >+ <term>realtime scheduling = true|false</term> > <listitem> > <para> > Usually CTDB runs with real-time priority. This helps it > to perform effectively on a busy system, such as when > there are thousands of Samba clients. If you are running > CTDB on a platform that does not support real-time >- priority, you can set this to <literal>true</literal>. >+ priority, you can set this to <literal>false</literal>. > </para> > <para> >- Default: <literal>false</literal> >+ Default: <literal>true</literal> > </para> > </listitem> > </varlistentry> >diff --git a/ctdb/server/ctdb_config.c b/ctdb/server/ctdb_config.c >index 58bf975abfd..1254a996b3b 100644 >--- a/ctdb/server/ctdb_config.c >+++ b/ctdb/server/ctdb_config.c >@@ -88,8 +88,8 @@ static void setup_config_pointers(struct conf_context *conf) > > conf_assign_boolean_pointer(conf, > LEGACY_CONF_SECTION, >- LEGACY_CONF_NO_REALTIME, >- &ctdb_config.no_realtime); >+ LEGACY_CONF_REALTIME_SCHEDULING, >+ &ctdb_config.realtime_scheduling); > conf_assign_boolean_pointer(conf, > LEGACY_CONF_SECTION, > LEGACY_CONF_RECMASTER_CAPABILITY, >diff --git a/ctdb/server/ctdb_config.h b/ctdb/server/ctdb_config.h >index 51342a4a269..1c06e83f6c7 100644 >--- a/ctdb/server/ctdb_config.h >+++ b/ctdb/server/ctdb_config.h >@@ -38,7 +38,7 @@ struct ctdb_config { > const char *event_debug_script; > > /* Legacy */ >- bool no_realtime; >+ bool realtime_scheduling; > bool recmaster_capability; > bool lmaster_capability; > bool start_as_stopped; >diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c >index bfdc5e032eb..ef829e5b233 100644 >--- a/ctdb/server/ctdbd.c >+++ b/ctdb/server/ctdbd.c >@@ -328,7 +328,7 @@ int main(int argc, const char *argv[]) > ctdb->capabilities &= ~CTDB_CAP_RECMASTER; > } > >- ctdb->do_setsched = !ctdb_config.no_realtime; >+ ctdb->do_setsched = ctdb_config.realtime_scheduling; > > /* > * Miscellaneous setup >diff --git a/ctdb/server/legacy_conf.c b/ctdb/server/legacy_conf.c >index c435dae3dfb..5be8da0dab0 100644 >--- a/ctdb/server/legacy_conf.c >+++ b/ctdb/server/legacy_conf.c >@@ -54,8 +54,8 @@ void legacy_conf_init(struct conf_context *conf) > > conf_define_boolean(conf, > LEGACY_CONF_SECTION, >- LEGACY_CONF_NO_REALTIME, >- false, >+ LEGACY_CONF_REALTIME_SCHEDULING, >+ true, > NULL); > conf_define_boolean(conf, > LEGACY_CONF_SECTION, >diff --git a/ctdb/server/legacy_conf.h b/ctdb/server/legacy_conf.h >index 6592b176df2..5551f12d76c 100644 >--- a/ctdb/server/legacy_conf.h >+++ b/ctdb/server/legacy_conf.h >@@ -24,7 +24,7 @@ > > #define LEGACY_CONF_SECTION "legacy" > >-#define LEGACY_CONF_NO_REALTIME "no realtime" >+#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" >diff --git a/ctdb/tests/cunit/config_test_001.sh b/ctdb/tests/cunit/config_test_001.sh >index a3ddaabc09b..27e88888270 100755 >--- a/ctdb/tests/cunit/config_test_001.sh >+++ b/ctdb/tests/cunit/config_test_001.sh >@@ -43,7 +43,7 @@ ok <<EOF > [event] > # debug script = > [legacy] >- # no realtime = false >+ # realtime scheduling = true > # recmaster capability = true > # lmaster capability = true > # start as stopped = false >diff --git a/ctdb/tests/cunit/config_test_006.sh b/ctdb/tests/cunit/config_test_006.sh >index bfbd917221c..d367cd48c2e 100755 >--- a/ctdb/tests/cunit/config_test_006.sh >+++ b/ctdb/tests/cunit/config_test_006.sh >@@ -19,9 +19,9 @@ cat > "$conffile" <<EOF > EOF > > ok <<EOF >-false >+true > EOF >-unit_test ctdb-config get "legacy" "no realtime" >+unit_test ctdb-config get "legacy" "realtime scheduling" > > ok <<EOF > true >-- >2.17.1 > > >From bf1ae97104ea4e049125f92f52ae58e0583eae7b Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 21 Aug 2018 13:45:32 +1000 >Subject: [PATCH 04/17] ctdb-doc: Change option "no realtime" option to > "realtime scheduling" > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 43adcd717cee689c2d0386bd2aa2878006aa9217) >--- > ctdb/doc/examples/config_migrate.sh | 2 +- > ctdb/doc/examples/config_migrate.test_input | 2 ++ > 2 files changed, 3 insertions(+), 1 deletion(-) > >diff --git a/ctdb/doc/examples/config_migrate.sh b/ctdb/doc/examples/config_migrate.sh >index 00896577aad..db78c486301 100755 >--- a/ctdb/doc/examples/config_migrate.sh >+++ b/ctdb/doc/examples/config_migrate.sh >@@ -140,7 +140,7 @@ database state-database-directory CTDB_DBDIR_STATE > database volatile-database-directory CTDB_DBDIR > event debug-script CTDB_DEBUG_HUNG_SCRIPT > legacy lmaster-capability CTDB_CAPABILITY_LMASTER no false >-legacy no-realtime CTDB_NOSETSCHED yes true >+legacy realtime-scheduling CTDB_NOSETSCHED yes false > legacy recmaster-capability CTDB_CAPABILITY_RECMASTER no false > legacy script-log-level CTDB_SCRIPT_LOG_LEVEL > legacy start-as-disabled CTDB_START_AS_DISABLED yes true >diff --git a/ctdb/doc/examples/config_migrate.test_input b/ctdb/doc/examples/config_migrate.test_input >index 6c4b5a239f6..3d8131497fa 100644 >--- a/ctdb/doc/examples/config_migrate.test_input >+++ b/ctdb/doc/examples/config_migrate.test_input >@@ -26,6 +26,8 @@ CTDB_START_AS_STOPPED="yes" > CTDB_CAPABILITY_RECMASTER="no" > CTDB_CAPABILITY_LMASTER="yes" > >+CTDB_NOSETSCHED="yes" >+ > CTDB_FOO="bar" > > CTDB_NATGW_PUBLIC_IP=10.1.1.121/24 >-- >2.17.1 > > >From 74b2fe960bc0b98507e174336fd0cc140902ef6c Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 20 Aug 2018 19:09:45 +1000 >Subject: [PATCH 05/17] ctdb-doc: Add support for migrating tunables to > ctdb.conf options > >This will become common, so will be useful to have support for. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 8ddfc26d79fda2fd0265f370a4c08dc584e6a6ac) >--- > ctdb/doc/examples/config_migrate.sh | 45 ++++++++++++++++++++++++++++- > 1 file changed, 44 insertions(+), 1 deletion(-) > >diff --git a/ctdb/doc/examples/config_migrate.sh b/ctdb/doc/examples/config_migrate.sh >index db78c486301..9b579302553 100755 >--- a/ctdb/doc/examples/config_migrate.sh >+++ b/ctdb/doc/examples/config_migrate.sh >@@ -160,6 +160,39 @@ check_ctdb_conf_option () > [ -n "$_out" ] > } > >+# Convert a ctdbd.conf tunable option into a ctdb.conf section+opt >+# >+# The difference between this and get_ctdb_conf_option() is that only >+# the tunable part of the option is passed as opt and it is matched >+# case-insensitively. >+get_ctdb_conf_tunable_option () >+{ >+ _opt="$1" >+ _val="$2" >+ >+ awk -v opt="${_opt}" -v val="${_val}" \ >+ 'tolower($3) == tolower(opt) { >+ if (!$4 || !val || (val == 0 ? 0 : 1) == $4) { >+ if ($5) { >+ print $1, $2, $5 >+ } else { >+ print $1, $2, val >+ } >+ } >+ }' <<EOF >+EOF >+ >+} >+ >+# Check if a tunable will convert to a ctdb.conf option >+check_ctdb_conf_tunable_option () >+{ >+ _opt="$1" >+ >+ _out=$(get_ctdb_conf_tunable_option "$_opt" "") >+ [ -n "$_out" ] >+} >+ > # Check if an option has been removed > check_removed_option () > { >@@ -508,7 +541,14 @@ build_ctdb_conf () > > list_options | > while read -r _opt _val ; do >- _out=$(get_ctdb_conf_option "$_opt" "$_val") >+ case "$_opt" in >+ CTDB_SET_*) >+ _opt="${_opt#CTDB_SET_}" >+ _out=$(get_ctdb_conf_tunable_option "$_opt" "$_val") >+ ;; >+ *) >+ _out=$(get_ctdb_conf_option "$_opt" "$_val") >+ esac > if [ -z "$_out" ] ; then > continue > fi >@@ -563,6 +603,9 @@ build_ctdb_tunables () > > list_tunables | > while read -r _var _val ; do >+ if check_ctdb_conf_tunable_option "$_var" ; then >+ continue >+ fi > if ! check_valid_tunable "$_var" ; then > continue > fi >-- >2.17.1 > > >From f1913d321149b6ef9d2933d7606e7a46d6ea80ff Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 20 Aug 2018 15:01:50 +1000 >Subject: [PATCH 06/17] ctdb-config: Switch tunable TDBMutexEnabled to a config > option > >Use the "database:tdb mutexes" option instead. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit f42486e8912eee45eb75d27b753bb74c3b37d80b) >--- > ctdb/common/tunable.c | 2 +- > ctdb/database/database_conf.c | 21 ++++++++++++++++++++ > ctdb/database/database_conf.h | 3 ++- > ctdb/doc/ctdb-tunables.7.xml | 11 ---------- > ctdb/doc/ctdb.1.xml | 1 - > ctdb/doc/ctdb.conf.5.xml | 17 ++++++++++++++++ > ctdb/server/ctdb_config.c | 4 ++++ > ctdb/server/ctdb_config.h | 1 + > ctdb/server/ctdb_ltdb_server.c | 7 +++++-- > ctdb/tests/cunit/config_test_001.sh | 1 + > ctdb/tests/eventscripts/00.ctdb.setup.002.sh | 2 -- > ctdb/tests/eventscripts/scripts/00.ctdb.sh | 1 - > ctdb/tests/tool/ctdb.listvars.001.sh | 1 - > 13 files changed, 52 insertions(+), 20 deletions(-) > >diff --git a/ctdb/common/tunable.c b/ctdb/common/tunable.c >index 4c1714cee2d..e9367980753 100644 >--- a/ctdb/common/tunable.c >+++ b/ctdb/common/tunable.c >@@ -145,7 +145,7 @@ static struct { > offsetof(struct ctdb_tunable_list, no_ip_host_on_all_disabled) }, > { "Samba3AvoidDeadlocks", 0, true, > offsetof(struct ctdb_tunable_list, samba3_hack) }, >- { "TDBMutexEnabled", 1, false, >+ { "TDBMutexEnabled", 1, true, > offsetof(struct ctdb_tunable_list, mutex_enabled) }, > { "LockProcessesPerDB", 200, false, > offsetof(struct ctdb_tunable_list, lock_processes_per_db) }, >diff --git a/ctdb/database/database_conf.c b/ctdb/database/database_conf.c >index 0333ce0a0a5..6bdb372bf03 100644 >--- a/ctdb/database/database_conf.c >+++ b/ctdb/database/database_conf.c >@@ -54,6 +54,22 @@ static bool check_static_string_change(const char *key, > return true; > } > >+static bool check_static_boolean_change(const char *key, >+ bool old_value, >+ bool new_value, >+ enum conf_update_mode mode) >+{ >+ if (mode == CONF_MODE_RELOAD || CONF_MODE_API) { >+ if (old_value != new_value) { >+ D_WARNING("Ignoring update of [%s] -> %s\n", >+ DATABASE_CONF_SECTION, >+ key); >+ } >+ } >+ >+ return true; >+} >+ > static bool database_conf_validate_lock_debug_script(const char *key, > const char *old_script, > const char *new_script, >@@ -141,4 +157,9 @@ void database_conf_init(struct conf_context *conf) > DATABASE_CONF_LOCK_DEBUG_SCRIPT, > NULL, > database_conf_validate_lock_debug_script); >+ conf_define_boolean(conf, >+ DATABASE_CONF_SECTION, >+ DATABASE_CONF_TDB_MUTEXES, >+ true, >+ check_static_boolean_change); > } >diff --git a/ctdb/database/database_conf.h b/ctdb/database/database_conf.h >index 4891b0053b6..6fa579c1502 100644 >--- a/ctdb/database/database_conf.h >+++ b/ctdb/database/database_conf.h >@@ -27,7 +27,8 @@ > #define DATABASE_CONF_VOLATILE_DB_DIR "volatile database directory" > #define DATABASE_CONF_PERSISTENT_DB_DIR "persistent database directory" > #define DATABASE_CONF_STATE_DB_DIR "state database directory" >-#define DATABASE_CONF_LOCK_DEBUG_SCRIPT "lock debug script" >+#define DATABASE_CONF_LOCK_DEBUG_SCRIPT "lock debug script" >+#define DATABASE_CONF_TDB_MUTEXES "tdb mutexes" > > void database_conf_init(struct conf_context *conf); > >diff --git a/ctdb/doc/ctdb-tunables.7.xml b/ctdb/doc/ctdb-tunables.7.xml >index a925ca5ab1f..db3dd209760 100644 >--- a/ctdb/doc/ctdb-tunables.7.xml >+++ b/ctdb/doc/ctdb-tunables.7.xml >@@ -660,17 +660,6 @@ MonitorInterval=20 > </para> > </refsect2> > >- <refsect2> >- <title>TDBMutexEnabled</title> >- <para>Default: 1</para> >- <para> >- This parameter enables TDB_MUTEX_LOCKING feature on volatile >- databases if the robust mutexes are supported. This optimizes the >- record locking using robust mutexes and is much more efficient >- that using posix locks. >- </para> >- </refsect2> >- > <refsect2> > <title>TickleUpdateInterval</title> > <para>Default: 20</para> >diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml >index 5c3ce410c0c..da699ff89f0 100644 >--- a/ctdb/doc/ctdb.1.xml >+++ b/ctdb/doc/ctdb.1.xml >@@ -828,7 +828,6 @@ DBRecordCountWarn = 100000 > DBRecordSizeWarn = 10000000 > DBSizeWarn = 100000000 > PullDBPreallocation = 10485760 >-TDBMutexEnabled = 1 > LockProcessesPerDB = 200 > RecBufferSizeLimit = 1000000 > QueueBufferSize = 1024 >diff --git a/ctdb/doc/ctdb.conf.5.xml b/ctdb/doc/ctdb.conf.5.xml >index 840d46d86a3..316ac7f469d 100644 >--- a/ctdb/doc/ctdb.conf.5.xml >+++ b/ctdb/doc/ctdb.conf.5.xml >@@ -304,6 +304,23 @@ > </listitem> > </varlistentry> > >+ <varlistentry> >+ <term>tdb mutexes = true|false</term> >+ <listitem> >+ <para> >+ This parameter enables TDB_MUTEX_LOCKING feature on >+ volatile databases if the robust mutexes are >+ supported. This optimizes the record locking using robust >+ mutexes and is much more efficient that using posix locks. >+ </para> >+ <para> >+ If robust mutexes are unreliable on the platform being >+ used then they can be disabled by setting this to >+ <literal>false</literal>. >+ </para> >+ </listitem> >+ </varlistentry> >+ > <varlistentry> > <term>lock debug script = <parameter>FILENAME</parameter></term> > <listitem> >diff --git a/ctdb/server/ctdb_config.c b/ctdb/server/ctdb_config.c >index 1254a996b3b..f00c3268085 100644 >--- a/ctdb/server/ctdb_config.c >+++ b/ctdb/server/ctdb_config.c >@@ -73,6 +73,10 @@ static void setup_config_pointers(struct conf_context *conf) > DATABASE_CONF_SECTION, > DATABASE_CONF_LOCK_DEBUG_SCRIPT, > &ctdb_config.lock_debug_script); >+ conf_assign_boolean_pointer(conf, >+ DATABASE_CONF_SECTION, >+ DATABASE_CONF_TDB_MUTEXES, >+ &ctdb_config.tdb_mutexes); > > /* > * Event >diff --git a/ctdb/server/ctdb_config.h b/ctdb/server/ctdb_config.h >index 1c06e83f6c7..65c6547258d 100644 >--- a/ctdb/server/ctdb_config.h >+++ b/ctdb/server/ctdb_config.h >@@ -33,6 +33,7 @@ struct ctdb_config { > const char *dbdir_persistent; > const char *dbdir_state; > const char *lock_debug_script; >+ bool tdb_mutexes; > > /* Event */ > const char *event_debug_script; >diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c >index f3f7df97ac6..2d1daafb157 100644 >--- a/ctdb/server/ctdb_ltdb_server.c >+++ b/ctdb/server/ctdb_ltdb_server.c >@@ -41,6 +41,8 @@ > #include "common/common.h" > #include "common/logging.h" > >+#include "server/ctdb_config.h" >+ > #define PERSISTENT_HEALTH_TDB "persistent_health.tdb" > > /** >@@ -846,8 +848,9 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, > ctdb->db_directory, > db_name, ctdb->pnn); > >- tdb_flags = ctdb_db_tdb_flags(db_flags, ctdb->valgrinding, >- ctdb->tunable.mutex_enabled); >+ tdb_flags = ctdb_db_tdb_flags(db_flags, >+ ctdb->valgrinding, >+ ctdb_config.tdb_mutexes); > > again: > ctdb_db->ltdb = tdb_wrap_open(ctdb_db, ctdb_db->db_path, >diff --git a/ctdb/tests/cunit/config_test_001.sh b/ctdb/tests/cunit/config_test_001.sh >index 27e88888270..74686cac9b9 100755 >--- a/ctdb/tests/cunit/config_test_001.sh >+++ b/ctdb/tests/cunit/config_test_001.sh >@@ -40,6 +40,7 @@ ok <<EOF > # persistent database directory = ${database_persistent_dbdir} > # state database directory = ${database_state_dbdir} > # lock debug script = >+ # tdb mutexes = true > [event] > # debug script = > [legacy] >diff --git a/ctdb/tests/eventscripts/00.ctdb.setup.002.sh b/ctdb/tests/eventscripts/00.ctdb.setup.002.sh >index fc1ec76996a..10bddea1549 100755 >--- a/ctdb/tests/eventscripts/00.ctdb.setup.002.sh >+++ b/ctdb/tests/eventscripts/00.ctdb.setup.002.sh >@@ -8,12 +8,10 @@ setup > > setup_tunable_config <<EOF > MonitorInterval=5 >-TDBMutexEnabled=0 > EOF > > required_result 0 <<EOF > Set MonitorInterval to 5 >-Set TDBMutexEnabled to 0 > EOF > > simple_test >diff --git a/ctdb/tests/eventscripts/scripts/00.ctdb.sh b/ctdb/tests/eventscripts/scripts/00.ctdb.sh >index 5f169e6c6ea..7925679cc47 100644 >--- a/ctdb/tests/eventscripts/scripts/00.ctdb.sh >+++ b/ctdb/tests/eventscripts/scripts/00.ctdb.sh >@@ -8,7 +8,6 @@ setup () > > export FAKE_CTDB_TUNABLES_OK=" > MonitorInterval >- TDBMutexEnabled > DatabaseHashSize > " > export FAKE_CTDB_TUNABLES_OBSOLETE=" >diff --git a/ctdb/tests/tool/ctdb.listvars.001.sh b/ctdb/tests/tool/ctdb.listvars.001.sh >index e9fb686e191..95b6c3133f9 100755 >--- a/ctdb/tests/tool/ctdb.listvars.001.sh >+++ b/ctdb/tests/tool/ctdb.listvars.001.sh >@@ -58,7 +58,6 @@ DBRecordCountWarn = 100000 > DBRecordSizeWarn = 10000000 > DBSizeWarn = 100000000 > PullDBPreallocation = 10485760 >-TDBMutexEnabled = 1 > LockProcessesPerDB = 200 > RecBufferSizeLimit = 1000000 > QueueBufferSize = 1024 >-- >2.17.1 > > >From 122b191b849eb8ea5760cafeff73eb814575a84d Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 21 Aug 2018 13:51:40 +1000 >Subject: [PATCH 07/17] ctdb-doc: Switch tunable TDBMutexEnabled to a config > option > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit a9758f413d06b0d114f4e5a0e053bbc8956c60b7) >--- > ctdb/doc/examples/config_migrate.sh | 1 + > ctdb/doc/examples/config_migrate.test_input | 2 +- > 2 files changed, 2 insertions(+), 1 deletion(-) > >diff --git a/ctdb/doc/examples/config_migrate.sh b/ctdb/doc/examples/config_migrate.sh >index 9b579302553..e3e30aecfeb 100755 >--- a/ctdb/doc/examples/config_migrate.sh >+++ b/ctdb/doc/examples/config_migrate.sh >@@ -180,6 +180,7 @@ get_ctdb_conf_tunable_option () > } > } > }' <<EOF >+database tdb-mutexes TDBMutexEnabled 0 false > EOF > > } >diff --git a/ctdb/doc/examples/config_migrate.test_input b/ctdb/doc/examples/config_migrate.test_input >index 3d8131497fa..947ca7c358f 100644 >--- a/ctdb/doc/examples/config_migrate.test_input >+++ b/ctdb/doc/examples/config_migrate.test_input >@@ -36,7 +36,7 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.1.1.254 > CTDB_NATGW_PRIVATE_NETWORK=192.168.1.0/24 > CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes > >-CTDB_SET_TDBMutexEnabled=1 >+CTDB_SET_TDBMutexEnabled=0 > CTDB_SET_IPALLOCALGORITHM=0 > CTDB_SET_noiphostonalldisabled=0 > CTDB_SET_foobar=0 >-- >2.17.1 > > >From 92240dfb3243382ab9b102886ec660e2ff03c062 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 20 Aug 2018 13:43:38 +1000 >Subject: [PATCH 08/17] ctdb-common: Allow boolean configuration values to have > yes/no values > >This make the new configuration style more consistent with the old one. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 21de59ab7fe53240380b9a9a5b32d5af32d34237) >--- > ctdb/common/conf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/ctdb/common/conf.c b/ctdb/common/conf.c >index 74af7f8a048..669ac23a74b 100644 >--- a/ctdb/common/conf.c >+++ b/ctdb/common/conf.c >@@ -122,12 +122,12 @@ static int string_to_integer(const char *str, int *int_val) > > static int string_to_boolean(const char *str, bool *bool_val) > { >- if (strcasecmp(str, "true") == 0) { >+ if (strcasecmp(str, "true") == 0 || strcasecmp(str, "yes") == 0) { > *bool_val = true; > return 0; > } > >- if (strcasecmp(str, "false") == 0) { >+ if (strcasecmp(str, "false") == 0 || strcasecmp(str, "no") == 0) { > *bool_val = false; > return 0; > } >-- >2.17.1 > > >From ec5634f4af159dca8fd2fd4a19fda3898025d62d Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 21 Aug 2018 09:36:00 +1000 >Subject: [PATCH 09/17] ctdb-daemon: Pass DisableIPFailover tunable via > environment variable > >Preparation for obsoleting this tunable. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 914e9f22d85b9274871b7c7d5486354928080e51) >--- > ctdb/server/ctdb_recoverd.c | 10 +++++++++- > ctdb/server/ctdb_takeover_helper.c | 4 +++- > ctdb/tests/takeover_helper/016.sh | 4 ++-- > 3 files changed, 14 insertions(+), 4 deletions(-) > >diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c >index a081adaf6f4..6d72316e4de 100644 >--- a/ctdb/server/ctdb_recoverd.c >+++ b/ctdb/server/ctdb_recoverd.c >@@ -1127,7 +1127,7 @@ static int ctdb_takeover(struct ctdb_recoverd *rec, > { > static char prog[PATH_MAX+1] = ""; > char *arg; >- int i; >+ int i, ret; > > if (!ctdb_set_helper("takeover_helper", prog, sizeof(prog), > "CTDB_TAKEOVER_HELPER", CTDB_HELPER_BINDIR, >@@ -1149,6 +1149,14 @@ static int ctdb_takeover(struct ctdb_recoverd *rec, > } > } > >+ if (rec->ctdb->tunable.disable_ip_failover != 0) { >+ ret = setenv("CTDB_DISABLE_IP_FAILOVER", "1", 1); >+ if (ret != 0) { >+ D_ERR("Failed to set CTDB_DISABLE_IP_FAILOVER variable\n"); >+ return -1; >+ } >+ } >+ > return helper_run(rec, rec, prog, arg, "takeover"); > } > >diff --git a/ctdb/server/ctdb_takeover_helper.c b/ctdb/server/ctdb_takeover_helper.c >index 9672a2b20f9..9aa77d14f1d 100644 >--- a/ctdb/server/ctdb_takeover_helper.c >+++ b/ctdb/server/ctdb_takeover_helper.c >@@ -799,6 +799,7 @@ static void takeover_nodemap_done(struct tevent_req *subreq) > bool status; > int ret; > struct ctdb_node_map *nodemap; >+ const char *ptr; > > status = ctdb_client_control_recv(subreq, &ret, state, &reply); > TALLOC_FREE(subreq); >@@ -845,7 +846,8 @@ static void takeover_nodemap_done(struct tevent_req *subreq) > return; > } > >- if (state->tun_list->disable_ip_failover != 0) { >+ ptr = getenv("CTDB_DISABLE_IP_FAILOVER"); >+ if (ptr != NULL) { > /* IP failover is completely disabled so just send out > * ipreallocated event. > */ >diff --git a/ctdb/tests/takeover_helper/016.sh b/ctdb/tests/takeover_helper/016.sh >index 4d2e4fea209..7fbed7eb3b3 100755 >--- a/ctdb/tests/takeover_helper/016.sh >+++ b/ctdb/tests/takeover_helper/016.sh >@@ -2,7 +2,7 @@ > > . "${TEST_SCRIPTS_DIR}/unit.sh" > >-define_test "3 nodes, all healthy, IPs all unassigned, DisableIPFailover" >+define_test "3 nodes, all healthy, IPs all unassigned, IP failover disabled" > > setup_ctdbd <<EOF > NODEMAP >@@ -21,7 +21,7 @@ PUBLICIPS > 10.0.0.33 -1 > EOF > >-ctdb_cmd setvar DisableIPFailover 1 >+export CTDB_DISABLE_IP_FAILOVER=1 > > ok <<EOF > EOF >-- >2.17.1 > > >From 403d5a0d9044559743f42bc4dec3d67c6fbc9e56 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 21 Aug 2018 11:18:34 +1000 >Subject: [PATCH 10/17] ctdb-tests: Drop DisableIPFailover simple test > >This is about to become a config file option that can't be dynamically >changed at run-time, so drop this test for now. This test will be added >once the tunable becomes a config file option. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 8e160d331aaccd64b1a767c0bde9e310c80afe06) >--- > ctdb/tests/simple/19_ip_takeover_noop.sh | 29 +----------------------- > 1 file changed, 1 insertion(+), 28 deletions(-) > >diff --git a/ctdb/tests/simple/19_ip_takeover_noop.sh b/ctdb/tests/simple/19_ip_takeover_noop.sh >index c48379e5877..af0cdee383b 100755 >--- a/ctdb/tests/simple/19_ip_takeover_noop.sh >+++ b/ctdb/tests/simple/19_ip_takeover_noop.sh >@@ -3,10 +3,7 @@ > test_info() > { > cat <<EOF >-Check that CTDB operates correctly if: >- >-* DisableIPFailover is set; or >-* there are 0 public IPs configured >+Check that CTDB operates correctly if there are 0 public IPs configured > > This test only does anything with local daemons. On a real cluster it > has no way of updating configuration. >@@ -31,30 +28,6 @@ ctdb_restart_when_done > > select_test_node_and_ips > >-echo "Setting DisableIPFailover=1 on all nodes" >-try_command_on_node all $CTDB setvar DisableIPFailover 1 >- >-echo "Getting \"before\" IP allocation..." >-try_command_on_node -v any $CTDB ip all >-before="$out" >- >-echo "Disabling node ${test_node}..." >-try_command_on_node "$test_node" $CTDB disable >-wait_until_node_has_status $test_node disabled >- >-echo "Getting \"after\" IP allocation..." >-try_command_on_node -v any $CTDB ip all >-after="$out" >- >-if [ "$before" == "$after" ] ; then >- echo "GOOD: IP allocation is unchanged" >- echo >-else >- die "BAD: IP allocation changed" >-fi >- >-echo "----------------------------------------" >- > daemons_stop > > echo "Starting CTDB with an empty public addresses configuration..." >-- >2.17.1 > > >From f21b8876f57502a8f2067bcc0a3eb2561d066fc0 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 21 Aug 2018 11:30:39 +1000 >Subject: [PATCH 11/17] ctdb-failover: Add failover configuration options > >Only a "disabled" option for now. Not documented because it isn't >used yet. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 893dd623dfdec4d5c5da07f933069e4534fe58ae) >--- > ctdb/failover/failover_conf.c | 53 +++++++++++++++++++++++++++++++++++ > ctdb/failover/failover_conf.h | 31 ++++++++++++++++++++ > ctdb/wscript | 4 +++ > 3 files changed, 88 insertions(+) > create mode 100644 ctdb/failover/failover_conf.c > create mode 100644 ctdb/failover/failover_conf.h > >diff --git a/ctdb/failover/failover_conf.c b/ctdb/failover/failover_conf.c >new file mode 100644 >index 00000000000..0f199cbcd6c >--- /dev/null >+++ b/ctdb/failover/failover_conf.c >@@ -0,0 +1,53 @@ >+/* >+ CTDB database config handling >+ >+ Copyright (C) Martin Schwenke 2018 >+ >+ This program is free software; you can redistribute it and/or modify >+ it under the terms of the GNU General Public License as published by >+ the Free Software Foundation; either version 3 of the License, or >+ (at your option) any later version. >+ >+ This program is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ GNU General Public License for more details. >+ >+ You should have received a copy of the GNU General Public License >+ along with this program; if not, see <http://www.gnu.org/licenses/>. >+*/ >+ >+#include "replace.h" >+ >+#include "lib/util/debug.h" >+ >+#include "common/conf.h" >+ >+#include "failover/failover_conf.h" >+ >+static bool check_static_boolean_change(const char *key, >+ bool old_value, >+ bool new_value, >+ enum conf_update_mode mode) >+{ >+ if (mode == CONF_MODE_RELOAD || CONF_MODE_API) { >+ if (old_value != new_value) { >+ D_WARNING("Ignoring update of [%s] -> %s\n", >+ FAILOVER_CONF_SECTION, >+ key); >+ } >+ } >+ >+ return true; >+} >+ >+void failover_conf_init(struct conf_context *conf) >+{ >+ conf_define_section(conf, FAILOVER_CONF_SECTION, NULL); >+ >+ conf_define_boolean(conf, >+ FAILOVER_CONF_SECTION, >+ FAILOVER_CONF_DISABLED, >+ false, >+ check_static_boolean_change); >+} >diff --git a/ctdb/failover/failover_conf.h b/ctdb/failover/failover_conf.h >new file mode 100644 >index 00000000000..d154daa3428 >--- /dev/null >+++ b/ctdb/failover/failover_conf.h >@@ -0,0 +1,31 @@ >+/* >+ CTDB failover config handling >+ >+ Copyright (C) Martin Schwenke 2018 >+ >+ This program is free software; you can redistribute it and/or modify >+ it under the terms of the GNU General Public License as published by >+ the Free Software Foundation; either version 3 of the License, or >+ (at your option) any later version. >+ >+ This program is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ GNU General Public License for more details. >+ >+ You should have received a copy of the GNU General Public License >+ along with this program; if not, see <http://www.gnu.org/licenses/>. >+*/ >+ >+#ifndef __CTDB_FAILOVER_CONF_H__ >+#define __CTDB_FAILOVER_CONF_H__ >+ >+#include "common/conf.h" >+ >+#define FAILOVER_CONF_SECTION "failover" >+ >+#define FAILOVER_CONF_DISABLED "disabled" >+ >+void failover_conf_init(struct conf_context *conf); >+ >+#endif /* __CTDB_FAILOVER_CONF_H__ */ >diff --git a/ctdb/wscript b/ctdb/wscript >index addf8ece173..ab513ec57f5 100644 >--- a/ctdb/wscript >+++ b/ctdb/wscript >@@ -496,6 +496,10 @@ def build(bld): > source='event/event_conf.c', > deps='ctdb-util') > >+ bld.SAMBA_SUBSYSTEM('ctdb-failover-conf', >+ source='failover/failover_conf.c', >+ deps='ctdb-util') >+ > bld.SAMBA_SUBSYSTEM('ctdb-legacy-conf', > source='server/legacy_conf.c', > deps='ctdb-util') >-- >2.17.1 > > >From d6efe9dbd471fbf5041a199d801002c75db8a0ef Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 21 Aug 2018 11:44:03 +1000 >Subject: [PATCH 12/17] ctdb-config: Integrate failover options into conf-tool > >Update and add tests accordingly. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit d003a41a9cb9ea97a7da9dbb5bd3138f82da6cf1) >--- > ctdb/common/conf_tool.c | 2 ++ > ctdb/tests/cunit/config_test_001.sh | 2 ++ > ctdb/tests/cunit/config_test_007.sh | 24 ++++++++++++++++++++++++ > ctdb/wscript | 1 + > 4 files changed, 29 insertions(+) > create mode 100755 ctdb/tests/cunit/config_test_007.sh > >diff --git a/ctdb/common/conf_tool.c b/ctdb/common/conf_tool.c >index 329b20476c1..e6020c504e6 100644 >--- a/ctdb/common/conf_tool.c >+++ b/ctdb/common/conf_tool.c >@@ -32,6 +32,7 @@ > #include "cluster/cluster_conf.h" > #include "database/database_conf.h" > #include "event/event_conf.h" >+#include "failover/failover_conf.h" > #include "server/legacy_conf.h" > > #include "common/conf_tool.h" >@@ -243,6 +244,7 @@ int conf_tool_run(struct conf_tool_context *ctx, int *result) > cluster_conf_init(ctx->conf); > database_conf_init(ctx->conf); > event_conf_init(ctx->conf); >+ failover_conf_init(ctx->conf); > legacy_conf_init(ctx->conf); > > if (! conf_valid(ctx->conf)) { >diff --git a/ctdb/tests/cunit/config_test_001.sh b/ctdb/tests/cunit/config_test_001.sh >index 74686cac9b9..c0a6e89aeb2 100755 >--- a/ctdb/tests/cunit/config_test_001.sh >+++ b/ctdb/tests/cunit/config_test_001.sh >@@ -43,6 +43,8 @@ ok <<EOF > # tdb mutexes = true > [event] > # debug script = >+[failover] >+ # disabled = false > [legacy] > # realtime scheduling = true > # recmaster capability = true >diff --git a/ctdb/tests/cunit/config_test_007.sh b/ctdb/tests/cunit/config_test_007.sh >new file mode 100755 >index 00000000000..adffeb7b1ca >--- /dev/null >+++ b/ctdb/tests/cunit/config_test_007.sh >@@ -0,0 +1,24 @@ >+#!/bin/sh >+ >+. "${TEST_SCRIPTS_DIR}/unit.sh" >+ >+PATH="$PATH:$CTDB_SCRIPTS_HELPER_BINDIR" >+ >+setup_ctdb_base "${TEST_VAR_DIR}" "cunit" >+ >+conffile="${CTDB_BASE}/ctdb.conf" >+ >+remove_files () >+{ >+ rm -f "$conffile" >+} >+ >+test_cleanup remove_files >+ >+cat > "$conffile" <<EOF >+EOF >+ >+ok <<EOF >+false >+EOF >+unit_test ctdb-config get "failover" "disabled" >diff --git a/ctdb/wscript b/ctdb/wscript >index ab513ec57f5..1d7a31b39fa 100644 >--- a/ctdb/wscript >+++ b/ctdb/wscript >@@ -511,6 +511,7 @@ def build(bld): > ctdb-event-conf > ctdb-cluster-conf > ctdb-database-conf >+ ctdb-failover-conf > ctdb-legacy-conf > ctdb-util samba-util talloc replace popt''', > install_path='${CTDB_HELPER_BINDIR}') >-- >2.17.1 > > >From 12d42676d08678984109f4d4802bcbcfff9486c0 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 21 Aug 2018 13:41:22 +1000 >Subject: [PATCH 13/17] ctdb-config: Switch tunable DisableIPFailover to a > config option > >Use the "failover:disabled" option instead. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 929634126a334e380f16c080b59d062873b4e5f9) >--- > ctdb/common/tunable.c | 2 +- > ctdb/doc/ctdb-tunables.7.xml | 17 ---------------- > ctdb/doc/ctdb.1.xml | 1 - > ctdb/doc/ctdb.conf.5.xml | 29 ++++++++++++++++++++++++++++ > ctdb/server/ctdb_config.c | 10 ++++++++++ > ctdb/server/ctdb_config.h | 3 +++ > ctdb/server/ctdb_recoverd.c | 6 ++++-- > ctdb/server/ctdb_takeover.c | 10 ++++++---- > ctdb/tests/tool/ctdb.listvars.001.sh | 1 - > ctdb/wscript | 1 + > 10 files changed, 54 insertions(+), 26 deletions(-) > >diff --git a/ctdb/common/tunable.c b/ctdb/common/tunable.c >index e9367980753..f516d8c5374 100644 >--- a/ctdb/common/tunable.c >+++ b/ctdb/common/tunable.c >@@ -83,7 +83,7 @@ static struct { > offsetof(struct ctdb_tunable_list, reclock_ping_period) }, > { "NoIPFailback", 0, false, > offsetof(struct ctdb_tunable_list, no_ip_failback) }, >- { "DisableIPFailover", 0, false, >+ { "DisableIPFailover", 0, true, > offsetof(struct ctdb_tunable_list, disable_ip_failover) }, > { "VerboseMemoryNames", 0, false, > offsetof(struct ctdb_tunable_list, verbose_memory_names) }, >diff --git a/ctdb/doc/ctdb-tunables.7.xml b/ctdb/doc/ctdb-tunables.7.xml >index db3dd209760..71cb0e31142 100644 >--- a/ctdb/doc/ctdb-tunables.7.xml >+++ b/ctdb/doc/ctdb-tunables.7.xml >@@ -177,23 +177,6 @@ MonitorInterval=20 > </para> > </refsect2> > >- <refsect2> >- <title>DisableIPFailover</title> >- <para>Default: 0</para> >- <para> >- When set to non-zero, ctdb will not perform failover or >- failback. Even if a node fails while holding public IPs, ctdb >- will not recover the IPs or assign them to another node. >- </para> >- <para> >- When this tunable is enabled, ctdb will no longer attempt >- to recover the cluster by failing IP addresses over to other >- nodes. This leads to a service outage until the administrator >- has manually performed IP failover to replacement nodes using the >- 'ctdb moveip' command. >- </para> >- </refsect2> >- > <refsect2> > <title>ElectionTimeout</title> > <para>Default: 3</para> >diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml >index da699ff89f0..355547af41e 100644 >--- a/ctdb/doc/ctdb.1.xml >+++ b/ctdb/doc/ctdb.1.xml >@@ -800,7 +800,6 @@ DatabaseMaxDead = 5 > RerecoveryTimeout = 10 > EnableBans = 1 > NoIPFailback = 0 >-DisableIPFailover = 0 > VerboseMemoryNames = 0 > RecdPingTimeout = 60 > RecdFailCount = 10 >diff --git a/ctdb/doc/ctdb.conf.5.xml b/ctdb/doc/ctdb.conf.5.xml >index 316ac7f469d..01c09bf53be 100644 >--- a/ctdb/doc/ctdb.conf.5.xml >+++ b/ctdb/doc/ctdb.conf.5.xml >@@ -391,6 +391,35 @@ > </variablelist> > </refsect1> > >+ <refsect1> >+ <title> >+ FAILOVER CONFIGURATION >+ </title> >+ >+ <para> >+ Options in this section affect CTDB failover. They are >+ valid within the <emphasis>failover</emphasis> section of file, >+ indicated by <literal>[failover]</literal>. >+ </para> >+ >+ <variablelist> >+ >+ <varlistentry> >+ <term>disabled = true|false</term> >+ <listitem> >+ <para> >+ If set to <literal>true</literal> then public IP failover >+ is disabled. >+ </para> >+ <para> >+ Default: <literal>false</literal> >+ </para> >+ </listitem> >+ </varlistentry> >+ >+ </variablelist> >+ </refsect1> >+ > <refsect1> > <title> > LEGACY CONFIGURATION >diff --git a/ctdb/server/ctdb_config.c b/ctdb/server/ctdb_config.c >index f00c3268085..750b909cd3d 100644 >--- a/ctdb/server/ctdb_config.c >+++ b/ctdb/server/ctdb_config.c >@@ -28,6 +28,7 @@ > #include "cluster/cluster_conf.h" > #include "database/database_conf.h" > #include "event/event_conf.h" >+#include "failover/failover_conf.h" > #include "legacy_conf.h" > > #include "ctdb_config.h" >@@ -86,6 +87,14 @@ static void setup_config_pointers(struct conf_context *conf) > EVENT_CONF_DEBUG_SCRIPT, > &ctdb_config.event_debug_script); > >+ /* >+ * Failover >+ */ >+ conf_assign_boolean_pointer(conf, >+ FAILOVER_CONF_SECTION, >+ FAILOVER_CONF_DISABLED, >+ &ctdb_config.failover_disabled); >+ > /* > * Legacy > */ >@@ -132,6 +141,7 @@ int ctdbd_config_load(TALLOC_CTX *mem_ctx, > cluster_conf_init(conf); > database_conf_init(conf); > event_conf_init(conf); >+ failover_conf_init(conf); > legacy_conf_init(conf); > > setup_config_pointers(conf); >diff --git a/ctdb/server/ctdb_config.h b/ctdb/server/ctdb_config.h >index 65c6547258d..f2f75972661 100644 >--- a/ctdb/server/ctdb_config.h >+++ b/ctdb/server/ctdb_config.h >@@ -38,6 +38,9 @@ struct ctdb_config { > /* Event */ > const char *event_debug_script; > >+ /* Failover */ >+ bool failover_disabled; >+ > /* Legacy */ > bool realtime_scheduling; > bool recmaster_capability; >diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c >index 6d72316e4de..3e85186f35a 100644 >--- a/ctdb/server/ctdb_recoverd.c >+++ b/ctdb/server/ctdb_recoverd.c >@@ -42,6 +42,8 @@ > #include "common/common.h" > #include "common/logging.h" > >+#include "server/ctdb_config.h" >+ > #include "ctdb_cluster_mutex.h" > > /* List of SRVID requests that need to be processed */ >@@ -1149,7 +1151,7 @@ static int ctdb_takeover(struct ctdb_recoverd *rec, > } > } > >- if (rec->ctdb->tunable.disable_ip_failover != 0) { >+ if (ctdb_config.failover_disabled) { > ret = setenv("CTDB_DISABLE_IP_FAILOVER", "1", 1); > if (ret != 0) { > D_ERR("Failed to set CTDB_DISABLE_IP_FAILOVER variable\n"); >@@ -2333,7 +2335,7 @@ static int verify_local_ip_allocation(struct ctdb_context *ctdb, > } > > /* Return early if disabled... */ >- if (ctdb->tunable.disable_ip_failover != 0 || >+ if (ctdb_config.failover_disabled || > ctdb_op_is_disabled(rec->takeover_run)) { > return 0; > } >diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c >index 35e83057560..83279ed8f3b 100644 >--- a/ctdb/server/ctdb_takeover.c >+++ b/ctdb/server/ctdb_takeover.c >@@ -43,6 +43,8 @@ > #include "common/common.h" > #include "common/logging.h" > >+#include "server/ctdb_config.h" >+ > #include "server/ipalloc.h" > > #define TAKEOVER_TIMEOUT() timeval_current_ofs(ctdb->tunable.takeover_timeout,0) >@@ -750,7 +752,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb, > return 0; > } > >- if (ctdb->tunable.disable_ip_failover == 0 && ctdb->do_checkpublicip) { >+ if (ctdb_config.failover_disabled == 0 && ctdb->do_checkpublicip) { > have_ip = ctdb_sys_have_ip(&pip->addr); > } > best_iface = ctdb_vnn_best_iface(ctdb, vnn); >@@ -888,7 +890,7 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status, > ctdb_ban_self(ctdb); > } > >- if (ctdb->tunable.disable_ip_failover == 0 && ctdb->do_checkpublicip) { >+ if (ctdb_config.failover_disabled == 0 && ctdb->do_checkpublicip) { > if (ctdb_sys_have_ip(state->addr)) { > DEBUG(DEBUG_ERR, > ("IP %s still hosted during release IP callback, failing\n", >@@ -952,7 +954,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb, > * local node. Redundant releases need to update the PNN but > * are otherwise ignored. > */ >- if (ctdb->tunable.disable_ip_failover == 0 && ctdb->do_checkpublicip) { >+ if (ctdb_config.failover_disabled == 0 && ctdb->do_checkpublicip) { > if (!ctdb_sys_have_ip(&pip->addr)) { > DEBUG(DEBUG_DEBUG,("Redundant release of IP %s/%u on interface %s (ip not held)\n", > ctdb_addr_to_str(&pip->addr), >@@ -1577,7 +1579,7 @@ void ctdb_release_all_ips(struct ctdb_context *ctdb) > struct ctdb_vnn *vnn, *next; > int count = 0; > >- if (ctdb->tunable.disable_ip_failover == 1) { >+ if (ctdb_config.failover_disabled == 1) { > return; > } > >diff --git a/ctdb/tests/tool/ctdb.listvars.001.sh b/ctdb/tests/tool/ctdb.listvars.001.sh >index 95b6c3133f9..a304942af43 100755 >--- a/ctdb/tests/tool/ctdb.listvars.001.sh >+++ b/ctdb/tests/tool/ctdb.listvars.001.sh >@@ -32,7 +32,6 @@ DatabaseMaxDead = 5 > RerecoveryTimeout = 10 > EnableBans = 1 > NoIPFailback = 0 >-DisableIPFailover = 0 > VerboseMemoryNames = 0 > RecdPingTimeout = 60 > RecdFailCount = 10 >diff --git a/ctdb/wscript b/ctdb/wscript >index 1d7a31b39fa..323da8cf12a 100644 >--- a/ctdb/wscript >+++ b/ctdb/wscript >@@ -577,6 +577,7 @@ def build(bld): > ctdb-cluster-conf > ctdb-database-conf > ctdb-event-conf >+ ctdb-failover-conf > ctdb-legacy-conf > ctdb-event-protocol > talloc tevent tdb-wrap tdb talloc_report''' + >-- >2.17.1 > > >From a40d3a172d40abceaea67e79eb31fd8e6472b0d3 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 21 Aug 2018 17:25:53 +1000 >Subject: [PATCH 14/17] ctdb-doc: Switch tunable DisableIPFailover to a config > option > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 78aad7623e100f05a7dfc142fba7ff2b0eba1913) >--- > ctdb/doc/examples/config_migrate.sh | 1 + > ctdb/doc/examples/config_migrate.test_input | 1 + > 2 files changed, 2 insertions(+) > >diff --git a/ctdb/doc/examples/config_migrate.sh b/ctdb/doc/examples/config_migrate.sh >index e3e30aecfeb..8479aeb39f3 100755 >--- a/ctdb/doc/examples/config_migrate.sh >+++ b/ctdb/doc/examples/config_migrate.sh >@@ -181,6 +181,7 @@ get_ctdb_conf_tunable_option () > } > }' <<EOF > database tdb-mutexes TDBMutexEnabled 0 false >+failover disabled DisableIPFailover 1 true > EOF > > } >diff --git a/ctdb/doc/examples/config_migrate.test_input b/ctdb/doc/examples/config_migrate.test_input >index 947ca7c358f..e823fd4ff87 100644 >--- a/ctdb/doc/examples/config_migrate.test_input >+++ b/ctdb/doc/examples/config_migrate.test_input >@@ -39,6 +39,7 @@ CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes > CTDB_SET_TDBMutexEnabled=0 > CTDB_SET_IPALLOCALGORITHM=0 > CTDB_SET_noiphostonalldisabled=0 >+CTDB_SET_DisableIpFailover=1 > CTDB_SET_foobar=0 > > CTDB_SUPPRESS_COREFILE="yes" >-- >2.17.1 > > >From 075011ce83854587dabadf88b4f2e05cfb01d4e9 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 21 Aug 2018 06:55:33 +1000 >Subject: [PATCH 15/17] ctdb-tests: Add an extra conf loading test case > >This shows that config file loading continues in spite of unknown keys >if ignore_unknown is true. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 55893bf8d2cc7e01b3a93d8e1fde16408244cb65) >--- > ctdb/tests/cunit/config_test_001.sh | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > >diff --git a/ctdb/tests/cunit/config_test_001.sh b/ctdb/tests/cunit/config_test_001.sh >index c0a6e89aeb2..bf1e589c318 100755 >--- a/ctdb/tests/cunit/config_test_001.sh >+++ b/ctdb/tests/cunit/config_test_001.sh >@@ -90,3 +90,23 @@ required_result 2 <<EOF > Configuration option [section] -> "key" not defined > EOF > unit_test ctdb-config get section key >+ >+# Confirm that an unknown key doesn't stop the rest of the file from >+# loading >+cat > "$conffile" <<EOF >+[database] >+ unknown key = 123 >+ >+[logging] >+ log level = debug >+EOF >+ >+required_result 2 <<EOF >+Failed to load config file $conffile >+EOF >+unit_test ctdb-config validate >+ >+ok <<EOF >+debug >+EOF >+unit_test ctdb-config get "logging" "log level" >-- >2.17.1 > > >From a46d36b51c22924faeccd15718a96ae0befc3fa4 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Fri, 24 Aug 2018 17:37:38 +1000 >Subject: [PATCH 16/17] ctdb-tests: Check that no IPs are assigned when > failover is disabled > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> > >Autobuild-User(master): Amitay Isaacs <amitay@samba.org> >Autobuild-Date(master): Fri Aug 24 14:13:12 CEST 2018 on sn-devel-144 > >(cherry picked from commit 6fb80cbffb9cb8cba6abc3fbce228811d36e8c9a) >--- > ctdb/tests/simple/19_ip_takeover_noop.sh | 27 +++++++++++++++++++- > ctdb/tests/simple/scripts/local_daemons.bash | 5 ++++ > 2 files changed, 31 insertions(+), 1 deletion(-) > >diff --git a/ctdb/tests/simple/19_ip_takeover_noop.sh b/ctdb/tests/simple/19_ip_takeover_noop.sh >index af0cdee383b..0b86241db2a 100755 >--- a/ctdb/tests/simple/19_ip_takeover_noop.sh >+++ b/ctdb/tests/simple/19_ip_takeover_noop.sh >@@ -3,7 +3,10 @@ > test_info() > { > cat <<EOF >-Check that CTDB operates correctly if there are 0 public IPs configured >+Check that CTDB operates correctly if: >+ >+* failover is disabled; or >+* there are 0 public IPs configured > > This test only does anything with local daemons. On a real cluster it > has no way of updating configuration. >@@ -30,6 +33,28 @@ select_test_node_and_ips > > daemons_stop > >+echo "Starting CTDB with failover disabled..." >+setup_ctdb --disable-failover >+daemons_start >+ >+wait_until_ready >+ >+echo "Getting IP allocation..." >+try_command_on_node -v any "$CTDB ip all | tail -n +2" >+ >+while read ip pnn ; do >+ if [ "$pnn" != "-1" ] ; then >+ die "BAD: IP address ${ip} is assigned to node ${pnn}" >+ fi >+done <<EOF >+$out >+EOF >+ >+echo "GOOD: All IP addresses are unassigned" >+ >+echo "----------------------------------------" >+daemons_stop >+ > echo "Starting CTDB with an empty public addresses configuration..." > setup_ctdb --no-public-addresses > daemons_start >diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash >index dd383cf6289..c7a5ee05fc6 100644 >--- a/ctdb/tests/simple/scripts/local_daemons.bash >+++ b/ctdb/tests/simple/scripts/local_daemons.bash >@@ -94,9 +94,11 @@ setup_ctdb () > { > local no_public_addresses=false > local no_event_scripts=false >+ local disable_failover=false > case "$1" in > --no-public-addresses) no_public_addresses=true ;; > --no-event-scripts) no_event_scripts=true ;; >+ --disable-failover) disable_failover=true ;; > esac > > nodes_file="${SIMPLE_TESTS_VAR_DIR}/nodes" >@@ -154,6 +156,9 @@ setup_ctdb () > persistent database directory = ${db_dir}/persistent > state database directory = ${db_dir}/state > >+[failover] >+ disabled = ${disable_failover} >+ > [event] > debug script = debug-hung-script.sh > EOF >-- >2.17.1 > > >From b1cf311a878986fb3955a490eee0890da8dfe62c Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Sun, 26 Aug 2018 20:28:39 +1000 >Subject: [PATCH 17/17] WHATSNEW: More CTDB updates for 4.9 > >This includes descriptions of some final configuration changes as well >as an overall mapping between old and new configuration options. > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >--- > WHATSNEW.txt | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > >diff --git a/WHATSNEW.txt b/WHATSNEW.txt >index 97cd50b225e..47b42627fab 100644 >--- a/WHATSNEW.txt >+++ b/WHATSNEW.txt >@@ -319,6 +319,26 @@ There are many changes to CTDB in this release. > When writing tests there are still mechanisms available to change > the locations of certain directories and files. > >+* The following ctdbd.conf and ctdbd options have been replaced by new >+ ctdb.conf options: >+ >+ CTDB_LOGGING/--logging logging -> location >+ CTDB_DEBUGLEVEL/-d logging -> log level >+ CTDB_TRANSPORT/--transport cluster -> transport >+ CTDB_NODE_ADDRESS/--listen cluster -> node address >+ CTDB_RECOVERY_LOCK/--reclock cluster -> recovery lock >+ CTDB_DBDIR/--dbdir database -> volatile database directory >+ CTDB_DBDIR_PERSISTENT/--dbdir-persistent database -> peristent database directory >+ CTDB_DBDIR_STATE/--dbdir-state database -> state database directory >+ CTDB_DEBUG_LOCKS database -> lock debug script >+ CTDB_DEBUG_HUNG_SCRIPT event -> debug script >+ CTDB_NOSETSCHED/--nosetsched legacy -> realtime scheduling >+ CTDB_CAPABILITY_RECMASTER/--no-recmaster legacy -> recmaster capability >+ CTDB_CAPABILITY_LMASTER/--no-lmaster legacy -> lmaster capability >+ CTDB_START_AS_STOPPED/--start-as-stopped legacy -> start as stopped >+ CTDB_START_AS_DISABLED/--start-as-disabled legacy -> start as disabled >+ CTDB_SCRIPT_LOG_LEVEL/--script-log-level legacy -> script log level >+ > * Event scripts have moved to the scripts/legacy subdirectory of the > configuration directory > >@@ -370,6 +390,11 @@ There are many changes to CTDB in this release. > manually mounted on the directory pointed to by the "volatile > database directory" option. See ctdb.conf(5) for more details. > >+* The following tunable options are now ctdb.conf options: >+ >+ DisabledIPFailover failover -> disabled >+ TDBMutexEnabled database -> tdb mutexes >+ > * Support for the NoIPHostOnAllDisabled tunable has been removed > > If all nodes are unhealthy or disabled then CTDB will not host >-- >2.17.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
martins
:
review+
Actions:
View
Attachments on
bug 13589
:
14447
| 14448 |
14463