Skip to content

Commit

Permalink
[improve][tool] Improve transaction perf logs (apache#14816)
Browse files Browse the repository at this point in the history
  • Loading branch information
codelipenghui authored Mar 24, 2022
1 parent dca5a90 commit f74a586
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ public static void main(String[] args) throws Exception {
if (!arguments.isAbortTransaction) {
transaction.commit()
.thenRun(() -> {
if (log.isDebugEnabled()) {
log.debug("Commit transaction {}", transaction.getTxnID());
}
totalEndTxnOpSuccessNum.increment();
numTxnOpSuccess.increment();
})
Expand All @@ -454,11 +457,13 @@ public static void main(String[] args) throws Exception {
});
} else {
transaction.abort().thenRun(() -> {
log.info("Abort transaction {}", transaction.getTxnID().toString());
if (log.isDebugEnabled()) {
log.debug("Abort transaction {}", transaction.getTxnID());
}
totalEndTxnOpSuccessNum.increment();
numTxnOpSuccess.increment();
}).exceptionally(exception -> {
log.error("Commit transaction {} failed with exception",
log.error("Abort transaction {} failed with exception",
transaction.getTxnID().toString(),
exception);
totalEndTxnOpFailNum.increment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,10 @@ private static void runProducer(int producerId,
if (!arguments.isAbortTransaction) {
transaction.commit()
.thenRun(() -> {
log.info("Committed transaction {}",
transaction.getTxnID().toString());
if (log.isDebugEnabled()) {
log.debug("Committed transaction {}",
transaction.getTxnID().toString());
}
totalEndTxnOpSuccessNum.increment();
numTxnOpSuccess.increment();
})
Expand All @@ -785,11 +787,13 @@ private static void runProducer(int producerId,
});
} else {
transaction.abort().thenRun(() -> {
log.info("Abort transaction {}", transaction.getTxnID().toString());
if (log.isDebugEnabled()) {
log.debug("Abort transaction {}", transaction.getTxnID().toString());
}
totalEndTxnOpSuccessNum.increment();
numTxnOpSuccess.increment();
}).exceptionally(exception -> {
log.error("Commit transaction {} failed with exception",
log.error("Abort transaction {} failed with exception",
transaction.getTxnID().toString(),
exception);
totalEndTxnOpFailNum.increment();
Expand Down

0 comments on commit f74a586

Please sign in to comment.