From a633390d3a7cb04a7c4e14cba9c533621793287e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 7 Aug 2008 23:26:22 +1000 Subject: [PATCH] put a limit on the number of retries. I found a case where a recovery could lead to it blocking forever --- source/lib/dbwrap_ctdb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/lib/dbwrap_ctdb.c b/source/lib/dbwrap_ctdb.c index 16c626632de..645b93846ba 100644 --- a/source/lib/dbwrap_ctdb.c +++ b/source/lib/dbwrap_ctdb.c @@ -597,6 +597,7 @@ static int db_ctdb_transaction_commit(struct db_context *db) NTSTATUS rets; int ret; int status; + int retries = 0; struct db_ctdb_transaction_handle *h = ctx->transaction; if (h == NULL) { @@ -648,6 +649,17 @@ again: ctx->transaction = NULL; return -1; } + if (retries++ == 10) { + DEBUG(0,(__location__ " Giving up transaction on db 0x%08x after %d retries\n", + h->ctx->db_id, retries)); + ctdbd_control_local(messaging_ctdbd_connection(), CTDB_CONTROL_TRANS2_ERROR, + h->ctx->db_id, CTDB_CTRL_FLAG_NOREPLY, + tdb_null, NULL, NULL, NULL); + h->ctx->transaction = NULL; + talloc_free(h); + ctx->transaction = NULL; + return -1; + } goto again; } -- 2.34.1