diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-01-22 09:35:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:43:58 -0500 |
commit | ae7eab4cfc43b738bad15aec01233d41c2abbb83 (patch) | |
tree | 1b9bcdd7d2f40c206ed0317f4ffc2a693d1d9b70 /source4/cluster/ctdb/common | |
parent | e04e99585cabd225c79cb492d02509514f030486 (diff) | |
download | samba-ae7eab4cfc43b738bad15aec01233d41c2abbb83.tar.gz samba-ae7eab4cfc43b738bad15aec01233d41c2abbb83.tar.bz2 samba-ae7eab4cfc43b738bad15aec01233d41c2abbb83.zip |
r20945: fixed the bug causing locktest to fail with the ctdb backend after a
couple of hundred opertations. Also removed a lot of the debug code I
was using to track this down.
(This used to be commit 7622e7b4b2694ec14062d0f6de035b946106a6aa)
Diffstat (limited to 'source4/cluster/ctdb/common')
-rw-r--r-- | source4/cluster/ctdb/common/ctdb.c | 2 | ||||
-rw-r--r-- | source4/cluster/ctdb/common/ctdb_call.c | 25 | ||||
-rw-r--r-- | source4/cluster/ctdb/common/ctdb_ltdb.c | 8 |
3 files changed, 8 insertions, 27 deletions
diff --git a/source4/cluster/ctdb/common/ctdb.c b/source4/cluster/ctdb/common/ctdb.c index dd9a6db770..ba00e7caa0 100644 --- a/source4/cluster/ctdb/common/ctdb.c +++ b/source4/cluster/ctdb/common/ctdb.c @@ -186,8 +186,6 @@ static void ctdb_recv_pkt(struct ctdb_context *ctdb, uint8_t *data, uint32_t len return; } - DEBUG(0,("got ctdb op %d reqid %d\n", hdr->operation, hdr->reqid)); - switch (hdr->operation) { case CTDB_REQ_CALL: ctdb_request_call(ctdb, hdr); diff --git a/source4/cluster/ctdb/common/ctdb_call.c b/source4/cluster/ctdb/common/ctdb_call.c index 648b2b0bc9..aace5971e2 100644 --- a/source4/cluster/ctdb/common/ctdb_call.c +++ b/source4/cluster/ctdb/common/ctdb_call.c @@ -28,14 +28,12 @@ #include "system/filesys.h" #include "cluster/ctdb/include/ctdb_private.h" - /* queue a packet or die */ static void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) { struct ctdb_node *node; - DEBUG(0,("queueing destnode=%u srcnode=%u\n", hdr->destnode, hdr->srcnode)); node = ctdb->nodes[hdr->destnode]; if (ctdb->methods->queue_pkt(node, (uint8_t *)hdr, hdr->length) != 0) { ctdb_fatal(ctdb, "Unable to queue packet\n"); @@ -210,7 +208,6 @@ static void ctdb_call_send_dmaster(struct ctdb_context *ctdb, if (r->hdr.destnode == ctdb->vnn) { /* we are the lmaster - don't send to ourselves */ - DEBUG(0,("XXXX local ctdb_req_dmaster\n")); ctdb_request_dmaster(ctdb, &r->hdr); } else { ctdb_queue_packet(ctdb, &r->hdr); @@ -234,7 +231,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr { struct ctdb_req_dmaster *c = (struct ctdb_req_dmaster *)hdr; struct ctdb_reply_dmaster *r; - TDB_DATA key, data; + TDB_DATA key, data, data2; struct ctdb_ltdb_header header; int ret, len; @@ -243,13 +240,8 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr data.dptr = c->data + c->keylen; data.dsize = c->datalen; - DEBUG(0,("request dmaster reqid=%d\n", hdr->reqid)); - - DEBUG(0,("change dmaster: stage 2 - new dmaster will be %d\n", - c->dmaster)); - /* fetch the current record */ - ret = ctdb_ltdb_fetch(ctdb, key, &header, &data); + ret = ctdb_ltdb_fetch(ctdb, key, &header, &data2); if (ret != 0) { ctdb_fatal(ctdb, "ctdb_req_dmaster failed to fetch record"); return; @@ -261,8 +253,6 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr return; } - DEBUG(0,("request dmaster reqid=%d %s\n", hdr->reqid, __location__)); - header.dmaster = c->dmaster; if (ctdb_ltdb_store(ctdb, key, &header, data) != 0) { ctdb_fatal(ctdb, "ctdb_req_dmaster unable to update dmaster"); @@ -281,13 +271,10 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr r->datalen = data.dsize; memcpy(&r->data[0], data.dptr, data.dsize); - DEBUG(0,("request dmaster reqid=%d %s\n", hdr->reqid, __location__)); - if (r->hdr.destnode == r->hdr.srcnode) { ctdb_reply_dmaster(ctdb, &r->hdr); } else { ctdb_queue_packet(ctdb, &r->hdr); - DEBUG(0,("request dmaster reqid=%d %s\n", hdr->reqid, __location__)); } talloc_free(r); @@ -331,8 +318,6 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) then give them the record */ if (header.laccessor == c->hdr.srcnode && header.lacount >= ctdb->max_lacount) { - DEBUG(0,("change dmaster: stage 1 - new dmaster will be %d\n", - header.laccessor)); ctdb_call_send_dmaster(ctdb, c, &header, &key, &data); talloc_free(data.dptr); return; @@ -423,9 +408,6 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) talloc_steal(state, c); - DEBUG(0,("change dmaster: stage 3 - new dmaster is %d\n", - ctdb->vnn)); - /* we're now the dmaster - update our local ltdb with new header and data */ state->header.dmaster = ctdb->vnn; @@ -494,7 +476,7 @@ void ctdb_reply_redirect(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) */ static int ctdb_call_destructor(struct ctdb_call_state *state) { -// idr_remove(state->node->ctdb->idr, state->c->hdr.reqid); + idr_remove(state->node->ctdb->idr, state->c->hdr.reqid); return 0; } @@ -582,7 +564,6 @@ struct ctdb_call_state *ctdb_call_send(struct ctdb_context *ctdb, state->c->hdr.srcnode = ctdb->vnn; /* this limits us to 16k outstanding messages - not unreasonable */ state->c->hdr.reqid = idr_get_new(ctdb->idr, state, 0xFFFF); - DEBUG(0,("Allocate reqid %u\n", state->c->hdr.reqid)); state->c->callid = call_id; state->c->keylen = key.dsize; state->c->calldatalen = call_data?call_data->dsize:0; diff --git a/source4/cluster/ctdb/common/ctdb_ltdb.c b/source4/cluster/ctdb/common/ctdb_ltdb.c index cc49aa5016..fbf6a3e567 100644 --- a/source4/cluster/ctdb/common/ctdb_ltdb.c +++ b/source4/cluster/ctdb/common/ctdb_ltdb.c @@ -24,6 +24,8 @@ #include "system/network.h" #include "system/filesys.h" #include "cluster/ctdb/include/ctdb_private.h" +#include "db_wrap.h" + /* attach to a specific database @@ -34,7 +36,7 @@ int ctdb_attach(struct ctdb_context *ctdb, const char *name, int tdb_flags, /* when we have a separate daemon this will need to be a real file, not a TDB_INTERNAL, so the parent can access it to for ltdb bypass */ - ctdb->ltdb = tdb_open(name, 0, /* tdb_flags */ TDB_INTERNAL, open_flags, mode); + ctdb->ltdb = tdb_wrap_open(ctdb, name, 0, TDB_INTERNAL, open_flags, mode); if (ctdb->ltdb == NULL) { ctdb_set_error(ctdb, "Failed to open tdb %s\n", name); return -1; @@ -76,7 +78,7 @@ int ctdb_ltdb_fetch(struct ctdb_context *ctdb, { TDB_DATA rec; - rec = tdb_fetch(ctdb->ltdb, key); + rec = tdb_fetch(ctdb->ltdb->tdb, key); if (rec.dsize < sizeof(*header)) { /* return an initial header */ free(rec.dptr); @@ -116,7 +118,7 @@ int ctdb_ltdb_store(struct ctdb_context *ctdb, TDB_DATA key, memcpy(rec.dptr, header, sizeof(*header)); memcpy(rec.dptr + sizeof(*header), data.dptr, data.dsize); - ret = tdb_store(ctdb->ltdb, key, rec, TDB_REPLACE); + ret = tdb_store(ctdb->ltdb->tdb, key, rec, TDB_REPLACE); talloc_free(rec.dptr); return ret; |