summaryrefslogtreecommitdiff
path: root/source4/cluster/ctdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-01-19 23:17:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:43:51 -0500
commitd1b61b09aa542d64bf43abb3ad04611f46b57376 (patch)
treee36d57b5d809e3ec30c71189b253c7342847c7c0 /source4/cluster/ctdb
parent15446aadafbea9cf9d42ee64f45dd5de8d3d0e1b (diff)
downloadsamba-d1b61b09aa542d64bf43abb3ad04611f46b57376.tar.gz
samba-d1b61b09aa542d64bf43abb3ad04611f46b57376.tar.bz2
samba-d1b61b09aa542d64bf43abb3ad04611f46b57376.zip
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)
Diffstat (limited to 'source4/cluster/ctdb')
-rw-r--r--source4/cluster/ctdb/common/ctdb_call.c40
-rw-r--r--source4/cluster/ctdb/common/ctdb_ltdb.c16
2 files changed, 12 insertions, 44 deletions
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;i<data.dsize;i++) {
- write(fd, &data.dptr[i], 1);
- }
- close(fd);
- }
-
/* its a protocol error if the sending node is not the current dmaster */
if (header.dmaster != hdr->srcnode) {
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;i<data.dsize;i++) {
- write(fd, &data.dptr[i], 1);
- }
- close(fd);
- }
-
/* send the CTDB_REPLY_DMASTER */
r = ctdb->methods->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;i<data.dsize;i++) {
- write(fd, &data.dptr[i], 1);
- }
- close(fd);
- }
-
DEBUG(0,("request dmaster reqid=%d %s\n", hdr->reqid, __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;i<data->dsize;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;i<rec.dsize;i++) {
- write(fd, &rec.dptr[i], 1);
- }
- close(fd);
- }
-
ret = tdb_store(ctdb->ltdb, key, rec, TDB_REPLACE);
talloc_free(rec.dptr);