MCPcopy Create free account
hub / github.com/cmu-db/benchbase / isRetryable

Method isRetryable

src/main/java/com/oltpbenchmark/api/Worker.java:683–726  ·  view source on GitHub ↗
(SQLException ex)

Source from the content-addressed store, hash-verified

681 }
682
683 private boolean isRetryable(SQLException ex) {
684
685 String sqlState = ex.getSQLState();
686 int errorCode = ex.getErrorCode();
687
688 LOG.debug("sql state [{}] and error code [{}]", sqlState, errorCode);
689
690 if (sqlState == null) {
691 return false;
692 }
693
694 if (ex instanceof SQLRecoverableException) {
695 return true;
696 }
697
698 // ------------------
699 // SqlServer: "SELECT TOP 10 * FROM sys.messages"
700 // ------------------
701 if (errorCode == 12222 && sqlState.equals("S0051")) {
702 // Lock request time out period exceeded.
703 return true;
704 } else if (errorCode == 0 && sqlState.equals("HY008")) {
705 // The query has timed out.
706 return true;
707 }
708
709 // ------------------
710 // MYSQL:
711 // https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-error-sqlstates.html
712 // ------------------
713 if (errorCode == 1213 && sqlState.equals("40001")) {
714 // MySQL ER_LOCK_DEADLOCK
715 return true;
716 } else if (errorCode == 1205 && sqlState.equals("40001")) {
717 // MySQL ER_LOCK_WAIT_TIMEOUT
718 return true;
719 }
720
721 // ------------------
722 // POSTGRES: https://www.postgresql.org/docs/current/errcodes-appendix.html
723 // ------------------
724 // Postgres serialization_failure
725 return errorCode == 0 && sqlState.equals("40001");
726 }
727
728 /**
729 * Optional callback that can be used to initialize the Worker right before the benchmark

Callers 1

doWorkMethod · 0.95

Calls 1

equalsMethod · 0.45

Tested by

no test coverage detected