From 3bdb29692460693dfd0f5ffeea0a28eb3eb419fb Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 18 Jan 2011 13:33:24 +1100 Subject: [PATCH] ctdb: hold transaction locks during freeze, mark during recover. Make the ctdb parent "mark" the transaction lock once the child process has frozen/locked the entire database. This stops the ctdb daemon from using a blocking fcntl() locking on the tdb during the read traverse during recovery. CQ 1021388 --- server/ctdb_recover.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c index fe4275c4..4db4d97f 100644 --- a/server/ctdb_recover.c +++ b/server/ctdb_recover.c @@ -57,7 +57,11 @@ static int ctdb_lock_all_databases_mark(struct ctdb_context *ctdb, uint32_t prio if (strstr(ctdb_db->db_name, "notify") != NULL) { continue; } + if (tdb_transaction_write_lock_mark(ctdb_db->ltdb->tdb) != 0) { + return -1; + } if (tdb_lockall_mark(ctdb_db->ltdb->tdb) != 0) { + tdb_transaction_write_lock_unmark(ctdb_db->ltdb->tdb); return -1; } } @@ -68,7 +72,11 @@ static int ctdb_lock_all_databases_mark(struct ctdb_context *ctdb, uint32_t prio if (strstr(ctdb_db->db_name, "notify") == NULL) { continue; } + if (tdb_transaction_write_lock_mark(ctdb_db->ltdb->tdb) != 0) { + return -1; + } if (tdb_lockall_mark(ctdb_db->ltdb->tdb) != 0) { + tdb_transaction_write_lock_unmark(ctdb_db->ltdb->tdb); return -1; } } @@ -95,6 +103,7 @@ static int ctdb_lock_all_databases_unmark(struct ctdb_context *ctdb, uint32_t pr if (ctdb_db->priority != priority) { continue; } + tdb_transaction_write_lock_unmark(ctdb_db->ltdb->tdb); if (tdb_lockall_unmark(ctdb_db->ltdb->tdb) != 0) { return -1; } -- 2.34.1