diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-04-17 22:39:23 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2007-04-17 22:39:23 +1000 |
commit | 98bb60e9d6fd68a5614f15517bd591e433956fe7 (patch) | |
tree | ba4f47417cca14373d43347134151300a767f19a /ctdb/common/ctdb_client.c | |
parent | 8a7b5733205f8ee4d51b37a90e5f74f7774ff4e7 (diff) | |
download | samba-98bb60e9d6fd68a5614f15517bd591e433956fe7.tar.gz samba-98bb60e9d6fd68a5614f15517bd591e433956fe7.tar.xz samba-98bb60e9d6fd68a5614f15517bd591e433956fe7.zip |
add debug tracing to fetch_lock
(This used to be ctdb commit b58d2ae0e4ef3393a93724526f2aebc7529de14f)
Diffstat (limited to 'ctdb/common/ctdb_client.c')
-rw-r--r-- | ctdb/common/ctdb_client.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ctdb/common/ctdb_client.c b/ctdb/common/ctdb_client.c index c6071e7ba1..1b5c80c6f4 100644 --- a/ctdb/common/ctdb_client.c +++ b/ctdb/common/ctdb_client.c @@ -414,6 +414,8 @@ void ctdb_connect_wait(struct ctdb_context *ctdb) r.hdr.ctdb_magic = CTDB_MAGIC; r.hdr.ctdb_version = CTDB_VERSION; r.hdr.operation = CTDB_REQ_CONNECT_WAIT; + + DEBUG(3,("ctdb_connect_wait: sending to ctdbd\n")); res = ctdb_queue_send(ctdb->daemon.queue, (uint8_t *)&r.hdr, r.hdr.length); if (res != 0) { @@ -421,6 +423,8 @@ void ctdb_connect_wait(struct ctdb_context *ctdb) return; } + DEBUG(3,("ctdb_connect_wait: waiting\n")); + /* now we can go into the normal wait routine, as the reply packet will update the ctdb->num_connected variable */ ctdb_daemon_connect_wait(ctdb); @@ -556,6 +560,9 @@ struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALL } h->data = data; + DEBUG(3,("ctdb_fetch_lock: key=%*.*s\n", key.dsize, key.dsize, + (const char *)key.dptr)); + /* step 1 - get the chain lock */ ret = ctdb_ltdb_lock(ctdb_db, key); if (ret != 0) { @@ -564,6 +571,8 @@ struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALL return NULL; } + DEBUG(4,("ctdb_fetch_lock: got chain lock\n")); + talloc_set_destructor(h, fetch_lock_destructor); ret = ctdb_ltdb_fetch(ctdb_db, key, &h->header, ctdb_db, data); @@ -572,19 +581,26 @@ struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALL return NULL; } + DEBUG(4,("ctdb_fetch_lock: done local fetch\n")); + /* step 2 - check if we are the dmaster */ if (h->header.dmaster == ctdb_db->ctdb->vnn) { + DEBUG(4,("ctdb_fetch_lock: we are dmaster - done\n")); return h; } /* we're not the dmaster - ask the ctdb daemon to make us dmaster */ state = ctdb_client_fetch_lock_send(ctdb_db, mem_ctx, key, &h->header); + DEBUG(4,("ctdb_fetch_lock: done fetch_lock_send\n")); ret = ctdb_client_fetch_lock_recv(state, mem_ctx, key, &h->header, data); if (ret != 0) { + DEBUG(4,("ctdb_fetch_lock: fetch_lock_recv failed\n")); talloc_free(h); return NULL; } + DEBUG(4,("ctdb_fetch_lock: record is now local\n")); + /* the record is now local, and locked. update the record on disk to mark us as the dmaster*/ h->header.dmaster = ctdb_db->ctdb->vnn; @@ -595,6 +611,8 @@ struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALL return NULL; } + DEBUG(4,("ctdb_fetch_lock: done\n")); + /* give the caller a handle to be used for ctdb_record_store() or a cancel via a talloc_free() */ return h; |