------------------------------------------------------------
revno: 133
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell <[EMAIL PROTECTED]>
branch nick: tridge
timestamp: Tue 2007-04-17 16:35:28 +1000
message:
  when we get a lmaster request, skip updating the header when we are also the 
new dmaster
modified:
  common/ctdb_call.c             ctdb_call.c-20061128065342-to93h6eejj5kon81-1
=== modified file 'common/ctdb_call.c'
--- a/common/ctdb_call.c        2007-04-17 06:20:32 +0000
+++ b/common/ctdb_call.c        2007-04-17 06:35:28 +0000
@@ -266,23 +266,27 @@
                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;
-       }
-
-       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;
+       /* 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;
+               }
        }
 
        /* send the CTDB_REPLY_DMASTER */

Reply via email to