diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-04-17 16:35:28 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2007-04-17 16:35:28 +1000 |
commit | 1a1aedf78f723a61fc88717048440ff7f04f8c5c (patch) | |
tree | 5ed22f42a3c16517bb2ee679e575fdfba06f4cce /ctdb/common/ctdb_call.c | |
parent | 040e69c1c4d124b472b65af57376cbd557482521 (diff) | |
download | samba-1a1aedf78f723a61fc88717048440ff7f04f8c5c.tar.gz samba-1a1aedf78f723a61fc88717048440ff7f04f8c5c.tar.xz samba-1a1aedf78f723a61fc88717048440ff7f04f8c5c.zip |
when we get a lmaster request, skip updating the header when we are also the new dmaster
(This used to be ctdb commit 6c48dcc5df7b855fc8e0774c9572c7b2af618348)
Diffstat (limited to 'ctdb/common/ctdb_call.c')
-rw-r--r-- | ctdb/common/ctdb_call.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/ctdb/common/ctdb_call.c b/ctdb/common/ctdb_call.c index 1969a3704d..9e12581000 100644 --- a/ctdb/common/ctdb_call.c +++ b/ctdb/common/ctdb_call.c @@ -266,23 +266,27 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr return; } - /* fetch the current record */ - ret = ctdb_ltdb_fetch(ctdb_db, key, &header, hdr, &data2); - if (ret != 0) { - ctdb_fatal(ctdb, "ctdb_req_dmaster failed to fetch record"); - return; - } - - /* 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"); - return; - } + /* if the new dmaster and the lmaster are the same node, then + we don't need to update the record header now */ + if (c->dmaster != ctdb->vnn) { + /* fetch the current record */ + ret = ctdb_ltdb_fetch(ctdb_db, key, &header, hdr, &data2); + if (ret != 0) { + ctdb_fatal(ctdb, "ctdb_req_dmaster failed to fetch record"); + return; + } + + /* 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"); + return; + } - header.dmaster = c->dmaster; - if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) { - ctdb_fatal(ctdb, "ctdb_req_dmaster unable to update dmaster"); - return; + header.dmaster = c->dmaster; + if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) { + ctdb_fatal(ctdb, "ctdb_req_dmaster unable to update dmaster"); + return; + } } /* send the CTDB_REPLY_DMASTER */ |