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)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Apr 2011 15:33:32 +0000 (17:33 +0200)
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.

similar to commit df49ec44de80affa5ccc637dec12a20a26e8706e.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
common/ctdb_ltdb.c
include/ctdb_private.h
server/ctdb_ltdb_server.c

index 33ae91235174959e8e0b74436ed76e07cae1769e..5193da9dd0b4459ae25eee4276930e39d57e69f8 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 bad59afdcaf3647ab95988ff8f48ab950bd926ef..91c46cb50e62410dac6bda3f650a881f7fcf303b 100644 (file)
@@ -488,6 +488,11 @@ struct ctdb_db_context {
        struct ctdb_vacuum_handle *vacuum_handle;
        char *unhealthy_reason;
        struct _trbt_tree_t *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 5e075b0df62655d18a5ea63ef8a67ab8ce8afce0..72e3122533421c8d2ea854623ae643944b13f6c9 100644 (file)
@@ -600,6 +600,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 */