apache/shardingsphere · error · SQLFeatureNotSupportedException

setSavepoint name

Error message

setSavepoint name

What it means

CircuitBreakerConnection.setSavepoint(String name) throws SQLFeatureNotSupportedException("setSavepoint name") whenever the ShardingSphere data source is circuit-broken. Like its no-arg sibling, a named savepoint cannot be created without a live backend transaction, so the stub refuses rather than returning a fake Savepoint that later code would rely on.

Source

Thrown at jdbc/src/main/java/org/apache/shardingsphere/driver/state/circuit/connection/CircuitBreakerConnection.java:119

    }
    
    @Override
    public void rollback() {
    }
    
    @Override
    public void rollback(final Savepoint savepoint) throws SQLException {
        throw new SQLFeatureNotSupportedException("rollback savepoint");
    }
    
    @Override
    public Savepoint setSavepoint() throws SQLException {
        throw new SQLFeatureNotSupportedException("setSavepoint");
    }
    
    @Override
    public Savepoint setSavepoint(final String name) throws SQLException {
        throw new SQLFeatureNotSupportedException("setSavepoint name");
    }
    
    @Override
    public void releaseSavepoint(final Savepoint savepoint) throws SQLException {
        throw new SQLFeatureNotSupportedException("releaseSavepoint");
    }
    
    @Override
    public void setHoldability(final int holdability) {
    }
    
    @Override
    public int getHoldability() {
        return 0;
    }
    
    @Override
    public PreparedStatement prepareStatement(final String sql) {

View on GitHub (pinned to e952770a21)

Solutions

  1. Check the circuit/data-source state and getMetaData().supportsSavepoints() before creating named savepoints.
  2. Restore backend availability so the circuit breaker returns to CLOSED and real connections resume.
  3. Refactor named-checkpoint logic to full-transaction boundaries that tolerate a stubbed Connection.
  4. Catch SQLFeatureNotSupportedException and degrade to rollback()/commit() without the named checkpoint.

Example fix

// before
Savepoint sp = conn.setSavepoint("before_bulk_step");

// after
if (metaData.supportsSavepoints()) {
    Savepoint sp = conn.setSavepoint("before_bulk_step");
} else {
    logger.warn("savepoints unavailable; running step without checkpoint");
}
Defensive patterns

Strategy: validation

Validate before calling

if (conn.getMetaData().supportsSavepoints()) {
    sp = conn.setSavepoint("step_" + n);
} else {
    sp = null; // degraded mode
}

Try / catch

try {
    sp = conn.setSavepoint("checkpoint");
} catch (final SQLFeatureNotSupportedException ex) {
    LOGGER.warn("named savepoint unavailable (circuit open); continuing without");
}

Prevention

When it happens

Trigger: Calling conn.setSavepoint("CHECKPOINT_1") on a Connection whose data source is in the OPEN circuit state — typically code that names its savepoints for logging or multi-checkpoint logic.

Common situations: Named-savepoint batch jobs running when the database fails over; frameworks emitting named checkpoints (e.g. custom retry scopes); the same PROPAGATION_NESTED scenario with named savepoints.

Related errors


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/36c76939bfa27933. Report an issue: GitHub.