{"record":{"id":"6b81984c635f9797","repo":"t8y2/dbx","slug":"hive-does-not-support-rollbackable-transactions","errorCode":null,"errorMessage":"Hive does not support rollbackable transactions","messagePattern":"Hive does not support rollbackable transactions","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/hive-go/query.go","lineNumber":339,"sourceCode":"\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tresult, execErr := tx.ExecContext(ctx, trimmed)\n\t\t\t\tif execErr != nil {\n\t\t\t\t\t_ = tx.Rollback()\n\t\t\t\t\treturn queryResult{}, execErr\n\t\t\t\t}\n\t\t\t\tcount, _ := result.RowsAffected()\n\t\t\t\taffected += max(count, 0)\n\t\t\t}\n\t\t\tif err := tx.Commit(); err != nil {\n\t\t\t\treturn queryResult{}, err\n\t\t\t}\n\t\t\treturn emptyQueryResult(affected, started), nil\n\t\t}\n\t\tif transactionUnsupported(beginErr) {\n\t\t\t// Do not turn an explicit transaction request into auto-commit\n\t\t\t// execution: a later error would leave prior statements applied.\n\t\t\treturn queryResult{}, errors.New(\"Hive does not support rollbackable transactions\")\n\t\t}\n\t\treturn queryResult{}, beginErr\n\t}\n\tfor _, statement := range statements {\n\t\ttrimmed := trimStatementSQL(statement)\n\t\tif trimmed == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tresult, err := connection.ExecContext(ctx, trimmed)\n\t\tif err != nil {\n\t\t\treturn queryResult{}, err\n\t\t}\n\t\tcount, _ := result.RowsAffected()\n\t\taffected += max(count, 0)\n\t}\n\treturn emptyQueryResult(affected, started), nil\n}\n","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/hive-go/query.go#L321-L357","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Enable Hive ACID: set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager and hive.support.concurrency=true on the server","Use non-transactional batch execution (transaction=false) if atomic rollback is not required","Run statements on a backend that truly supports rollbackable transactions if atomicity is a hard requirement","Remove the transaction flag from the request rather than relying on implicit fallback"],"exampleFix":"// before\nres, err := conn.ExecuteTransaction(ctx, []string{\"INSERT INTO t ...\", \"UPDATE t ...\"})\n// after (Hive without ACID)\nfor _, s := range stmts {\n    if _, err := conn.Execute(ctx, s); err != nil {\n        return err // manual compensation required\n    }\n}","handlingStrategy":"validation","validationCode":"// Go: verify transaction support before requesting one\nif requireAtomicity && !hiveACIDEnabled(cfg) {\n    return errors.New(\"atomic transactions unsupported; use non-transactional batch or enable ACID\")\n}","typeGuard":null,"tryCatchPattern":"res, err := server.dispatch(ctx, \"executeTransaction\", params)\nif err != nil && strings.Contains(err.Error(), \"rollbackable transactions\") {\n    // surface a config error; do NOT silently retry as auto-commit\n    return fmt.Errorf(\"transaction unsupported by backend: %w\", err)\n}","preventionTips":["Enable hive.support.concurrency and DbTxnManager before using transactions","Only mark batches transactional when atomicity is genuinely required","Document in ops runbooks that Hive needs ACID for rollback semantics"],"tags":["go","hive","transactions","unsupported-feature"],"backgroundTag":"transactions-not-supported","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}