[SCM] Samba Shared Repository - branch v4-7-test updated

Karolin Seeger kseeger at samba.org
Mon Jul 9 15:30:03 UTC 2018


The branch, v4-7-test has been updated
       via  58403cb s3/notifyd.c: Rename CTDB_BROADCAST_VNNMAP to CTDB_BROADCAST_ACTIVE.
       via  516448f ctdb-tests: Avoid segfault by initializing logging
       via  bea8c19 ctdb-tests: Avoid segfault by initializing logging
       via  5f0ba9c ctdb-pmda: Use modified API in pcp library 4.0
       via  66d36b3 socket_wrapper: Add missing dependency on tirpc
       via  7fd58cb ctdb-daemon: Only consider client ID for local database attach
       via  b521f79 ctdb-docs: Fix the documentation for VNN map
       via  99d490d ctdb-server: Rename CTDB_BROADCAST_VNNMAP -> CTDB_BROADCAST_ACTIVE
       via  9352dd5 ctdb-tests: Add a simple test for database traverses
       via  93c09bd ctdb-tests: Add check for non-lmaster node status in integration tests
      from  e728f9f s4:kcc: Add a NULL check before qsort()

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-7-test


- Log -----------------------------------------------------------------
commit 58403cb7053d8f0131e2780deb004ae094aa2d5c
Author: Karolin Seeger <kseeger at samba.org>
Date:   Fri Jul 6 12:38:02 2018 +0200

    s3/notifyd.c: Rename CTDB_BROADCAST_VNNMAP to CTDB_BROADCAST_ACTIVE.
    
    This fixes the build. Was introduced by a fix for
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13499.
    
    Signed-off-by: Karolin Seeger <kseeger at samba.org>
    
    Autobuild-User(v4-7-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-7-test): Mon Jul  9 17:29:44 CEST 2018 on sn-devel-144

commit 516448f203ea4fa721656fe7c92172ba9bdb44a9
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 5 13:40:33 2018 +1000

    ctdb-tests: Avoid segfault by initializing logging
    
    This is in addition to af697008531.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Thu Jul  5 15:22:16 CEST 2018 on sn-devel-144
    
    (cherry picked from commit a30ac853ff9bca023c53ad98775eabb23156c566)

commit bea8c194633dc0a9079c19ec213709663a6f5c46
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jun 21 20:00:41 2018 +1000

    ctdb-tests: Avoid segfault by initializing logging
    
    Setting DEBUGLEVEL before calling debug_init() causes segmentation
    violation with gcc8.  DEBUGLEVEL_CLASS is statically initialized to
    debug_class_list_initial which is defined as const.  Only after
    debug_init() is called, DEBUGLEVEL_CLASS becomes a talloc'd array.
    
    So before modifying DEBUGLEVEL, ensure debug_init() is called via
    setup_logging().  (debug_init is a static function.)
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit af697008531bd74546656841dd3a1ed92522fc57)

commit 5f0ba9c1d94681eb14636509702b720f50bb37ae
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 1 12:32:26 2018 +1100

    ctdb-pmda: Use modified API in pcp library 4.0
    
    Support backward compatibility by checking for __pmID_int type, which
    was previously in <pcp/impl.h>.  In the new version, this type is not
    defined anymore and there is no need to include <pcp/impl.h>.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Fri Mar  2 00:38:52 CET 2018 on sn-devel-144
    
    (cherry picked from commit 426e4a5a20cff73a80d80b46f15826deac3f934f)

commit 66d36b3199166ff40234fba1bdbd32e02686c164
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon May 14 16:52:58 2018 +1000

    socket_wrapper: Add missing dependency on tirpc
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Tue May 22 13:57:07 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 7049b2153b08152f03a0fcbb1817b430fe0a8451)

commit 7fd58cbec458a353f8732c7becadb5fc2315695c
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 26 20:12:23 2018 +1000

    ctdb-daemon: Only consider client ID for local database attach
    
    The comment immediately above this code says "don't allow local
    clients to attach" and then looks up the client ID regardless of
    whether the request is local or remote.
    
    This means that an intentional remote attach from a client will not
    work correctly.  No real client should ever do that since clients
    attach so they an access databases locally.  Perhaps some sanity
    checks should be added.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13500
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 63255ef92552da92956c05160f33622d0bbc3a28)

commit b521f79e4ab64c0de5f1c9a81f051fb1f3a8514d
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jun 15 06:07:54 2018 +1000

    ctdb-docs: Fix the documentation for VNN map
    
    It is incorrectly says that nodes not in the VNN map can not be
    DMASTER.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13499
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit af446d5209e37a38363911e5f339869b73d87963)

commit 99d490d3ecfbd51e60680dd20bb6a2b9d13abf7d
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jun 15 06:01:52 2018 +1000

    ctdb-server: Rename CTDB_BROADCAST_VNNMAP -> CTDB_BROADCAST_ACTIVE
    
    This broadcast is misnamed.  Both places where this type of broadcast
    is used expect the broadcast to go to all active nodes.
    
    Make the corresponding change to the semantics in the daemon by
    sending to all active nodes.
    
    There is a mismatch between the ideas of VNN map and active nodes.  A
    node that is not in the VNN map but is active can still host database
    records.  These were the same until the LMASTER capability was
    introduced and then the logic was not updated.
    
    The only place where the VNN map is relevant is when finding the
    location master of a record in the migration code.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13499
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 36938bfdd075a174daecb466085702adfe6a6c09)

commit 9352dd5ea0d441b4794d11aaced76e1457a4b61c
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jun 15 05:51:45 2018 +1000

    ctdb-tests: Add a simple test for database traverses
    
    This tests that volatile databases traverse correctly, including the
    case where a record was updated on a non-lmaster node.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13499
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit ec72fadecd5233234947633360fe46a3a4053c07)

commit 93c09bdb458c49d68304b849a88a59227d1dad03
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jun 15 05:51:17 2018 +1000

    ctdb-tests: Add check for non-lmaster node status in integration tests
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13499
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 4b008556d6b1f07fd5057af845526bf941497f18)

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

Summary of changes:
 ctdb/doc/ctdb.1.xml                          |  7 +--
 ctdb/include/ctdb_private.h                  |  7 ++-
 ctdb/protocol/protocol.h                     |  2 +-
 ctdb/protocol/protocol_debug.c               |  4 +-
 ctdb/server/ctdb_control.c                   | 36 ++++++++---
 ctdb/server/ctdb_ltdb_server.c               | 21 +++++--
 ctdb/server/ctdb_server.c                    | 16 +++--
 ctdb/server/ctdb_traverse.c                  |  4 +-
 ctdb/tests/scripts/integration.bash          |  1 +
 ctdb/tests/simple/79_volatile_db_traverse.sh | 94 ++++++++++++++++++++++++++++
 ctdb/tests/src/ctdb_takeover_tests.c         |  2 +
 ctdb/tests/src/fetch_loop.c                  |  3 +
 ctdb/tests/src/fetch_loop_key.c              |  3 +
 ctdb/tests/src/fetch_readonly.c              |  3 +
 ctdb/tests/src/fetch_readonly_loop.c         |  3 +
 ctdb/tests/src/fetch_ring.c                  |  3 +
 ctdb/tests/src/g_lock_loop.c                 |  4 +-
 ctdb/tests/src/message_ring.c                |  3 +
 ctdb/tests/src/transaction_loop.c            |  3 +
 ctdb/tests/src/update_record.c               |  3 +
 ctdb/tests/src/update_record_persistent.c    |  3 +
 ctdb/utils/pmda/pmda_ctdb.c                  | 30 ++++++---
 ctdb/wscript                                 |  3 +-
 lib/socket_wrapper/wscript                   |  2 +-
 source3/smbd/notifyd/notifyd.c               |  4 +-
 25 files changed, 216 insertions(+), 48 deletions(-)
 create mode 100755 ctdb/tests/simple/79_volatile_db_traverse.sh


Changeset truncated at 500 lines:

diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml
index 471d825..ae3b9d3 100644
--- a/ctdb/doc/ctdb.1.xml
+++ b/ctdb/doc/ctdb.1.xml
@@ -292,10 +292,9 @@
 	<title>Virtual Node Number (VNN) map</title>
 	<para>
 	  Consists of the number of virtual nodes and mapping from
-	  virtual node numbers to physical node numbers.  Virtual
-	  nodes host CTDB databases.  Only nodes that are
-	  participating in the VNN map can become lmaster or dmaster
-	  for database records.
+	  virtual node numbers to physical node numbers.  Only nodes
+	  that are participating in the VNN map can become lmaster for
+	  database records.
 	</para>
       </refsect3>
 
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index da3760d..03e0068 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -724,9 +724,12 @@ int ctdb_set_db_readonly(struct ctdb_context *ctdb,
 
 int ctdb_process_deferred_attach(struct ctdb_context *ctdb);
 
-int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
+int32_t ctdb_control_db_attach(struct ctdb_context *ctdb,
+			       TDB_DATA indata,
 			       TDB_DATA *outdata,
-			       uint8_t db_flags, uint32_t client_id,
+			       uint8_t db_flags,
+			       uint32_t srcnode,
+			       uint32_t client_id,
 			       struct ctdb_req_control_old *c,
 			       bool *async_reply);
 int32_t ctdb_control_db_detach(struct ctdb_context *ctdb, TDB_DATA indata,
diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h
index e116b3a..07554b5 100644
--- a/ctdb/protocol/protocol.h
+++ b/ctdb/protocol/protocol.h
@@ -43,7 +43,7 @@ enum ctdb_operation {
 /* send a broadcast to all nodes in the cluster, active or not */
 #define CTDB_BROADCAST_ALL    0xF0000002
 /* send a broadcast to all nodes in the current vnn map */
-#define CTDB_BROADCAST_VNNMAP 0xF0000003
+#define CTDB_BROADCAST_ACTIVE 0xF0000003
 /* send a broadcast to all connected nodes */
 #define CTDB_BROADCAST_CONNECTED 0xF0000004
 /* send a broadcast to selected connected nodes */
diff --git a/ctdb/protocol/protocol_debug.c b/ctdb/protocol/protocol_debug.c
index 7c6d862..163bb41 100644
--- a/ctdb/protocol/protocol_debug.c
+++ b/ctdb/protocol/protocol_debug.c
@@ -262,8 +262,8 @@ static void ctdb_pnn_print(uint32_t pnn, FILE *fp)
 		fprintf(fp, "CURRENT");
 	} else if (pnn == CTDB_BROADCAST_ALL) {
 		fprintf(fp, "ALL");
-	} else if (pnn == CTDB_BROADCAST_VNNMAP) {
-		fprintf(fp, "VNNMAP");
+	} else if (pnn == CTDB_BROADCAST_ACTIVE) {
+		fprintf(fp, "ACTIVE");
 	} else  if (pnn == CTDB_BROADCAST_CONNECTED) {
 		fprintf(fp, "CONNECTED");
 	} else if (pnn == CTDB_MULTICAST) {
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index 6835cca..063cd1d 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -267,18 +267,34 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 	}
 
 	case CTDB_CONTROL_DB_ATTACH:
-	  return ctdb_control_db_attach(ctdb, indata, outdata, 0, client_id,
-					c, async_reply);
+	  return ctdb_control_db_attach(ctdb,
+					indata,
+					outdata,
+					0,
+					srcnode,
+					client_id,
+					c,
+					async_reply);
 
 	case CTDB_CONTROL_DB_ATTACH_PERSISTENT:
-	  return ctdb_control_db_attach(ctdb, indata, outdata,
-					CTDB_DB_FLAGS_PERSISTENT, client_id,
-					c, async_reply);
+	  return ctdb_control_db_attach(ctdb,
+					indata,
+					outdata,
+					CTDB_DB_FLAGS_PERSISTENT,
+					srcnode,
+					client_id,
+					c,
+					async_reply);
 
 	case CTDB_CONTROL_DB_ATTACH_REPLICATED:
-	  return ctdb_control_db_attach(ctdb, indata, outdata,
-					CTDB_DB_FLAGS_REPLICATED, client_id,
-					c, async_reply);
+	  return ctdb_control_db_attach(ctdb,
+					indata,
+					outdata,
+					CTDB_DB_FLAGS_REPLICATED,
+					srcnode,
+					client_id,
+					c,
+					async_reply);
 
 	case CTDB_CONTROL_SET_CALL:
 		return control_not_implemented("SET_CALL", NULL);
@@ -859,7 +875,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
 		return -1;
 	}
 
-	if (((destnode == CTDB_BROADCAST_VNNMAP) || 
+	if (((destnode == CTDB_BROADCAST_ACTIVE) ||
 	     (destnode == CTDB_BROADCAST_ALL) ||
 	     (destnode == CTDB_BROADCAST_CONNECTED)) && 
 	    !(flags & CTDB_CTRL_FLAG_NOREPLY)) {
@@ -867,7 +883,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
 		return -1;
 	}
 
-	if (destnode != CTDB_BROADCAST_VNNMAP && 
+	if (destnode != CTDB_BROADCAST_ACTIVE &&
 	    destnode != CTDB_BROADCAST_ALL && 
 	    destnode != CTDB_BROADCAST_CONNECTED && 
 	    (!ctdb_validate_pnn(ctdb, destnode) || 
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c
index c199aac..ca5bb12 100644
--- a/ctdb/server/ctdb_ltdb_server.c
+++ b/ctdb/server/ctdb_ltdb_server.c
@@ -1105,9 +1105,12 @@ int ctdb_process_deferred_attach(struct ctdb_context *ctdb)
 /*
   a client has asked to attach a new database
  */
-int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
+int32_t ctdb_control_db_attach(struct ctdb_context *ctdb,
+			       TDB_DATA indata,
 			       TDB_DATA *outdata,
-			       uint8_t db_flags, uint32_t client_id,
+			       uint8_t db_flags,
+			       uint32_t srcnode,
+			       uint32_t client_id,
 			       struct ctdb_req_control_old *c,
 			       bool *async_reply)
 {
@@ -1128,7 +1131,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
 	 * allow all attach from the network since these are always from remote
 	 * recovery daemons.
 	 */
-	if (client_id != 0) {
+	if (srcnode == ctdb->pnn && client_id != 0) {
 		client = reqid_find(ctdb->idr, client_id, struct ctdb_client);
 	}
 	if (client != NULL) {
@@ -1535,9 +1538,15 @@ static void ctdb_ltdb_seqnum_check(struct tevent_context *ev,
 		TDB_DATA data;
 		data.dptr = (uint8_t *)&ctdb_db->db_id;
 		data.dsize = sizeof(uint32_t);
-		ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0,
-					 CTDB_CONTROL_UPDATE_SEQNUM, 0, CTDB_CTRL_FLAG_NOREPLY,
-					 data, NULL, NULL);		
+		ctdb_daemon_send_control(ctdb,
+					 CTDB_BROADCAST_ACTIVE,
+					 0,
+					 CTDB_CONTROL_UPDATE_SEQNUM,
+					 0,
+					 CTDB_CTRL_FLAG_NOREPLY,
+					 data,
+					 NULL,
+					 NULL);
 	}
 	ctdb_db->seqnum = new_seqnum;
 
diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c
index 9006741..93256ec 100644
--- a/ctdb/server/ctdb_server.c
+++ b/ctdb/server/ctdb_server.c
@@ -389,14 +389,18 @@ static void ctdb_broadcast_packet_all(struct ctdb_context *ctdb,
 }
 
 /*
-  broadcast a packet to all nodes in the current vnnmap
+  broadcast a packet to all active nodes
 */
-static void ctdb_broadcast_packet_vnnmap(struct ctdb_context *ctdb, 
+static void ctdb_broadcast_packet_active(struct ctdb_context *ctdb,
 					 struct ctdb_req_header *hdr)
 {
 	int i;
-	for (i=0;i<ctdb->vnn_map->size;i++) {
-		hdr->destnode = ctdb->vnn_map->map[i];
+	for (i = 0; i < ctdb->num_nodes; i++) {
+		if (ctdb->nodes[i]->flags & NODE_FLAGS_INACTIVE) {
+			continue;
+		}
+
+		hdr->destnode = ctdb->nodes[i]->pnn;
 		ctdb_queue_packet(ctdb, hdr);
 	}
 }
@@ -430,8 +434,8 @@ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 	case CTDB_BROADCAST_ALL:
 		ctdb_broadcast_packet_all(ctdb, hdr);
 		return;
-	case CTDB_BROADCAST_VNNMAP:
-		ctdb_broadcast_packet_vnnmap(ctdb, hdr);
+	case CTDB_BROADCAST_ACTIVE:
+		ctdb_broadcast_packet_active(ctdb, hdr);
 		return;
 	case CTDB_BROADCAST_CONNECTED:
 		ctdb_broadcast_packet_connected(ctdb, hdr);
diff --git a/ctdb/server/ctdb_traverse.c b/ctdb/server/ctdb_traverse.c
index 04a4113..5ea1970 100644
--- a/ctdb/server/ctdb_traverse.c
+++ b/ctdb/server/ctdb_traverse.c
@@ -387,8 +387,8 @@ static struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_
 	}
 
 	if (ctdb_db_volatile(ctdb_db)) {
-		/* normal database, traverse all nodes */	  
-		destination = CTDB_BROADCAST_VNNMAP;
+		/* volatile database, traverse all active nodes */
+		destination = CTDB_BROADCAST_ACTIVE;
 	} else {
 		int i;
 		/* persistent database, traverse one node, preferably
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index d72c471..4cdbb7c 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -338,6 +338,7 @@ node_has_status ()
 	(monon)        mpat='^Monitoring mode:ACTIVE \(0\)$' ;;
 	(monoff)       mpat='^Monitoring mode:DISABLED \(1\)$' ;;
 	(recovered)    rpat='^Recovery mode:RECOVERY \(1\)$' ;;
+	(notlmaster)   rpat="^hash:.* lmaster:${pnn}\$" ;;
 	*)
 	    echo "node_has_status: unknown status \"$status\""
 	    return 1
diff --git a/ctdb/tests/simple/79_volatile_db_traverse.sh b/ctdb/tests/simple/79_volatile_db_traverse.sh
new file mode 100755
index 0000000..50732ca
--- /dev/null
+++ b/ctdb/tests/simple/79_volatile_db_traverse.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+test_info()
+{
+    cat <<EOF
+Confirm that traverses of volatile databases work as expected
+
+This is a very simple example.  It writes a single record, updates it
+on another node and then confirms that the correct value is found when
+traversing.  It then repeats this after removing the LMASTER role from
+the node where the value is updated.
+
+Expected results:
+
+* The expected records should be found
+
+EOF
+}
+
+. "${TEST_SCRIPTS_DIR}/integration.bash"
+
+ctdb_test_init "$@"
+
+set -e
+
+cluster_is_healthy
+
+# Reset configuration
+ctdb_restart_when_done
+
+#
+# Main test
+#
+TESTDB="traverse_db.tdb"
+
+echo "create volatile test database $TESTDB"
+try_command_on_node 0 $CTDB attach "$TESTDB"
+
+echo "wipe test database $TESTDB"
+try_command_on_node 0 $CTDB wipedb "$TESTDB"
+
+echo "write foo=bar0 on node 0"
+try_command_on_node 0 $CTDB writekey "$TESTDB" "foo" "bar0"
+
+echo "write foo=bar1 on node 1"
+try_command_on_node 1 $CTDB writekey "$TESTDB" "foo" "bar1"
+
+echo "do traverse on node 0"
+try_command_on_node -v 0 $CTDB catdb "$TESTDB"
+
+echo "do traverse on node 1"
+try_command_on_node -v 1 $CTDB catdb "$TESTDB"
+
+cat <<EOF
+
+Again, this time with lmaster role off on node 1
+
+EOF
+
+echo "wipe test database $TESTDB"
+try_command_on_node 0 $CTDB wipedb "$TESTDB"
+
+echo "switching off lmaster role on node 1"
+try_command_on_node 1 $CTDB setlmasterrole off
+
+try_command_on_node -v 1 $CTDB getcapabilities
+
+wait_until_node_has_status 1 notlmaster 10 0
+# Wait for recovery and new VNN map to be pushed
+#sleep_for 10
+
+echo "write foo=bar0 on node 0"
+try_command_on_node 0 $CTDB writekey "$TESTDB" "foo" "bar0"
+
+echo "write foo=bar1 on node 1"
+try_command_on_node 1 $CTDB writekey "$TESTDB" "foo" "bar1"
+
+echo "do traverse on node 0"
+try_command_on_node -v 0 $CTDB catdb "$TESTDB"
+
+num=$(echo "$out" | sed -n -e 's|^Dumped \(.*\) records$|\1|p')
+if [ "$num" = 1 ] ; then
+	echo "OK: There was 1 record"
+else
+	echo "BAD: There were ${num} (!= 1) records"
+	exit 1
+fi
+
+if echo "$out" | grep -q "^data(4) = \"bar1\"\$" ; then
+	echo "OK: Data from node 1 was returned"
+else
+	echo "BAD: Data from node 1 was not returned"
+	exit 1
+fi
diff --git a/ctdb/tests/src/ctdb_takeover_tests.c b/ctdb/tests/src/ctdb_takeover_tests.c
index 5093757..f78114a 100644
--- a/ctdb/tests/src/ctdb_takeover_tests.c
+++ b/ctdb/tests/src/ctdb_takeover_tests.c
@@ -254,6 +254,8 @@ int main(int argc, const char *argv[])
 	int loglevel;
 	const char *debuglevelstr = getenv("CTDB_TEST_LOGLEVEL");
 
+	setup_logging("ctdb_takeover_tests", DEBUG_STDERR);
+
 	if (! debug_level_parse(debuglevelstr, &loglevel)) {
                 loglevel = DEBUG_DEBUG;
         }
diff --git a/ctdb/tests/src/fetch_loop.c b/ctdb/tests/src/fetch_loop.c
index 6767f71..0e1d9da 100644
--- a/ctdb/tests/src/fetch_loop.c
+++ b/ctdb/tests/src/fetch_loop.c
@@ -20,6 +20,7 @@
 #include "replace.h"
 #include "system/network.h"
 
+#include "lib/util/debug.h"
 #include "lib/util/tevent_unix.h"
 
 #include "client/client.h"
@@ -230,6 +231,8 @@ int main(int argc, const char *argv[])
 	int ret;
 	bool status;
 
+	setup_logging("fetch_loop", DEBUG_STDERR);
+
 	status = process_options_basic(argc, argv, &opts);
 	if (! status) {
 		exit(1);
diff --git a/ctdb/tests/src/fetch_loop_key.c b/ctdb/tests/src/fetch_loop_key.c
index b137842..3f41ca7 100644
--- a/ctdb/tests/src/fetch_loop_key.c
+++ b/ctdb/tests/src/fetch_loop_key.c
@@ -20,6 +20,7 @@
 #include "replace.h"
 #include "system/network.h"
 
+#include "lib/util/debug.h"
 #include "lib/util/tevent_unix.h"
 
 #include "client/client.h"
@@ -155,6 +156,8 @@ int main(int argc, const char *argv[])
 	int ret;
 	bool status;
 
+	setup_logging("fetch_loop_key", DEBUG_STDERR);
+
 	status = process_options_database(argc, argv, &opts);
 	if (! status) {
 		exit(1);
diff --git a/ctdb/tests/src/fetch_readonly.c b/ctdb/tests/src/fetch_readonly.c
index 5d2972a..ff126bd 100644
--- a/ctdb/tests/src/fetch_readonly.c
+++ b/ctdb/tests/src/fetch_readonly.c
@@ -20,6 +20,7 @@
 #include "replace.h"
 #include "system/network.h"
 
+#include "lib/util/debug.h"
 #include "lib/util/tevent_unix.h"
 
 #include "client/client.h"
@@ -107,6 +108,8 @@ int main(int argc, const char *argv[])
 	int ret;
 	bool status;
 
+	setup_logging("fetch_readonly", DEBUG_STDERR);
+
 	status = process_options_database(argc, argv, &opts);
 	if (! status) {
 		exit(1);
diff --git a/ctdb/tests/src/fetch_readonly_loop.c b/ctdb/tests/src/fetch_readonly_loop.c
index 9d5d22e..08cf476 100644
--- a/ctdb/tests/src/fetch_readonly_loop.c
+++ b/ctdb/tests/src/fetch_readonly_loop.c
@@ -20,6 +20,7 @@
 #include "replace.h"
 #include "system/network.h"
 
+#include "lib/util/debug.h"
 #include "lib/util/tevent_unix.h"
 
 #include "client/client.h"
@@ -214,6 +215,8 @@ int main(int argc, const char *argv[])
 	int ret;
 	bool status;
 
+	setup_logging("fetch_readonly_loop", DEBUG_STDERR);
+
 	status = process_options_basic(argc, argv, &opts);
 	if (! status) {
 		exit(1);
diff --git a/ctdb/tests/src/fetch_ring.c b/ctdb/tests/src/fetch_ring.c
index eb64648..f746e78 100644
--- a/ctdb/tests/src/fetch_ring.c
+++ b/ctdb/tests/src/fetch_ring.c
@@ -20,6 +20,7 @@
 #include "replace.h"
 #include "system/network.h"
 
+#include "lib/util/debug.h"
 #include "lib/util/time.h"
 #include "lib/util/tevent_unix.h"
 
@@ -331,6 +332,8 @@ int main(int argc, const char *argv[])
 	int ret;
 	bool status;
 
+	setup_logging("fetch_ring", DEBUG_STDERR);
+
 	status = process_options_basic(argc, argv, &opts);
 	if (! status) {
 		exit(1);
diff --git a/ctdb/tests/src/g_lock_loop.c b/ctdb/tests/src/g_lock_loop.c
index f29d0f1..3b84241 100644
--- a/ctdb/tests/src/g_lock_loop.c
+++ b/ctdb/tests/src/g_lock_loop.c
@@ -213,6 +213,8 @@ int main(int argc, const char *argv[])
 	int ret;
 	bool status;
 
+	setup_logging("glock_loop", DEBUG_STDERR);
+
 	status = process_options_basic(argc, argv, &opts);
 	if (! status) {
 		exit(1);
@@ -230,8 +232,6 @@ int main(int argc, const char *argv[])
 		exit(1);
 	}
 
-	setup_logging("glock_loop", DEBUG_STDERR);
-
 	ret = ctdb_client_init(mem_ctx, ev, opts->socket, &client);
 	if (ret != 0) {
 		fprintf(stderr, "Failed to initialize client, ret=%d\n", ret);
diff --git a/ctdb/tests/src/message_ring.c b/ctdb/tests/src/message_ring.c
index dabae65..d1fcee4 100644
--- a/ctdb/tests/src/message_ring.c
+++ b/ctdb/tests/src/message_ring.c
@@ -20,6 +20,7 @@
 #include "replace.h"
 #include "system/network.h"
 
+#include "lib/util/debug.h"
 #include "lib/util/time.h"
 #include "lib/util/tevent_unix.h"
 
@@ -317,6 +318,8 @@ int main(int argc, const char *argv[])
 	int ret;
 	bool status;
 
+	setup_logging("message_ring", DEBUG_STDERR);
+


-- 
Samba Shared Repository



More information about the samba-cvs mailing list