summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-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);