ctdbd_conn: pass persistent bool instead of tdb_flags
authorRalph Boehme <slow@samba.org>
Tue, 11 Jul 2017 18:41:43 +0000 (20:41 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 12 Jul 2017 07:01:19 +0000 (09:01 +0200)
ctdbd_db_attach() only needs to know the ctdb database model, not the
rest of the flags.

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>
source3/include/ctdbd_conn.h
source3/lib/ctdbd_conn.c
source3/lib/dbwrap/dbwrap_ctdb.c

index 06fbcc373a4d9f81b465f9c6dd016c34588902d7..38477d313de804a333d6768ee4e7f4f0686e7c97 100644 (file)
@@ -55,7 +55,7 @@ char *ctdbd_dbpath(struct ctdbd_connection *conn,
                   TALLOC_CTX *mem_ctx, uint32_t db_id);
 
 int ctdbd_db_attach(struct ctdbd_connection *conn, const char *name,
-                   uint32_t *db_id, int tdb_flags);
+                   uint32_t *db_id, bool persistent);
 
 int ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key);
 
index 70d3d83f031ef74bb4cb554d615f6ef5193a2568..b81feca65ba31b77396b8801e321a61fae294656 100644 (file)
@@ -819,12 +819,11 @@ char *ctdbd_dbpath(struct ctdbd_connection *conn,
  * attach to a ctdb database
  */
 int ctdbd_db_attach(struct ctdbd_connection *conn,
-                   const char *name, uint32_t *db_id, int tdb_flags)
+                   const char *name, uint32_t *db_id, bool persistent)
 {
        int ret;
        TDB_DATA data;
        int32_t cstatus;
-       bool persistent = (tdb_flags & TDB_CLEAR_IF_FIRST) == 0;
 
        data = string_term_tdb_data(name);
 
index 001d2c42fb2d27752279b2c47240b2250533b5db..07e35f8ffb06dcfdd455cf67afbf473578aafa57 100644 (file)
@@ -1780,6 +1780,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
        char *db_path;
        struct loadparm_context *lp_ctx;
        TDB_DATA data;
+       bool persistent = (tdb_flags & TDB_CLEAR_IF_FIRST);
        int32_t cstatus;
        int ret;
 
@@ -1811,7 +1812,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
        db_ctdb->db = result;
        db_ctdb->conn = conn;
 
-       ret = ctdbd_db_attach(db_ctdb->conn, name, &db_ctdb->db_id, tdb_flags);
+       ret = ctdbd_db_attach(db_ctdb->conn, name, &db_ctdb->db_id, persistent);
        if (ret != 0) {
                DEBUG(0, ("ctdbd_db_attach failed for %s: %s\n", name,
                          strerror(ret)));
@@ -1836,7 +1837,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
 
        db_path = ctdbd_dbpath(db_ctdb->conn, db_ctdb, db_ctdb->db_id);
 
-       result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0);
+       result->persistent = persistent;
        result->lock_order = lock_order;
 
        /* only pass through specific flags */