summaryrefslogtreecommitdiff
path: root/source3/lib/dbwrap_ctdb.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-08-07 23:26:22 +1000
committerMichael Adam <obnox@samba.org>2008-08-13 11:54:09 +0200
commit62bbcc6135607c9772e745a86c2d3d766e3e6c67 (patch)
tree61893ed3e430438ae4e0d2bd2e992ccf1c04cd2e /source3/lib/dbwrap_ctdb.c
parent7e9229e17ad68be321dc42bb37e2251b140f7888 (diff)
downloadsamba-62bbcc6135607c9772e745a86c2d3d766e3e6c67.tar.gz
samba-62bbcc6135607c9772e745a86c2d3d766e3e6c67.tar.bz2
samba-62bbcc6135607c9772e745a86c2d3d766e3e6c67.zip
put a limit on the number of retries. I found a case where a recovery
could lead to it blocking forever (This used to be commit a633390d3a7cb04a7c4e14cba9c533621793287e)
Diffstat (limited to 'source3/lib/dbwrap_ctdb.c')
-rw-r--r--source3/lib/dbwrap_ctdb.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index 16c626632d..645b93846b 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/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;
}