public void rollback(Map<String, Serializable> settings) throws ClickHouseException {
        log.debug("Roll back %s", this);
        int currentState = state.get();
        if (currentState == NEW) {
            log.debug("Skip since the transaction has not started yet");
            return;
        } else if (currentState == ROLLED_BACK) {
            log.debug("Skip since the transaction has been rolled back already");
            return;
        } else if (currentState != ACTIVE && currentState != FAILED) {
            throw new ClickHouseTransactionException(
                    ClickHouseUtils.format("Cannot roll back inactive transaction(state=%s)", NAMES[currentState]),
                    this);
        }

        try {
            id.updateAndGet(x -> {
                boolean success = false;
                try {
                    ensureTransactionId();
                    issue(COMMAND_ROLLBACK, true, settings);
                    success = state.compareAndSet(currentState, ROLLED_BACK);
                    return x;
                } catch (ClickHouseException e) {
                    throw new IllegalStateException(e);
                } finally {
                    if (!success) {
                        state.compareAndSet(currentState, FAILED);
                    }
                }
            });
        } catch (IllegalStateException e) {
            if (e.getCause() instanceof ClickHouseException) {
                throw (ClickHouseException) e.getCause();
            } else {
                throw e;
            }
        }
    }
Rolls back the transaction with optional server settings. It's a no-op when
calling against a {@link #NEW} or {@link #ROLLED_BACK} transaction.

@param settings optional server settings
@throws ClickHouseException when failed to roll back the transaction
clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseTransaction.java