From d1b61b09aa542d64bf43abb3ad04611f46b57376 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 19 Jan 2007 23:17:28 +0000 Subject: r20918: a bit more debugging, and remove the hackish /dev/null writes I used to track down some uninitialised memory (sometimes valgrind gets the offset wrong, writing to /dev/null 1 byte at a time avoids this) (This used to be commit 4bf741b567417231c29606904aea2af0a91c941c) --- source4/cluster/ctdb/common/ctdb_call.c | 40 ++++++++++----------------------- source4/cluster/ctdb/common/ctdb_ltdb.c | 16 ------------- 2 files changed, 12 insertions(+), 44 deletions(-) (limited to 'source4/cluster') diff --git a/source4/cluster/ctdb/common/ctdb_call.c b/source4/cluster/ctdb/common/ctdb_call.c index 24924de902..26451c4cfe 100644 --- a/source4/cluster/ctdb/common/ctdb_call.c +++ b/source4/cluster/ctdb/common/ctdb_call.c @@ -206,7 +206,7 @@ static void ctdb_call_send_dmaster(struct ctdb_context *ctdb, memcpy(&r->data[0], key->dptr, key->dsize); memcpy(&r->data[key->dsize], data->dptr, data->dsize); - if (r->hdr.destnode == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) { + 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); @@ -243,6 +243,9 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr 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); if (ret != 0) { @@ -250,14 +253,6 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr return; } - { - int i, fd = open("/dev/null", O_WRONLY); - for (i=0;isrcnode) { ctdb_fatal(ctdb, "dmaster request from non-master"); @@ -272,14 +267,6 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr return; } - { - int i, fd = open("/dev/null", O_WRONLY); - for (i=0;imethods->allocate_pkt(ctdb, sizeof(*r) - 1 + data.dsize); CTDB_NO_MEMORY_FATAL(ctdb, r); @@ -291,24 +278,16 @@ 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); - { - int i, fd = open("/dev/null", O_WRONLY); - for (i=0;ireqid, __location__)); - if (0 && r->hdr.destnode == r->hdr.srcnode) { + 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); } + + talloc_free(r); } @@ -349,6 +328,8 @@ 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; @@ -436,6 +417,9 @@ 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; diff --git a/source4/cluster/ctdb/common/ctdb_ltdb.c b/source4/cluster/ctdb/common/ctdb_ltdb.c index bc15a3e898..cc49aa5016 100644 --- a/source4/cluster/ctdb/common/ctdb_ltdb.c +++ b/source4/cluster/ctdb/common/ctdb_ltdb.c @@ -94,14 +94,6 @@ int ctdb_ltdb_fetch(struct ctdb_context *ctdb, free(rec.dptr); CTDB_NO_MEMORY(ctdb, data->dptr); - { - int i, fd = open("/dev/null", O_WRONLY); - for (i=0;idsize;i++) { - write(fd, &data->dptr[i], 1); - } - close(fd); - } - return 0; } @@ -124,14 +116,6 @@ 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); - { - int i, fd = open("/dev/null", O_WRONLY); - for (i=0;iltdb, key, rec, TDB_REPLACE); talloc_free(rec.dptr); -- cgit