ctdb_ltdb_store_server: always store the data when ctdb_ltdb_store() is called from...
authorMichael Adam <obnox@samba.org>
Tue, 21 Dec 2010 16:50:52 +0000 (17:50 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 9 Mar 2011 23:56:35 +0000 (00:56 +0100)
This also fixes a segfault since ctdb_lmaster uses the vnn_map.

server/ctdb_ltdb_server.c

index f6427ce4f5ec92e2f882dcd56439c96a87f7601a..219df373299582200274c2488b267d42a5638c2f 100644 (file)
@@ -67,7 +67,7 @@ static int ctdb_ltdb_store_server(struct ctdb_db_context *ctdb_db,
        int ret;
        bool seqnum_suppressed = false;
        bool keep = false;
-       uint32_t lmaster = ctdb_lmaster(ctdb_db->ctdb, &key);
+       uint32_t lmaster;
 
        if (ctdb->flags & CTDB_FLAG_TORTURE) {
                struct ctdb_ltdb_header *h2;
@@ -80,6 +80,17 @@ static int ctdb_ltdb_store_server(struct ctdb_db_context *ctdb_db,
                if (rec.dptr) free(rec.dptr);
        }
 
+       if (ctdb->vnn_map == NULL) {
+               /*
+                * Called from a client: always store the record
+                * Also don't call ctdb_lmaster since it uses the vnn_map!
+                */
+               keep = true;
+               goto store;
+       }
+
+       lmaster = ctdb_lmaster(ctdb_db->ctdb, &key);
+
        /*
         * If we migrate an empty record off to another node
         * and the record has not been migrated with data,
@@ -116,6 +127,7 @@ static int ctdb_ltdb_store_server(struct ctdb_db_context *ctdb_db,
                keep = true;
        }
 
+store:
        /*
         * The VACUUM_MIGRATED flag is only set temporarily for
         * the above logic when the record was retrieved by a