You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/11/16 05:05:41 UTC

[GitHub] [shardingsphere] sandynz edited a comment on issue #13625: org.postgresql.jdbc.PgDatabaseMetaData.getRowIdLifetime() 方法尚未被实作

sandynz edited a comment on issue #13625:
URL: https://github.com/apache/shardingsphere/issues/13625#issuecomment-969862616


   It doesn't matter. ShardingSphere will check underlying database supported features, this exception (SQLFeatureNotSupportedException) is thrown from PG JDBC driver and printed in HikariCP.
   
   org.apache.shardingsphere.infra.metadata.resource.CachedDatabaseMetaData
   ```
       private RowIdLifetime getRowIdLifetimeFromOriginMetaData(final DatabaseMetaData databaseMetaData) throws SQLException {
           try {
               return databaseMetaData.getRowIdLifetime();
           } catch (final SQLFeatureNotSupportedException ignore) {
               return RowIdLifetime.ROWID_UNSUPPORTED;
           }
       }
   ```
   
   org.postgresql.jdbc.PgDatabaseMetaData
   ```
     @Override
     public RowIdLifetime getRowIdLifetime() throws SQLException {
       throw org.postgresql.Driver.notImplemented(this.getClass(), "getRowIdLifetime()");
     }
   ```
   
   HikariProxyDatabaseMetaData
   ```
       public RowIdLifetime getRowIdLifetime() throws SQLException {
           try {
               return super.delegate.getRowIdLifetime();
           } catch (SQLException var2) {
               throw this.checkException(var2);
           }
       }
   ```
   
   com.zaxxer.hikari.pool.ProxyConnection
   ```
      final SQLException checkException(SQLException sqle)
      {
         SQLException nse = sqle;
         for (int depth = 0; delegate != ClosedConnection.CLOSED_CONNECTION && nse != null && depth < 10; depth++) {
            final String sqlState = nse.getSQLState();
            if (sqlState != null && sqlState.startsWith("08")
                || nse instanceof SQLTimeoutException
                || ERROR_STATES.contains(sqlState)
                || ERROR_CODES.contains(nse.getErrorCode())) {
   
               // broken connection
               LOGGER.warn("{} - Connection {} marked as broken because of SQLSTATE({}), ErrorCode({})",
                           poolEntry.getPoolName(), delegate, sqlState, nse.getErrorCode(), nse);
               leakTask.cancel();
               poolEntry.evict("(connection is broken)");
               delegate = ClosedConnection.CLOSED_CONNECTION;
            }
            else {
               nse = nse.getNextException();
            }
         }
   
         return sqle;
      }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org