ctdb: Change LVS to use leader/follower
authorMartin Schwenke <martin@meltin.net>
Fri, 17 Jul 2020 10:46:07 +0000 (20:46 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 24 Jul 2020 08:37:31 +0000 (08:37 +0000)
Instead of master/slave.

Nearly all of these are simple textual substitutions, which preserve
the case of the original.    A couple of minor cleanups were made in the
documentation (such as "LVSMASTER" -> "LVS leader").

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
19 files changed:
ctdb/config/events/legacy/91.lvs.script
ctdb/doc/ctdb-script.options.5.xml
ctdb/doc/ctdb.1.xml
ctdb/doc/ctdb.7.xml
ctdb/tests/UNIT/eventscripts/91.lvs.ipreallocated.012.sh
ctdb/tests/UNIT/eventscripts/91.lvs.ipreallocated.013.sh
ctdb/tests/UNIT/eventscripts/91.lvs.ipreallocated.014.sh
ctdb/tests/UNIT/eventscripts/scripts/91.lvs.sh
ctdb/tests/UNIT/eventscripts/stubs/ctdb_lvs
ctdb/tests/UNIT/tool/ctdb.lvs.001.sh
ctdb/tests/UNIT/tool/ctdb.lvs.002.sh
ctdb/tests/UNIT/tool/ctdb.lvs.003.sh
ctdb/tests/UNIT/tool/ctdb.lvs.004.sh
ctdb/tests/UNIT/tool/ctdb.lvs.005.sh
ctdb/tests/UNIT/tool/ctdb.lvs.006.sh
ctdb/tests/UNIT/tool/ctdb.lvs.007.sh
ctdb/tests/UNIT/tool/ctdb.lvs.008.sh
ctdb/tools/ctdb.c
ctdb/tools/ctdb_lvs

index b3d65f44607f2265d2d9753fb29d2517bbca6fe6..05f0431b66139c9dff8b365507d2b80fecba2b19 100755 (executable)
@@ -19,11 +19,11 @@ if ! type ipvsadm >/dev/null 2>&1 ; then
 fi
 
 
-lvs_slave_only ()
+lvs_follower_only ()
 {
        _ip_address=$(ctdb_get_ip_address)
        awk -v my_ip="$_ip_address" \
-           '$1 == my_ip { if ($2 ~ "slave-only") { exit 0 } else { exit 1 } }' \
+           '$1 == my_ip { if ($2 ~ "follower-only") { exit 0 } else { exit 1 } }' \
            "$CTDB_LVS_NODES"
 }
 
@@ -33,7 +33,7 @@ lvs_check_config ()
                die "error: CTDB_LVS_NODES=${CTDB_LVS_NODES} unreadable"
        [ -n "$CTDB_LVS_PUBLIC_IP" ] || \
                die "Invalid configuration: CTDB_LVS_PUBLIC_IP not set"
-       if ! lvs_slave_only ; then
+       if ! lvs_follower_only ; then
                [ -n "$CTDB_LVS_PUBLIC_IFACE" ] || \
                        die "Invalid configuration: CTDB_LVS_PUBLIC_IFACE not set"
        fi
@@ -78,9 +78,9 @@ ipreallocated)
                "$CTDB_LVS_PUBLIC_IFACE" "$CTDB_LVS_PUBLIC_IP"
 
        pnn=$(ctdb_get_pnn)
-       lvsmaster=$("${CTDB_HELPER_BINDIR}/ctdb_lvs" master)
-       if [ "$pnn" != "$lvsmaster" ] ; then
-           # This node is not the LVS master so change the IP address
+       lvsleader=$("${CTDB_HELPER_BINDIR}/ctdb_lvs" leader)
+       if [ "$pnn" != "$lvsleader" ] ; then
+           # This node is not the LVS leader so change the IP address
            # to have scope "host" so this node won't respond to ARPs
            ip addr del "${CTDB_LVS_PUBLIC_IP}/32" dev lo >/dev/null 2>&1
            ip addr add "${CTDB_LVS_PUBLIC_IP}/32" dev lo scope host
index d46de369c5cfcca1da5e4a466db6fabdf1ca4efc..700d1f7bd35753356fb28ce00c4aea8f9eb71bc5 100644 (file)
@@ -451,7 +451,7 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
            <para>
              File format:
              <screen>
-<parameter>IPADDR</parameter> <optional>slave-only</optional>
+<parameter>IPADDR</parameter> <optional>follower-only</optional>
              </screen>
            </para>
            <para>
@@ -459,8 +459,8 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
              group.
            </para>
            <para>
-             If "slave-only" is specified then the corresponding node
-             can not be the LVS master node.  In this case
+             If "follower-only" is specified then the corresponding node
+             can not be the LVS leader node.  In this case
              <varname>CTDB_LVS_PUBLIC_IFACE</varname> and
              <varname>CTDB_LVS_PUBLIC_IP</varname> are optional and
              unused.
@@ -480,7 +480,7 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
            <para>
              INTERFACE is the network interface that clients will use
              to connection to <varname>CTDB_LVS_PUBLIC_IP</varname>.
-             This is optional for slave-only nodes.
+             This is optional for follower-only nodes.
              No default.
            </para>
          </listitem>
index 9b530087e920bcea964cbbb17d166f15c47e4bf7..217a6d3e41aed834d2e46ee60e03ab3fd082469e 100644 (file)
@@ -864,7 +864,7 @@ MonitorInterval         = 15
     </refsect2>
 
     <refsect2>
-      <title>lvs {master|list|status}</title>
+      <title>lvs {leader|list|status}</title>
       <para>
        This command shows different aspects of LVS status.  For an
        overview of CTDB's LVS functionality please see the
@@ -875,10 +875,10 @@ MonitorInterval         = 15
 
       <variablelist>
        <varlistentry>
-         <term>master</term>
+         <term>leader</term>
          <listitem>
            <para>
-             Shows the PNN of the current LVS master node.
+             Shows the PNN of the current LVS leader node.
            </para>
       <para>
        Example output:
index 5ec69e4c8711937e84a430871a55f54b878e0779..7fd61af0964fb0ced85e0c970eb6f0fc16ed2d60 100644 (file)
@@ -528,13 +528,13 @@ Node 3:/usr/local/etc/ctdb/public_addresses
 
     <para>
       In each LVS group, one of the nodes is selected by CTDB to be
-      the LVS master.  This node receives all traffic from clients
+      the LVS leader.  This node receives all traffic from clients
       coming in to the LVS public address and multiplexes it across
       the internal network to one of the nodes that LVS is using.
       When responding to the client, that node will send the data back
-      directly to the client, bypassing the LVS master node.  The
-      command <command>ctdb lvs master</command> will show which node
-      is the current LVS master.
+      directly to the client, bypassing the LVS leader node.  The
+      command <command>ctdb lvs leader</command> will show which node
+      is the current LVS leader.
     </para>
 
     <para>
@@ -542,12 +542,12 @@ Node 3:/usr/local/etc/ctdb/public_addresses
       <orderedlist>
        <listitem>
          <para>
-           Client sends request packet to LVSMASTER.
+           Client sends request packet to LVS leader.
          </para>
        </listitem>
        <listitem>
          <para>
-           LVSMASTER passes the request on to one node across the
+           LVS leader passes the request on to one node across the
            internal network.
          </para>
        </listitem>
@@ -572,7 +572,7 @@ Node 3:/usr/local/etc/ctdb/public_addresses
       pattern is write-intensive since you will be limited in the
       available network bandwidth that node can handle.  LVS does work
       very well for read-intensive workloads where only smallish READ
-      requests are going through the LVSMASTER bottleneck and the
+      requests are going through the LVS leader bottleneck and the
       majority of the traffic volume (the data in the read replies)
       goes straight from the processing node back to the clients. For
       read-intensive i/o patterns you can achieve very high throughput
@@ -631,21 +631,21 @@ CTDB_LVS_NODES=/usr/local/etc/ctdb/lvs_nodes
       </screen>
 
       <para>
-       Normally any node in an LVS group can act as the LVS master.
+       Normally any node in an LVS group can act as the LVS leader.
        Nodes that are highly loaded due to other demands maybe
-       flagged with the "slave-only" option in the
+       flagged with the "follower-only" option in the
        <varname>CTDB_LVS_NODES</varname> file to limit the LVS
        functionality of those nodes.
       </para>
 
       <para>
        LVS nodes file that excludes 192.168.1.4 from being
-       the LVS master node:
+       the LVS leader node:
       </para>
       <screen format="linespecific">
 192.168.1.2
 192.168.1.3
-192.168.1.4 slave-only
+192.168.1.4 follower-only
       </screen>
 
     </refsect2>
index 970a4aa9ccf5b0a12357b8e07083cb23fbc9017f..15328efba97cd2718174b813ba44b21d2ebd508c 100755 (executable)
@@ -2,7 +2,7 @@
 
 . "${TEST_SCRIPTS_DIR}/unit.sh"
 
-define_test "nodes in config, no master (e.g. all inactive)"
+define_test "nodes in config, no leader (e.g. all inactive)"
 
 setup "10.1.1.201" "eth0" <<EOF
 192.168.1.1
index 0720036b448c6b70c0c2a074ecd6411db33c08a9..918b18db352ed12db356a6950ef7c8c8363b0542 100755 (executable)
@@ -2,11 +2,11 @@
 
 . "${TEST_SCRIPTS_DIR}/unit.sh"
 
-define_test "nodes in config, other node is master"
+define_test "nodes in config, other node is leader"
 
 setup "10.1.1.201" "eth0" <<EOF
 192.168.1.1
-192.168.1.2    master
+192.168.1.2    leader
 192.168.1.3
 EOF
 
index 19788d7bc8c0ea691225622a26d0f29e1500eef1..8af31d7f618d2c1d894a2fb4d9f62ae3c6a22d41 100755 (executable)
@@ -2,10 +2,10 @@
 
 . "${TEST_SCRIPTS_DIR}/unit.sh"
 
-define_test "nodes in config, this is master"
+define_test "nodes in config, this is leader"
 
 setup "10.1.1.201" "eth0" <<EOF
-192.168.1.1    master
+192.168.1.1    leader
 192.168.1.2
 192.168.1.3
 EOF
index a29c4d353fdf2d6dc796fbbf4ac93a8a3d5be31c..a8104eb0b3d2bef8e868d78f04b226a21bfd1997 100644 (file)
@@ -17,18 +17,18 @@ CTDB_LVS_PUBLIC_IP="$_ip"
 CTDB_LVS_PUBLIC_IFACE="$_iface"
 EOF
 
-       export FAKE_CTDB_LVS_MASTER=""
+       export FAKE_CTDB_LVS_LEADER=""
 
        # Read from stdin
        _pnn=0
        while read _ip _opts ; do
                case "$_opts" in
-               master)
-                       FAKE_CTDB_LVS_MASTER="$_pnn"
+               leader)
+                       FAKE_CTDB_LVS_LEADER="$_pnn"
                        echo "$_ip"
                        ;;
-               slave-only)
-                       printf "%s\tslave-only\n" "$_ip"
+               follower-only)
+                       printf "%s\tfollower-only\n" "$_ip"
                        ;;
                *)
                        echo "$_ip"
index 5dfb24901e3457c68dfd553fc03e6f7644360f45..85e005c0b365b7131d1d9c10d73211450388d917 100755 (executable)
@@ -13,7 +13,7 @@ not_implemented_exit_code=1
 usage ()
 {
     cat >&2 <<EOF
-Usage: $prog { master | list }
+Usage: $prog { leader | list }
 EOF
     exit 1
 }
@@ -24,10 +24,10 @@ not_implemented ()
     exit $not_implemented_exit_code
 }
 
-ctdb_lvs_master ()
+ctdb_lvs_leader ()
 {
-       if [ -n "$FAKE_CTDB_LVS_MASTER" ] ; then
-               echo "$FAKE_CTDB_LVS_MASTER"
+       if [ -n "$FAKE_CTDB_LVS_LEADER" ] ; then
+               echo "$FAKE_CTDB_LVS_LEADER"
                return 0
        else
                return 255
@@ -46,7 +46,7 @@ ctdb_lvs_list ()
 ######################################################################
 
 case "$1" in
-    master) ctdb_lvs_master "$@" ;;
+    leader) ctdb_lvs_leader "$@" ;;
     list)   ctdb_lvs_list "$@" ;;
     *) not_implemented "$1" ;;
 esac
index 411072c5da4de45c23e416d20faa940bd6e05751..70c726c7b3ce197f26117d51e826fb7e84e040c3 100755 (executable)
@@ -19,7 +19,7 @@ EOF
 required_result 255 <<EOF
 EOF
 
-simple_test master
+simple_test leader
 
 #####
 
index 5344b166a4e17299e66d802d5e116bb6a4d2abac..edde656478bc7308eb31e160bf84925462e485a4 100755 (executable)
@@ -23,7 +23,7 @@ required_result 0 <<EOF
 0
 EOF
 
-simple_test master
+simple_test leader
 
 #####
 
index c3d1f7221f123fecf734a3049f4c41616861f507..0045ae4728151978d943daf1fef6044bec344d7a 100755 (executable)
@@ -22,7 +22,7 @@ required_result 0 <<EOF
 0
 EOF
 
-simple_test master
+simple_test leader
 
 #####
 
index ea1d1887fe639dc1cdf4a3a41901b4bc3eff51fc..255966d25880547c3bb8c7d0b0e8a0ecd83676ca 100755 (executable)
@@ -23,7 +23,7 @@ required_result 0 <<EOF
 1
 EOF
 
-simple_test master
+simple_test leader
 
 #####
 
index 592224863eab4091ecf2b99ae30d52e3c34ddec2..73fcd80b5bed77956077f1eb9e0bd68ec70f55ed 100755 (executable)
@@ -23,7 +23,7 @@ required_result 0 <<EOF
 0
 EOF
 
-simple_test master
+simple_test leader
 
 #####
 
index 2f9859a6be858cc26bd5ef8f6916db32b710e196..55b43103b0c6cb2f43f451a7fe8bdbee82985118 100755 (executable)
@@ -23,7 +23,7 @@ required_result 0 <<EOF
 2
 EOF
 
-simple_test master
+simple_test leader
 
 #####
 
index dd47b9e69ca93e79abf218a02d3abb70bae8adf6..3dd1104623a936dbfdf3d862658f63ad7b02290a 100755 (executable)
@@ -22,7 +22,7 @@ EOF
 required_result 255 <<EOF
 EOF
 
-simple_test master
+simple_test leader
 
 #####
 
index 6cdd702c57cb206553df4235e0c742e4067bd296..1997f4c2909cd280f6f6e0f8669bcd1a2b82f360 100755 (executable)
@@ -41,7 +41,7 @@ Failed to detect PNN of the current node.
 Is this node part of CTDB cluster?
 EOF
 
-simple_test master
+simple_test leader
 
 #####
 
index 01803efa69648fda5c592e390d598045569e6632..171069d7ebfef787814afd16ac985132a32f2a86 100644 (file)
@@ -5954,7 +5954,7 @@ static const struct ctdb_cmd {
        { "pnn", control_pnn, false, false,
                "show the pnn of the currnet node", NULL },
        { "lvs", control_lvs, false, false,
-               "show lvs configuration", "master|list|status" },
+               "show lvs configuration", "leader|list|status" },
        { "setdebug", control_setdebug, false, true,
                "set debug level", "ERROR|WARNING|NOTICE|INFO|DEBUG" },
        { "getdebug", control_getdebug, false, true,
index ec679c5e35775e58c87987b705812586fa540493..ee521ba2bc10af4e998c0e945f461bc4f6ae9787 100755 (executable)
@@ -23,7 +23,7 @@ usage ()
 $0 <option>
 
 <option> is one of:
-  master     Display node number of master node
+  leader     Display node number of leader node
   list       List node number and private IP address of usable nodes in group
   status     Show status of all nodes in LVS group
 EOF
@@ -72,7 +72,7 @@ get_lvs_nodes ()
                \#*) continue ;;
                esac
                case "$_options" in
-               slave-only|"") : ;;
+               follower-only|"") : ;;
                *) die "${prog}: Invalid options \"${_options}\" in  \"$CTDB_LVS_NODES\""
                esac
        done <<EOF
@@ -124,13 +124,13 @@ $nodestatus_X
 EOF
 }
 
-# Print the PNN of the LVS master node
-find_master ()
+# Print the PNN of the LVS leader node
+find_leader ()
 {
        get_lvs_nodes || \
                die "${prog}: LVS nodes file \"$CTDB_LVS_NODES\" not found"
 
-       # $_ms is an @-delimited list of nodes that are allowed to be the master
+       # $_ms is an @-delimited list of nodes that are allowed to be the leader
        _ms="@"
        while read _ip _options ; do
                case "$_options" in
@@ -140,8 +140,8 @@ find_master ()
 $lvs_nodes
 EOF
 
-       _master_candidates=$(filter_nodes "$_ms") || return $?
-       echo "${_master_candidates%% *}"
+       _leader_candidates=$(filter_nodes "$_ms") || return $?
+       echo "${_leader_candidates%% *}"
 }
 
 # List all usable nodes in the LVS group
@@ -197,7 +197,7 @@ prog=$(basename "$0")
 cmd="$1"
 
 case "$cmd" in
-master) find_master ;;
+leader) find_leader ;;
 list)   nodes_list ;;
 status) nodes_status ;;
 *)      usage ;;