]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
make test now works again
authorAndrew Tridgell <tridge@samba.org>
Sat, 2 Jun 2007 03:31:36 +0000 (13:31 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 2 Jun 2007 03:31:36 +0000 (13:31 +1000)
(This used to be ctdb commit 439d87bbb9840f82937e51aff4fe2b80160878c6)

ctdb/include/ctdb.h
ctdb/include/ctdb_private.h
ctdb/tests/bench.sh
ctdb/tests/ctdb_bench.c
ctdb/tests/ctdb_fetch.c
ctdb/tests/ctdbd.sh
ctdb/tests/fetch.sh

index 502dad8c2ac7749171ad437db4d0003c995aad2a..6dc5ffac5442d7275980c5a0a282eeeb94336e23 100644 (file)
@@ -72,6 +72,14 @@ struct ctdb_call_info {
  */
 #define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
 
+/* used on the domain socket, send a pdu to the local daemon */
+#define CTDB_CURRENT_NODE     0xF0000001
+/* 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
+
+
 struct event_context;
 
 /*
index a035af59abdf153332c32726e5f796071e91243a..c58441c9f3b5075e4c10c4e14c389e94d8890c03 100644 (file)
 #define CTDB_NULL_FUNC      0xFF000001
 #define CTDB_FETCH_FUNC     0xFF000002
 
-/* used on the domain socket, send a pdu to the local daemon */
-#define CTDB_CURRENT_NODE     0xF0000001
-/* 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_MAX_REDIRECT_COUNT 3
 #define CTDB_DEFAULT_SEQNUM_FREQUENCY 1
 
index 778619488dd0fa4b97c466e9a6b158dd41f8aba6..495abbffe8a0183e49a631a3654a42d153b61e35 100755 (executable)
@@ -20,8 +20,8 @@ done
 killall -9 ctdb_bench
 echo "Trying $NUMNODES nodes"
 for i in `seq 1 $NUMNODES`; do
-  $VALGRIND bin/ctdb_bench --nlist nodes.txt --socket sock.$i $* &
+  valgrind -q $VALGRIND bin/ctdb_bench --socket sock.$i -n $NUMNODES $*  &
 done
 
 wait
-ctdb shutdown --socket sock.1 -n all
+bin/ctdb shutdown --socket sock.1 -n all
index 4ea206f732f3a96587f44cfac5d29cdb69d9f067..2b4dba6e8fb7887016a24273501ca34a5bf66873 100644 (file)
@@ -44,8 +44,7 @@ static double end_timer(void)
 
 static int timelimit = 10;
 static int num_records = 10;
-static int num_msgs = 1;
-static uint32_t num_nodes;
+static int num_nodes;
 
 enum my_functions {FUNC_INCR=1, FUNC_FETCH=2};
 
@@ -109,7 +108,6 @@ static void bench_ring(struct ctdb_context *ctdb, struct event_context *ev)
        int vnn=ctdb_get_vnn(ctdb);
 
        if (vnn == 0) {
-               int i;
                /* two messages are injected into the ring, moving
                   in opposite directions */
                int dest, incr;
@@ -118,15 +116,13 @@ static void bench_ring(struct ctdb_context *ctdb, struct event_context *ev)
                data.dptr = (uint8_t *)&incr;
                data.dsize = sizeof(incr);
 
-               for (i=0;i<num_msgs;i++) {
-                       incr = 1;
-                       dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes;
-                       ctdb_send_message(ctdb, dest, 0, data);
-
-                       incr = -1;
-                       dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes;
-                       ctdb_send_message(ctdb, dest, 0, data);
-               }
+               incr = 1;
+               dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes;
+               ctdb_send_message(ctdb, dest, 0, data);
+               
+               incr = -1;
+               dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes;
+               ctdb_send_message(ctdb, dest, 0, data);
        }
        
        start_timer();
@@ -168,7 +164,7 @@ int main(int argc, const char *argv[])
                POPT_CTDB_CMDLINE
                { "timelimit", 't', POPT_ARG_INT, &timelimit, 0, "timelimit", "integer" },
                { "num-records", 'r', POPT_ARG_INT, &num_records, 0, "num_records", "integer" },
-               { "num-msgs", 'n', POPT_ARG_INT, &num_msgs, 0, "num_msgs", "integer" },
+               { NULL, 'n', POPT_ARG_INT, &num_nodes, 0, "num_nodes", "integer" },
                POPT_TABLEEND
        };
        int opt;
@@ -220,12 +216,13 @@ int main(int argc, const char *argv[])
                goto error;
 
        printf("Waiting for cluster\n");
-       while (!cluster_ready) {
+       while (1) {
+               uint32_t recmode=1;
+               ctdb_ctrl_getrecmode(ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
+               if (recmode == 0) break;
                event_loop_once(ev);
        }
 
-       ctdb_get_connected_nodes(ctdb, timeval_zero(), ctdb, &num_nodes);
-
        bench_ring(ctdb, ev);
        
 error:
index 4d761679d28cc66cacb8f1141206871a1c063dcb..83fa9ee413b062803b57b9d06aa5150e1a792dc4 100644 (file)
@@ -44,8 +44,7 @@ static double end_timer(void)
 
 static int timelimit = 10;
 static int num_records = 10;
-static int num_msgs = 1;
-static uint32_t num_nodes;
+static int num_nodes;
 static int msg_count;
 
 #define TESTKEY "testkey"
@@ -181,7 +180,7 @@ int main(int argc, const char *argv[])
                POPT_CTDB_CMDLINE
                { "timelimit", 't', POPT_ARG_INT, &timelimit, 0, "timelimit", "integer" },
                { "num-records", 'r', POPT_ARG_INT, &num_records, 0, "num_records", "integer" },
-               { "num-msgs", 'n', POPT_ARG_INT, &num_msgs, 0, "num_msgs", "integer" },
+               { NULL, 'n', POPT_ARG_INT, &num_nodes, 0, "num_nodes", "integer" },
                POPT_TABLEEND
        };
        int opt;
@@ -232,12 +231,13 @@ int main(int argc, const char *argv[])
        ctdb_set_message_handler(ctdb, 0, message_handler, &msg_count);
 
        printf("Waiting for cluster\n");
-       while (!cluster_ready) {
+       while (1) {
+               uint32_t recmode=1;
+               ctdb_ctrl_getrecmode(ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode);
+               if (recmode == 0) break;
                event_loop_once(ev);
        }
 
-       ctdb_get_connected_nodes(ctdb, timeval_zero(), ctdb, &num_nodes);
-
        bench_fetch(ctdb, ev);
 
        ZERO_STRUCT(call);
index e2c53b34f9ed8032d2be7a7e5c1cf2a4b3edc820..bcc9dec7dc09c7ce73e32d3b688a9db40f52d369 100755 (executable)
@@ -48,3 +48,4 @@ sleep 1
 
 echo "All done"
 killall -q ctdbd
+exit 0
index b5fdd1b08fefcd7c358e7d6b17d26a904306a5fe..a2123a6b34f2c605c4d5f74c69568a880b165166 100755 (executable)
@@ -18,9 +18,10 @@ done
 
 killall -9 -q ctdb_fetch
 for i in `seq 1 $NUMNODES`; do
-  $VALGRIND bin/ctdb_fetch --socket sock.$i $* &
+  $VALGRIND bin/ctdb_fetch --socket sock.$i -n $NUMNODES $* &
 done
 wait
 
 echo "Shutting down"
 bin/ctdb shutdown -n all --socket=sock.1
+exit 0