From: Amitay Isaacs Date: Fri, 5 Aug 2016 03:13:08 +0000 (+1000) Subject: ctdb-tools: Cancel transaction on error or if commit fails X-Git-Tag: tevent-0.9.30~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d144d7106d56bbb48669dd35eb324377dd09b59;p=thirdparty%2Fsamba.git ctdb-tools: Cancel transaction on error or if commit fails BUG: https://bugzilla.samba.org/show_bug.cgi?id=12122 Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index c4c0b4ea8a2..71e4ab5d866 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -5136,6 +5136,7 @@ static int control_pfetch(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, if (ret != 0) { fprintf(stderr, "Failed to read record for key %s\n", argv[1]); + ctdb_transaction_cancel(h); return ret; } @@ -5200,6 +5201,7 @@ static int control_pstore(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, if (ret != 0) { fprintf(stderr, "Failed to store record for key %s\n", argv[1]); + ctdb_transaction_cancel(h); return ret; } @@ -5207,6 +5209,7 @@ static int control_pstore(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, if (ret != 0) { fprintf(stderr, "Failed to commit transaction on db %s\n", db_name); + ctdb_transaction_cancel(h); return ret; } @@ -5262,6 +5265,7 @@ static int control_pdelete(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, if (ret != 0) { fprintf(stderr, "Failed to delete record for key %s\n", argv[1]); + ctdb_transaction_cancel(h); return ret; } @@ -5269,6 +5273,7 @@ static int control_pdelete(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, if (ret != 0) { fprintf(stderr, "Failed to commit transaction on db %s\n", db_name); + ctdb_transaction_cancel(h); return ret; } @@ -5412,6 +5417,7 @@ static int control_ptrans(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, if (ret != 0) { fprintf(stderr, "Failed to commit transaction on db %s\n", db_name); + ctdb_transaction_cancel(h); } done: