1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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 <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Amitay Isaacs 2016-08-05 13:13:08 +10:00 committed by Martin Schwenke
parent 8aa00035fa
commit 4d144d7106

View File

@ -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: