The branch, master has been updated
       via  f241484 ctdb-daemon: Mark RecoverPDBBySeqNum tunable deprecated
       via  2a9584d ctdb-daemon: Remove unused code cmdline.[ch]
       via  569d787a ctdb-daemon: Consolidate command line options to ctdbd
       via  7dec7e0 ctdb-tests: Remove unused test code
      from  5adb169 s4-torture: Add LZX compressed cabinet test

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f2414841f2f6e8cabc90784f4f30c1b8b6038d6d
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Fri Nov 18 15:09:26 2016 +1100

    ctdb-daemon: Mark RecoverPDBBySeqNum tunable deprecated
    
    Persistent databases are now always recovered by sequence number, so
    there is no need for this tunable.
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Martin Schwenke <mar...@meltin.net>
    
    Autobuild-User(master): Martin Schwenke <mart...@samba.org>
    Autobuild-Date(master): Fri Nov 25 08:13:59 CET 2016 on sn-devel-144

commit 2a9584dc0a768b84b2a5e78de164c67b7cf972e7
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Fri Nov 18 14:57:47 2016 +1100

    ctdb-daemon: Remove unused code cmdline.[ch]
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Martin Schwenke <mar...@meltin.net>

commit 569d787a1d688ddbabbea8cc16359b0415da97fa
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Fri Nov 18 14:52:38 2016 +1100

    ctdb-daemon: Consolidate command line options to ctdbd
    
    This inserts the code from ctdb_cmdline_init() function directly in
    main(), so common/cmdline.[ch] can be removed.
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Martin Schwenke <mar...@meltin.net>

commit 7dec7e0b9940811d0b3eb4e2e624987b95179fe3
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Fri Nov 18 14:27:35 2016 +1100

    ctdb-tests: Remove unused test code
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Martin Schwenke <mar...@meltin.net>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/common/cmdline.c                      | 181 -----------------------------
 ctdb/common/cmdline.h                      |  13 ---
 ctdb/common/tunable.c                      |   2 +-
 ctdb/doc/ctdb-tunables.7.xml               |  21 ----
 ctdb/server/ctdb_recoverd.c                |   1 -
 ctdb/server/ctdb_recovery_helper.c         |   4 +-
 ctdb/server/ctdbd.c                        |  34 +++++-
 ctdb/tests/simple/70_recoverpdbbyseqnum.sh | 121 +++----------------
 ctdb/tests/simple/76_ctdb_pdb_recovery.sh  |  24 +---
 ctdb/tests/src/porting_tests.c             |   1 -
 ctdb/tests/src/rb_perftest.c               | 123 --------------------
 ctdb/tests/tool/ctdb.listvars.001.sh       |   1 -
 ctdb/wscript                               |   2 +-
 13 files changed, 53 insertions(+), 475 deletions(-)
 delete mode 100644 ctdb/common/cmdline.c
 delete mode 100644 ctdb/common/cmdline.h
 delete mode 100644 ctdb/tests/src/rb_perftest.c


Changeset truncated at 500 lines:

diff --git a/ctdb/common/cmdline.c b/ctdb/common/cmdline.c
deleted file mode 100644
index 3a4557e..0000000
--- a/ctdb/common/cmdline.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* 
-   common commandline code to ctdb test tools
-
-   Copyright (C) Andrew Tridgell  2007
-
-   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 "system/filesys.h"
-#include "system/network.h"
-
-#include <popt.h>
-#include <talloc.h>
-#include <tevent.h>
-#include <ctype.h>
-
-#include "lib/util/debug.h"
-#include "ctdb_private.h"
-#include "ctdb_client.h"
-
-#include "common/rb_tree.h"
-#include "common/common.h"
-#include "common/logging.h"
-#include "common/cmdline.h"
-
-
-
-/* Handle common command line options for ctdb test progs
- */
-
-static struct {
-       const char *socketname;
-       const char *debuglevel;
-       int torture;
-       const char *events;
-} ctdb_cmdline = {
-       .torture = 0,
-       .debuglevel = "NOTICE",
-};
-
-enum {OPT_EVENTSYSTEM=1};
-
-static void ctdb_cmdline_callback(poptContext con, 
-                                 enum poptCallbackReason reason,
-                                 const struct poptOption *opt,
-                                 const char *arg, const void *data)
-{
-       switch (opt->val) {
-       case OPT_EVENTSYSTEM:
-               tevent_set_default_backend(arg);
-               break;
-       }
-}
-
-
-struct poptOption popt_ctdb_cmdline[] = {
-       { NULL, 0, POPT_ARG_CALLBACK, (void *)ctdb_cmdline_callback },  
-       { "socket", 0, POPT_ARG_STRING, &ctdb_cmdline.socketname, 0, "local 
socket name", "filename" },
-       { "debug", 'd', POPT_ARG_STRING, &ctdb_cmdline.debuglevel, 0, "debug 
level"},
-       { "torture", 0, POPT_ARG_NONE, &ctdb_cmdline.torture, 0, "enable 
nastiness in library", NULL },
-       { "events", 0, POPT_ARG_STRING, NULL, OPT_EVENTSYSTEM, "event system", 
NULL },
-       { NULL }
-};
-
-
-/*
-  startup daemon side of ctdb according to command line options
- */
-struct ctdb_context *ctdb_cmdline_init(struct tevent_context *ev)
-{
-       struct ctdb_context *ctdb;
-       enum debug_level log_level;
-       int ret;
-
-       /* initialise ctdb */
-       ctdb = ctdb_init(ev);
-       if (ctdb == NULL) {
-               printf("Failed to init ctdb\n");
-               exit(1);
-       }
-
-       if (ctdb_cmdline.torture) {
-               ctdb_set_flags(ctdb, CTDB_FLAG_TORTURE);
-       }
-
-       /* command line specified a socket name */
-       if (ctdb_cmdline.socketname != NULL) {
-               setenv("CTDB_SOCKET", ctdb_cmdline.socketname, 1);
-               ret = ctdb_set_socketname(ctdb, ctdb_cmdline.socketname);
-               if (ret == -1) {
-                       printf("ctdb_set_socketname failed - %s\n",
-                                                   ctdb_errstr(ctdb));
-                       exit(1);
-               }
-       }
-
-       /* Set the debug level */
-       if (debug_level_parse(ctdb_cmdline.debuglevel, &log_level)) {
-               DEBUGLEVEL = debug_level_to_int(log_level);
-       } else {
-               DEBUGLEVEL = debug_level_to_int(DEBUG_NOTICE);
-       }
-
-       return ctdb;
-}
-
-
-/*
-  startup a client only ctdb context
- */
-struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
-                                        struct timeval req_timeout)
-{
-       struct ctdb_context *ctdb;
-       enum debug_level log_level;
-       char *socket_name;
-       int ret;
-
-       /* initialise ctdb */
-       ctdb = ctdb_init(ev);
-       if (ctdb == NULL) {
-               fprintf(stderr, "Failed to init ctdb\n");
-               exit(1);
-       }
-
-       /* tell ctdb the socket address */
-       socket_name = getenv("CTDB_SOCKET");
-       if (socket_name != NULL) {
-               ret = ctdb_set_socketname(ctdb, socket_name);
-               if (ret == -1) {
-                       printf("ctdb_set_socketname failed - %s\n",
-                                                   ctdb_errstr(ctdb));
-                       exit(1);
-               }
-       }
-
-       if (ctdb_cmdline.socketname != NULL) {
-               ret = ctdb_set_socketname(ctdb, ctdb_cmdline.socketname);
-               if (ret == -1) {
-                       fprintf(stderr, "ctdb_set_socketname failed - %s\n",
-                                       ctdb_errstr(ctdb));
-                       exit(1);
-               }
-       }
-
-       /* Set the debug level */
-       if (debug_level_parse(ctdb_cmdline.debuglevel, &log_level)) {
-               DEBUGLEVEL = debug_level_to_int(log_level);
-       } else {
-               DEBUGLEVEL = debug_level_to_int(DEBUG_NOTICE);
-       }
-
-       ret = ctdb_socket_connect(ctdb);
-       if (ret != 0) {
-               fprintf(stderr, __location__ " Failed to connect to daemon\n");
-               talloc_free(ctdb);
-               return NULL;
-       }
-
-       /* get our pnn */
-       ctdb->pnn = ctdb_ctrl_getpnn(ctdb, req_timeout, CTDB_CURRENT_NODE);
-       if (ctdb->pnn == (uint32_t)-1) {
-               DEBUG(DEBUG_CRIT,(__location__ " Failed to get ctdb pnn\n"));
-               talloc_free(ctdb);
-               return NULL;
-       }
-
-       return ctdb;
-}
diff --git a/ctdb/common/cmdline.h b/ctdb/common/cmdline.h
deleted file mode 100644
index 0285b4d..0000000
--- a/ctdb/common/cmdline.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef CTDB_CMDLINE_H
-#define CTDB_CMDLINE_H
-
-extern struct poptOption popt_ctdb_cmdline[];
-
-#define POPT_CTDB_CMDLINE { NULL, 0, POPT_ARG_INCLUDE_TABLE, 
popt_ctdb_cmdline, 0, "Common ctdb options:", NULL },
-
-struct ctdb_context *ctdb_cmdline_init(struct tevent_context *ev);
-
-struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
-                                        struct timeval req_timeout);
-
-#endif /* CTDB_CMDLINE_H */
diff --git a/ctdb/common/tunable.c b/ctdb/common/tunable.c
index 44e0cc5..5f36088 100644
--- a/ctdb/common/tunable.c
+++ b/ctdb/common/tunable.c
@@ -119,7 +119,7 @@ static struct {
                offsetof(struct ctdb_tunable_list, deferred_attach_timeout) },
        { "AllowClientDBAttach", 1, false,
                offsetof(struct ctdb_tunable_list, allow_client_db_attach) },
-       { "RecoverPDBBySeqNum", 1, false,
+       { "RecoverPDBBySeqNum", 1, true,
                offsetof(struct ctdb_tunable_list, recover_pdb_by_seqnum) },
        { "DeferredRebalanceOnNodeAdd", 300, true,
                offsetof(struct ctdb_tunable_list, 
deferred_rebalance_on_node_add) },
diff --git a/ctdb/doc/ctdb-tunables.7.xml b/ctdb/doc/ctdb-tunables.7.xml
index 088e822..8143a45 100644
--- a/ctdb/doc/ctdb-tunables.7.xml
+++ b/ctdb/doc/ctdb-tunables.7.xml
@@ -462,27 +462,6 @@
     </refsect2>
 
     <refsect2>
-      <title>RecoverPDBBySeqNum</title>
-      <para>Default: 1</para>
-      <para>
-       When set to zero, database recovery for persistent databases is
-       record-by-record and recovery process simply collects the most
-       recent version of every individual record.
-      </para>
-      <para>
-       When set to non-zero, persistent databases will instead be
-       recovered as a whole db and not by individual records. The
-       node that contains the highest value stored in the record
-       "__db_sequence_number__" is selected and the copy of that nodes
-       database is used as the recovered database.
-      </para>
-      <para>
-       By default, recovery of persistent databses is done using
-       __db_sequence_number__ record.
-      </para>
-    </refsect2>
-
-    <refsect2>
       <title>RecoverTimeout</title>
       <para>Default: 120</para>
       <para>
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 92ba35f..6861833 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -38,7 +38,6 @@
 #include "ctdb_client.h"
 
 #include "common/system.h"
-#include "common/cmdline.h"
 #include "common/common.h"
 #include "common/logging.h"
 
diff --git a/ctdb/server/ctdb_recovery_helper.c 
b/ctdb/server/ctdb_recovery_helper.c
index d54c290..7dfb707 100644
--- a/ctdb/server/ctdb_recovery_helper.c
+++ b/ctdb/server/ctdb_recovery_helper.c
@@ -1705,7 +1705,7 @@ static void recover_db_transaction_started(struct 
tevent_req *subreq)
                return;
        }
 
-       if (state->persistent && state->tun_list->recover_pdb_by_seqnum != 0) {
+       if (state->persistent) {
                subreq = collect_highseqnum_db_send(
                                state, state->ev, state->client,
                                state->pnn_list, state->count, state->caps,
@@ -1734,7 +1734,7 @@ static void recover_db_collect_done(struct tevent_req 
*subreq)
        int ret;
        bool status;
 
-       if (state->persistent && state->tun_list->recover_pdb_by_seqnum != 0) {
+       if (state->persistent) {
                status = collect_highseqnum_db_recv(subreq, &ret);
        } else {
                status = collect_all_db_recv(subreq, &ret);
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index aecb7e0..99bb715 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -36,11 +36,12 @@
 
 #include "common/reqid.h"
 #include "common/system.h"
-#include "common/cmdline.h"
 #include "common/common.h"
 #include "common/logging.h"
 
 static struct {
+       const char *socket;
+       const char *debuglevel;
        const char *nlist;
        const char *transport;
        const char *myaddress;
@@ -62,7 +63,9 @@ static struct {
        int         script_log_level;
        int         no_publicipcheck;
        int         max_persistent_check_errors;
+       int         torture;
 } options = {
+       .socket = CTDB_RUNDIR "/ctdbd.socket",
        .nlist = NULL,
        .public_address_list = NULL,
        .transport = "tcp",
@@ -116,7 +119,8 @@ int main(int argc, const char *argv[])
 
        struct poptOption popt_options[] = {
                POPT_AUTOHELP
-               POPT_CTDB_CMDLINE
+               { "socket", 0, POPT_ARG_STRING, &options.socket, 0, "local 
socket name", "filename" },
+               { "debug", 'd', POPT_ARG_STRING, &options.debuglevel, 0, "debug 
level", NULL },
                { "interactive", 'i', POPT_ARG_NONE, &interactive, 0, "don't 
fork", NULL },
                { "public-addresses", 0, POPT_ARG_STRING, 
&options.public_address_list, 0, "public address list file", "filename" },
                { "public-interface", 0, POPT_ARG_STRING, 
&options.public_interface, 0, "public interface", "interface"},
@@ -143,6 +147,7 @@ int main(int argc, const char *argv[])
                  &options.max_persistent_check_errors, 0,
                  "max allowed persistent check errors (default 0)", NULL },
                { "sloppy-start", 0, POPT_ARG_NONE, &fast_start, 0, "Do not 
perform full recovery on start", NULL },
+               { "torture", 0, POPT_ARG_NONE, &options.torture, 0, "enable 
nastiness in library", NULL },
                POPT_TABLEEND
        };
        int opt, ret;
@@ -150,6 +155,7 @@ int main(int argc, const char *argv[])
        int extra_argc = 0;
        poptContext pc;
        struct tevent_context *ev;
+       enum debug_level log_level;
 
        pc = poptGetContext(argv[0], argc, argv, popt_options, 
POPT_CONTEXT_KEEP_FIRST);
 
@@ -180,7 +186,29 @@ int main(int argc, const char *argv[])
        }
        tevent_loop_allow_nesting(ev);
 
-       ctdb = ctdb_cmdline_init(ev);
+       ctdb = ctdb_init(ev);
+       if (ctdb == NULL) {
+               fprintf(stderr, "Failed to init ctdb\n");
+               exit(1);
+       }
+
+       if (options.torture == 1) {
+               ctdb_set_flags(ctdb, CTDB_FLAG_TORTURE);
+       }
+
+       /* Set the debug level */
+       if (debug_level_parse(options.debuglevel, &log_level)) {
+               DEBUGLEVEL = debug_level_to_int(log_level);
+       } else {
+               DEBUGLEVEL = debug_level_to_int(DEBUG_NOTICE);
+       }
+
+       setenv("CTDB_SOCKET", options.socket, 1);
+       ret = ctdb_set_socketname(ctdb, options.socket);
+       if (ret == -1) {
+               fprintf(stderr, "ctdb_set_socketname() failed\n");
+               exit(1);
+       }
 
        ctdb->start_as_disabled = options.start_as_disabled;
        ctdb->start_as_stopped  = options.start_as_stopped;
diff --git a/ctdb/tests/simple/70_recoverpdbbyseqnum.sh 
b/ctdb/tests/simple/70_recoverpdbbyseqnum.sh
index a4765b1..255d58d 100755
--- a/ctdb/tests/simple/70_recoverpdbbyseqnum.sh
+++ b/ctdb/tests/simple/70_recoverpdbbyseqnum.sh
@@ -3,16 +3,10 @@
 test_info()
 {
     cat <<EOF
-The tunable RecoverPDBBySeqNum controls how we perform recovery
-on persistent databases.
-The default is that persistent databases are recovered exactly the same
-way as normal databases. That is that we recover record by record.
-
-If RecoverPDBBySeqNum is set to 1 AND if a record with the key
-"__db_sequence_number__" can be found in the database, then instead we will
-perform the recovery by picking the copy of the database from the node
-that has the highest sequence number and ignore the content on all other
-nodes.
+The persistent databases are recovered using sequence number.
+The recovery is performed by picking the copy of the database from the
+node that has the highest sequence number and ignore the content on all
+other nodes.
 
 
 Prerequisites:
@@ -23,19 +17,12 @@ Steps:
 
 1. Verify that the status on all of the ctdb nodes is 'OK'.
 2. create a persistent test database
-3. test that RecoveryPDBBySeqNum==0 and no seqnum record blends the database
-   during recovery
-4. test that RecoveryPDBBySeqNum==0 and seqnum record blends the database
-   during recovery
-5. test that RecoveryPDBBySeqNum==1 and no seqnum record blends the database
-   during recovery
-6. test that RecoveryPDBBySeqNum==1 and seqnum record does not blend the 
database
-   during recovery
+3. test that no seqnum record blends the database during recovery
+4. test that seqnum record does not blend the database during recovery
 
 Expected results:
 
-* that 3,4,5 will blend the databases and that 6 will recovery the highest 
seqnum
-  database
+* that 3,4 will recover the highest seqnum database
 
 EOF
 }
@@ -70,90 +57,14 @@ test_db="persistent_test.tdb"
 echo "Create persistent test database \"$test_db\""
 try_command_on_node 0 $CTDB attach "$test_db" persistent
 
-
-echo "Setting RecoverPDBBySeqNum=0"
-try_command_on_node all $CTDB setvar "RecoverPDBBySeqNum" 0
-
-# 3.
-# If RecoverPDBBySeqNum==0  and no __db_sequence_number__
-# recover record by record
+# 3,
+# If no __db_sequence_number__ recover whole database
 #
-# wipe database
-echo
-echo "Test that RecoverPDBBySeqNum=0 and no __db_sequence_number__ blends the 
database during recovery"
-
-echo "Wipe test database"
-try_command_on_node 0 $CTDB wipedb "$test_db"
-
-add_record_per_node
-
-# force a recovery
-echo "Force a recovery"
-try_command_on_node 0 $CTDB recover
-
-# check that we now have both records on node 0
-num_records=$(db_ctdb_cattdb_count_records 0 "$test_db")
-if [ $num_records = "$num_nodes" ] ; then
-    echo "OK: databases were blended"
-else
-    echo "BAD: we did not end up with the expected $num_nodes records after 
the recovery"
-    exit 1
-fi
-
-# 4.
-# If RecoverPDBBySeqNum==0  and __db_sequence_number__
-# recover record by record
-#
-# wipe database
-echo
-echo "Test that RecoverPDBBySeqNum=0 and __db_sequence_number__ blends the 
database during recovery"
-
-echo "Wipe the test database"
-try_command_on_node 0 $CTDB wipedb persistent_test.tdb
-
-add_record_per_node
-
-echo "Add __db_sequence_number__==5 record to all nodes"
-pnn=0
-while [ $pnn -lt $num_nodes ] ; do
-    db_ctdb_tstore_dbseqnum $pnn "$test_db" 5
-    pnn=$(($pnn + 1))
-done
-
-echo "Set __db_sequence_number__ to 7 on node 0"
-db_ctdb_tstore_dbseqnum 0 "$test_db" 7
 
-echo "Set __db_sequence_number__ to 8 on node 1"
-db_ctdb_tstore_dbseqnum 1 "$test_db" 8
-
-# force a recovery
-echo "Force a recovery"
-try_command_on_node 0 $CTDB recover
-
-# check that we now have both records on node 0
-num_records=$(db_ctdb_cattdb_count_records 0 "$test_db")
-if [ $num_records = "$num_nodes" ] ; then
-    echo "OK: databases were blended"
-else
-    echo "BAD: we did not end up with the expected $num_nodes records after 
the recovery"
-    try_command_on_node -v 0 $CTDB cattdb "$test_db"
-    exit 1
-fi
-
-
-# set RecoverPDBBySeqNum=1
 echo
-echo "Setting RecoverPDBBySeqNum to 1"
-try_command_on_node all $CTDB setvar "RecoverPDBBySeqNum" 1
-


-- 
Samba Shared Repository

Reply via email to