diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-04-21 07:23:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:51:17 -0500 |
commit | 650d81b252cc669ef848448afad7e9bb79c4f20e (patch) | |
tree | 7108ada18c4d7fff581470791832850c17eab6bf /source4/cluster/ctdb/tests/ctdb_fetch.c | |
parent | 66a9f1e2764900a2c22a4bfad9f9caf3db729385 (diff) | |
download | samba-650d81b252cc669ef848448afad7e9bb79c4f20e.tar.gz samba-650d81b252cc669ef848448afad7e9bb79c4f20e.tar.bz2 samba-650d81b252cc669ef848448afad7e9bb79c4f20e.zip |
r22421: merged in latest ctdb changes from bzr
(This used to be commit 3633f862b966866819c9a0a6ad0238a858e15e62)
Diffstat (limited to 'source4/cluster/ctdb/tests/ctdb_fetch.c')
-rw-r--r-- | source4/cluster/ctdb/tests/ctdb_fetch.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/source4/cluster/ctdb/tests/ctdb_fetch.c b/source4/cluster/ctdb/tests/ctdb_fetch.c index febaf13fe4..39bd861fc1 100644 --- a/source4/cluster/ctdb/tests/ctdb_fetch.c +++ b/source4/cluster/ctdb/tests/ctdb_fetch.c @@ -22,7 +22,7 @@ #include "lib/events/events.h" #include "system/filesys.h" #include "popt.h" -#include "tests/cmdline.h" +#include "cmdline.h" #include <sys/time.h> #include <time.h> @@ -58,18 +58,18 @@ static int msg_count; static void bench_fetch_1node(struct ctdb_context *ctdb) { TDB_DATA key, data, nulldata; - struct ctdb_record_handle *rec; struct ctdb_db_context *ctdb_db; TALLOC_CTX *tmp_ctx = talloc_new(ctdb); int dest, ret; + struct ctdb_record_handle *h; - key.dptr = discard_const("testkey"); - key.dsize = strlen((const char *)key.dptr); + key.dptr = discard_const(TESTKEY); + key.dsize = strlen(TESTKEY); ctdb_db = ctdb_db_handle(ctdb, "test.tdb"); - rec = ctdb_fetch_lock(ctdb_db, tmp_ctx, key, &data); - if (rec == NULL) { + h = ctdb_fetch_lock(ctdb_db, tmp_ctx, key, &data); + if (h == NULL) { printf("Failed to fetch record '%s' on node %d\n", (const char *)key.dptr, ctdb_get_vnn(ctdb)); talloc_free(tmp_ctx); @@ -88,7 +88,8 @@ static void bench_fetch_1node(struct ctdb_context *ctdb) msg_count, ctdb_get_vnn(ctdb)); data.dsize = strlen((const char *)data.dptr)+1; - ret = ctdb_store_unlock(rec, data); + ret = ctdb_record_store(h, data); + talloc_free(h); if (ret != 0) { printf("Failed to store record\n"); } @@ -141,6 +142,10 @@ static void bench_fetch(struct ctdb_context *ctdb, struct event_context *ev) printf("Event loop failed!\n"); break; } + + if (LogLevel > 9) { + talloc_report_null_full(); + } } printf("Fetch: %.2f msgs/sec\n", msg_count/end_timer()); @@ -192,6 +197,8 @@ int main(int argc, const char *argv[]) } } + /* talloc_enable_leak_report_full(); */ + /* setup the remaining options for the main program to use */ extra_argv = poptGetArgs(pc); if (extra_argv) { @@ -240,7 +247,8 @@ int main(int argc, const char *argv[]) printf("DATA:\n%s\n", (char *)call.reply_data.dptr); - /* shut it down */ - talloc_free(ctdb); + /* go into a wait loop to allow other nodes to complete */ + ctdb_shutdown(ctdb); + return 0; } |