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

Method indicatesReadOnly

src/main/java/com/oltpbenchmark/api/Worker.java:652–681  ·  view source on GitHub ↗

Checks to see if the exception indicates that the current connection is read-only. @param ex @return

(SQLException ex)

Source from the content-addressed store, hash-verified

650 * @return
651 */
652 private boolean indicatesReadOnly(SQLException ex) {
653 String sqlState = ex.getSQLState();
654 int errorCode = ex.getErrorCode();
655
656 LOG.debug("sql state [{}] and error code [{}]", sqlState, errorCode);
657
658 if (sqlState == null) {
659 return false;
660 }
661
662 // ------------------
663 // SqlServer: "SELECT TOP 10 * FROM sys.messages"
664 // ------------------
665 if (errorCode == 3906 && sqlState.equals("S0002")) {
666 return true;
667 }
668
669 // ------------------
670 // MYSQL:
671 // https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-error-sqlstates.html
672 // ------------------
673 // TODO
674
675 // ------------------
676 // POSTGRES: https://www.postgresql.org/docs/current/errcodes-appendix.html
677 // ------------------
678 // TODO
679
680 return false;
681 }
682
683 private boolean isRetryable(SQLException ex) {
684

Callers 1

doWorkMethod · 0.95

Calls 1

equalsMethod · 0.45

Tested by

no test coverage detected