t8y2/dbx · error

Hive does not support rollbackable transactions

Error message

Hive does not support rollbackable transactions

What it means

The driver will not silently downgrade an explicitly requested transaction into auto-commit execution. When the initial BEGIN fails with an error indicating the backend does not support transactions, executeStatements returns this hard error so that earlier statements cannot end up committed with no way to roll back on a later failure.

Source

Thrown at agents/drivers/hive-go/query.go:339

					continue
				}
				result, execErr := tx.ExecContext(ctx, trimmed)
				if execErr != nil {
					_ = tx.Rollback()
					return queryResult{}, execErr
				}
				count, _ := result.RowsAffected()
				affected += max(count, 0)
			}
			if err := tx.Commit(); err != nil {
				return queryResult{}, err
			}
			return emptyQueryResult(affected, started), nil
		}
		if transactionUnsupported(beginErr) {
			// Do not turn an explicit transaction request into auto-commit
			// execution: a later error would leave prior statements applied.
			return queryResult{}, errors.New("Hive does not support rollbackable transactions")
		}
		return queryResult{}, beginErr
	}
	for _, statement := range statements {
		trimmed := trimStatementSQL(statement)
		if trimmed == "" {
			continue
		}
		result, err := connection.ExecContext(ctx, trimmed)
		if err != nil {
			return queryResult{}, err
		}
		count, _ := result.RowsAffected()
		affected += max(count, 0)
	}
	return emptyQueryResult(affected, started), nil
}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Enable Hive ACID: set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager and hive.support.concurrency=true on the server
  2. Use non-transactional batch execution (transaction=false) if atomic rollback is not required
  3. Run statements on a backend that truly supports rollbackable transactions if atomicity is a hard requirement
  4. Remove the transaction flag from the request rather than relying on implicit fallback

Example fix

// before
res, err := conn.ExecuteTransaction(ctx, []string{"INSERT INTO t ...", "UPDATE t ..."})
// after (Hive without ACID)
for _, s := range stmts {
    if _, err := conn.Execute(ctx, s); err != nil {
        return err // manual compensation required
    }
}
Defensive patterns

Strategy: validation

Validate before calling

// Go: verify transaction support before requesting one
if requireAtomicity && !hiveACIDEnabled(cfg) {
    return errors.New("atomic transactions unsupported; use non-transactional batch or enable ACID")
}

Try / catch

res, err := server.dispatch(ctx, "executeTransaction", params)
if err != nil && strings.Contains(err.Error(), "rollbackable transactions") {
    // surface a config error; do NOT silently retry as auto-commit
    return fmt.Errorf("transaction unsupported by backend: %w", err)
}

Prevention

When it happens

Trigger: Calling the transaction execution path against a HiveServer2/driver combination whose BEGIN fails and transactionUnsupported(beginErr) is true (Hive ACID not enabled, No-op transaction manager, older Hive versions).

Common situations: Pointing the driver at plain HiveServer2 without ACID/transactional tables enabled (hive.txn.manager not set to DbTxnManager, hive.support.concurrency=false); expecting Postgres-style semantics on Hive.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/6b81984c635f9797. Report an issue: GitHub.