diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 2fabfeaed1e..655b33670f0 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -1471,6 +1471,7 @@ int32_t ctdb_control_trans2_finished(struct ctdb_context *ctdb, int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb, struct ctdb_req_control *c); int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb, + struct ctdb_req_control *c, uint32_t db_id); char *ctdb_addr_to_str(ctdb_sock_addr *addr); diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c index b6bad1c99fa..bf82e515fbd 100644 --- a/ctdb/server/ctdb_control.c +++ b/ctdb/server/ctdb_control.c @@ -426,7 +426,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb, case CTDB_CONTROL_TRANS2_ACTIVE: CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t)); - return ctdb_control_trans2_active(ctdb, *(uint32_t *)indata.dptr); + return ctdb_control_trans2_active(ctdb, c, *(uint32_t *)indata.dptr); case CTDB_CONTROL_RECD_PING: CHECK_CONTROL_DATA_SIZE(0); diff --git a/ctdb/server/ctdb_persistent.c b/ctdb/server/ctdb_persistent.c index 3c51742b1c2..66a3f7229b6 100644 --- a/ctdb/server/ctdb_persistent.c +++ b/ctdb/server/ctdb_persistent.c @@ -608,9 +608,11 @@ int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb, * Tell whether a transaction is active on this node on the give DB. */ int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb, + struct ctdb_req_control *c, uint32_t db_id) { struct ctdb_db_context *ctdb_db; + struct ctdb_client *client = ctdb_reqid_find(ctdb, c->client_id, struct ctdb_client); ctdb_db = find_ctdb_db(ctdb, db_id); if (!ctdb_db) { @@ -618,6 +620,10 @@ int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb, return -1; } + if (client->db_id == db_id) { + return 0; + } + if (ctdb_db->transaction_active) { return 1; } else {