we don't need ctdb_ltdb_persistent_store() any more
authorAndrew Tridgell <tridge@samba.org>
Wed, 30 Jul 2008 09:58:03 +0000 (19:58 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 30 Jul 2008 09:58:03 +0000 (19:58 +1000)
common/ctdb_ltdb.c

index f3604584fbe9d79756b5c4840e8cfaa3b64e5a33..12fcf52d959f7d238261e90b9a0e7a1254d10c66 100644 (file)
@@ -157,65 +157,6 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
        return ret;
 }
 
-/*
-  write a record to a persistent database
-  this is done by a child process
-*/
-int ctdb_ltdb_persistent_store(struct ctdb_db_context *ctdb_db, TDB_DATA key, 
-                   struct ctdb_ltdb_header *header, TDB_DATA data)
-{
-       struct ctdb_context *ctdb = ctdb_db->ctdb;
-       TDB_DATA rec;
-       int ret;
-
-       if (ctdb->flags & CTDB_FLAG_TORTURE) {
-               struct ctdb_ltdb_header *h2;
-               rec = tdb_fetch(ctdb_db->ltdb->tdb, key);
-               h2 = (struct ctdb_ltdb_header *)rec.dptr;
-               if (rec.dptr && rec.dsize >= sizeof(h2) && h2->rsn > header->rsn) {
-                       DEBUG(DEBUG_CRIT,("RSN regression! %llu %llu\n",
-                                (unsigned long long)h2->rsn, (unsigned long long)header->rsn));
-               }
-               if (rec.dptr) free(rec.dptr);
-       }
-
-       rec.dsize = sizeof(*header) + data.dsize;
-       rec.dptr = talloc_size(ctdb, rec.dsize);
-       CTDB_NO_MEMORY(ctdb, rec.dptr);
-
-       memcpy(rec.dptr, header, sizeof(*header));
-       memcpy(rec.dptr + sizeof(*header), data.dptr, data.dsize);
-
-       /* if this is a persistent database without NOSYNC then we
-          will do this via a transaction */
-       if (!(ctdb_db->client_tdb_flags & TDB_NOSYNC)) {
-               ret = tdb_transaction_start(ctdb_db->ltdb->tdb);
-               if (ret != 0) {
-                       DEBUG(DEBUG_ERR, (__location__ " Failed to start local transaction\n"));
-                       goto failed;
-               }
-               ret = tdb_store(ctdb_db->ltdb->tdb, key, rec, TDB_REPLACE);
-               if (ret != 0) {
-                       DEBUG(DEBUG_ERR, (__location__ " Failed to store persistent data\n"));
-                       tdb_transaction_cancel(ctdb_db->ltdb->tdb);
-                       goto failed;
-               }
-               ret = tdb_transaction_commit(ctdb_db->ltdb->tdb);
-               if (ret != 0) {
-                       DEBUG(DEBUG_ERR, (__location__ " Failed to commit persistent store transaction.\n"));
-                       tdb_transaction_cancel(ctdb_db->ltdb->tdb);
-                       goto failed;
-               }
-       } else {
-               ret = tdb_store(ctdb_db->ltdb->tdb, key, rec, TDB_REPLACE);
-       }
-
-failed:
-       talloc_free(rec.dptr);
-
-       return ret;
-}
-
 /*
   lock a record in the ltdb, given a key
  */