summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-01-16 13:42:52 +0100
committerVolker Lendecke <vlendec@samba.org>2012-01-18 16:21:52 +0100
commitd2bf6af1651c44b29d69be6944cd6148d90caed0 (patch)
tree20ec96013b955081d5a32939b204f59551e9f001 /source3/lib
parentd2068d33a4adcb10037c63c092669efe7f077b8e (diff)
downloadsamba-d2bf6af1651c44b29d69be6944cd6148d90caed0.tar.gz
samba-d2bf6af1651c44b29d69be6944cd6148d90caed0.tar.bz2
samba-d2bf6af1651c44b29d69be6944cd6148d90caed0.zip
s3: Use lock_order for setting the db priority
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Jan 18 16:21:52 CET 2012 on sn-devel-104
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/dbwrap/dbwrap_ctdb.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index e5c07f4b8e..3c1ab44d4e 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1439,6 +1439,9 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
char *db_path;
struct ctdbd_connection *conn;
struct loadparm_context *lp_ctx;
+ struct ctdb_db_priority prio;
+ NTSTATUS status;
+ int cstatus;
if (!lp_clustering()) {
DEBUG(10, ("Clustering disabled -- no ctdb\n"));
@@ -1485,6 +1488,21 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
chmod(db_path, mode);
}
+ prio.db_id = db_ctdb->db_id;
+ prio.priority = lock_order;
+
+ status = ctdbd_control_local(
+ conn, CTDB_CONTROL_SET_DB_PRIORITY, 0, 0,
+ make_tdb_data((uint8_t *)&prio, sizeof(prio)),
+ NULL, NULL, &cstatus);
+
+ if (!NT_STATUS_IS_OK(status) || (cstatus != 0)) {
+ DEBUG(1, ("CTDB_CONTROL_SET_DB_PRIORITY failed: %s, %d\n",
+ nt_errstr(status), cstatus));
+ TALLOC_FREE(result);
+ return NULL;
+ }
+
lp_ctx = loadparm_init_s3(db_path, loadparm_s3_context());
db_ctdb->wtdb = tdb_wrap_open(db_ctdb, db_path, hash_size, tdb_flags,