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>
Wed, 9 Mar 2011 23:56:34 +0000 (00:56 +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.

common/ctdb_ltdb.c
include/ctdb_private.h
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 48e9ccaf78448f4d8bc6a68964c58d9b2c00feb4..5729e8452fb7361aea143407b60f8f2a8102b00f 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 71aaaf5191ae60d8193fd5a3d0c09971022ad740..43a1bf600f6129da999aac06322cd1120d21801b 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 */