dbwrap: Ask CTDB for local tdb open flags
authorRalph Boehme <slow@samba.org>
Tue, 11 Jul 2017 19:35:17 +0000 (21:35 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 12 Jul 2017 11:25:11 +0000 (13:25 +0200)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=12891

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jul 12 13:25:11 CEST 2017 on sn-devel-144

source3/lib/dbwrap/dbwrap_ctdb.c

index 07e35f8ffb06dcfdd455cf67afbf473578aafa57..6bdaab000a99a71b094d258eb542de80bf64ecdd 100644 (file)
@@ -1840,9 +1840,25 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
        result->persistent = persistent;
        result->lock_order = lock_order;
 
-       /* only pass through specific flags */
-       tdb_flags &= TDB_SEQNUM|TDB_VOLATILE|
-               TDB_MUTEX_LOCKING|TDB_CLEAR_IF_FIRST;
+       data.dptr = (uint8_t *)&db_ctdb->db_id;
+       data.dsize = sizeof(db_ctdb->db_id);
+
+       ret = ctdbd_control_local(conn, CTDB_CONTROL_DB_OPEN_FLAGS,
+                                 0, 0, data, NULL, &data, &cstatus);
+       if (ret != 0) {
+               DBG_ERR(" ctdb control for db_open_flags "
+                        "failed: %s\n", strerror(ret));
+               TALLOC_FREE(result);
+               return NULL;
+       }
+
+       if (cstatus != 0 || data.dsize != sizeof(int)) {
+               DBG_ERR("ctdb_control for db_open_flags failed\n");
+               TALLOC_FREE(result);
+               return NULL;
+       }
+
+       tdb_flags = *(int *)data.dptr;
 
        if (!result->persistent) {
                ret = ctdb_async_ctx_init(NULL, messaging_tevent_context(msg_ctx));