Skip to content

Commit

Permalink
Retries merge (#148)
Browse files Browse the repository at this point in the history
logging stack trace instead of entire exception
  • Loading branch information
Vassu05 authored Jun 3, 2024
1 parent 602281b commit 3bd9e7c
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions src/com/oltpbenchmark/api/Worker.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,15 @@ protected final ArrayList<Pair<TransactionExecutionState, TransactionStatus>> do
startConnection = System.nanoTime();

conn = dataSource.getConnection();
conn.createStatement().execute("SET yb_enable_expression_pushdown to on");
if (next.getProcedureClass() != StockLevel.class) {
// In accordance with 2.8.2.3 of the TPCC spec, StockLevel should execute each query in its own Snapshot
// Isolation.
conn.setAutoCommit(false);
try {
conn.createStatement().execute("SET yb_enable_expression_pushdown to on");
if (next.getProcedureClass() != StockLevel.class) {
// In accordance with 2.8.2.3 of the TPCC spec, StockLevel should execute each query in its own Snapshot
// Isolation.
conn.setAutoCommit(false);
}
} catch (Throwable e) {

}

endConnection = System.nanoTime();
Expand Down Expand Up @@ -539,19 +543,32 @@ protected final ArrayList<Pair<TransactionExecutionState, TransactionStatus>> do
status = TransactionStatus.RETRY;
} else {
// UNKNOWN: In this case .. Retry as well!
LOG.warn("The DBMS rejected the transaction without an error code", ex);
if(attempt == totalAttemptsPerTransaction) {
LOG.warn("The DBMS rejected the transaction without an error code:" + ex.getStackTrace());
} else {
LOG.warn("The DBMS rejected the transaction without an error code:" + ex.getMessage());
}
// FIXME Disable this for now
// throw ex;
status = TransactionStatus.RETRY;
}
}
// Assertion Error
} catch (Error ex) {
LOG.error("Fatal error when invoking " + next, ex);
throw ex;
if (attempt == totalAttemptsPerTransaction) {
LOG.error("Fatal error when invoking :" + ex.getStackTrace());
} else {
LOG.error("Fatal error when invoking :" + ex.getMessage());
}
status = TransactionStatus.RETRY;
// Random Error
} catch (Exception ex) {
LOG.error("Fatal error when invoking " + next, ex);
throw new RuntimeException(ex);
if (attempt == totalAttemptsPerTransaction) {
LOG.error("Fatal error when invoking :" + ex.getStackTrace());
} else {
LOG.error("Fatal error when invoking :" + ex.getMessage());
}
status = TransactionStatus.RETRY;

} finally {
LOG.debug(String.format("%s %s Result: %s", this, next, status));
Expand Down

0 comments on commit 3bd9e7c

Please sign in to comment.