dbwrap ctdb: add db_ctdb_delete_persistent() and use it for persistent DBs
authorMichael Adam <obnox@samba.org>
Tue, 5 Aug 2008 16:47:40 +0000 (18:47 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 13 Aug 2008 09:54:07 +0000 (11:54 +0200)
as delete_rec operation from fetch_locked()

Michael
(This used to be commit f4aab595a0219305fbedf8890e787b690660a55a)

source3/lib/dbwrap_ctdb.c

index 0c5e624411902aa17fb4a7ed37171c23e4b49d59..1cccecbad93efd6035dc2fa5f44291aa4a1c1292 100644 (file)
@@ -199,6 +199,21 @@ static NTSTATUS db_ctdb_delete(struct db_record *rec)
 
 }
 
+static NTSTATUS db_ctdb_delete_persistent(struct db_record *rec)
+{
+       TDB_DATA data;
+
+       /*
+        * We have to store the header with empty data. TODO: Fix the
+        * tdb-level cleanup
+        */
+
+       ZERO_STRUCT(data);
+
+       return db_ctdb_store_persistent(rec, data, 0);
+
+}
+
 static int db_ctdb_record_destr(struct db_record* data)
 {
        struct db_ctdb_rec *crec = talloc_get_type_abort(
@@ -274,10 +289,11 @@ again:
 
        if (persistent) {
                result->store = db_ctdb_store_persistent;
+               result->delete_rec = db_ctdb_delete_persistent;
        } else {
                result->store = db_ctdb_store;
+               result->delete_rec = db_ctdb_delete;
        }
-       result->delete_rec = db_ctdb_delete;
        talloc_set_destructor(result, db_ctdb_record_destr);
 
        ctdb_data = tdb_fetch(ctx->wtdb->tdb, key);