summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-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 ec52d766c0..fef984c8c3 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -347,6 +347,7 @@ static int db_ctdb_transaction_fetch_start(struct db_ctdb_transaction_handle *h)
pid_t pid;
NTSTATUS status;
struct ctdb_ltdb_header header;
+ int32_t transaction_status;
key.dptr = (uint8_t *)discard_const(keyname);
key.dsize = strlen(keyname);
@@ -362,6 +363,17 @@ again:
}
crec = talloc_get_type_abort(rh->private_data, struct db_ctdb_rec);
+ transaction_status = db_ctdb_transaction_active(ctx->db_id);
+ if (transaction_status == 1) {
+ unsigned long int usec = (1000 + random()) % 100000;
+ DEBUG(3, ("Transaction already active on db_id[0x%08x]."
+ "Re-trying after %lu microseconds...",
+ ctx->db_id, usec));
+ talloc_free(tmp_ctx);
+ usleep(usec);
+ goto again;
+ }
+
/*
* store the pid in the database:
* it is not enought that the node is dmaster...