server: Use the ctdb_ltdb_store_server() in the ctdb daemon for non-persistent dbs
authorMichael Adam <obnox@samba.org>
Thu, 30 Dec 2010 17:19:32 +0000 (18:19 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 14 Mar 2011 12:35:50 +0000 (13:35 +0100)
This is realized by adding a ctdb_ltdb_store_fn function pointer to the db
context and filling it in the attach procedure for non-persistent dbs.

(This used to be ctdb commit df49ec44de80affa5ccc637dec12a20a26e8706e)

ctdb/common/ctdb_ltdb.c
ctdb/include/ctdb_private.h
ctdb/server/ctdb_ltdb_server.c

index 200cca41dc1c119fd866770607af463b8981f1a4..b5e586568cd379fc1735f2e3161f74dfb3ba3a02 100644 (file)
@@ -129,6 +129,10 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
        int ret;
        bool seqnum_suppressed = false;
 
+       if (ctdb_db->ctdb_ltdb_store_fn) {
+               return ctdb_db->ctdb_ltdb_store_fn(ctdb_db, key, header, data);
+       }
+
        if (ctdb->flags & CTDB_FLAG_TORTURE) {
                struct ctdb_ltdb_header *h2;
                rec = tdb_fetch(ctdb_db->ltdb->tdb, key);
index e3f77e905eaede9a12cd36da9776127fcfd93556..396427bfa6c76eb21d692ecdece8d566b26d2df5 100644 (file)
@@ -516,6 +516,11 @@ struct ctdb_db_context {
        struct lockwait_handle *lockwait_overflow;
        struct ctdb_persistent_state *persistent_state;
        struct trbt_tree *delete_queue;
+       int (*ctdb_ltdb_store_fn)(struct ctdb_db_context *ctdb_db,
+                                 TDB_DATA key,
+                                 struct ctdb_ltdb_header *header,
+                                 TDB_DATA data);
+
 };
 
 
index 8de6ad2f8ee83fe593072824a4ad8acc902168d9..c00a048246e02b5f991bf70add835984cc5ed0e3 100644 (file)
@@ -604,6 +604,8 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name,
                if (ctdb_db->delete_queue == NULL) {
                        CTDB_NO_MEMORY(ctdb, ctdb_db->delete_queue);
                }
+
+               ctdb_db->ctdb_ltdb_store_fn = ctdb_ltdb_store_server;
        }
 
        /* check for hash collisions */