dbwrap: Prevent transactions on non-persistent dbs
authorVolker Lendecke <vl@samba.org>
Fri, 11 Jan 2013 14:32:39 +0000 (15:32 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 8 Feb 2013 11:58:57 +0000 (12:58 +0100)
dbwrap_ctdb does not allow this anyway. This patch will avoid suprises
when going non-clustered to clustered. Not everybody is developing
against a clustered environment :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/dbwrap/dbwrap.c

index 15eb239c358994f0a71c5ee32d356954a0f31b51..f0b7a9a3ac5782a34631682e56d4f64fdb914969 100644 (file)
@@ -452,6 +452,11 @@ int dbwrap_get_seqnum(struct db_context *db)
 
 int dbwrap_transaction_start(struct db_context *db)
 {
+       if (!db->persistent) {
+               DEBUG(1, ("transactions not supported on non-persistent "
+                         "database %s\n", db->name));
+               return -1;
+       }
        return db->transaction_start(db);
 }