Sometimes we want to manually start a transaction and execute some statements in it, then finally uniformly commit the transaction.
However, if any one of the statements failed when executing, it would cause a completely corruption of current session. That is, we can't execute any SQLs any more even including rollback because of the exception as follows:
Current transaction is aborted, commands ignored until end of transaction block
Currently, we can do noting but quit and reconnect to use a new session.
Expected Behavior
Enable to successfully execute rollback to end the transaction block
Current Behavior
Execution of rollback fails because of the current transaction being aborted
Possible Solution
Do not check transaction's state when executing rollback.
Steps to Reproduce
- Open a CLI console, and use hive connector, for example:
- Execute the following statements:
set role admin; // To make sure the problem always shows up
create table test_non_autocommit_table (a bigint, b double, c varchar) with(partitioned_by = array['c']);
start transaction;
insert into test_non_autocommit_table values(1, 1.1, '1001'), (2, 1.2, '1002');
// would fail because inserting into the same partition in the same transaction
insert into test_non_autocommit_table values(3, 1.3, '1002');
- After the fail insertion, now we can not execute any sql because of
Current transaction is aborted ....
Sometimes we want to manually start a transaction and execute some statements in it, then finally uniformly commit the transaction.
However, if any one of the statements failed when executing, it would cause a completely corruption of current session. That is, we can't execute any SQLs any more even including
rollbackbecause of the exception as follows:Currently, we can do noting but quit and reconnect to use a new session.
Expected Behavior
Enable to successfully execute
rollbackto end the transaction blockCurrent Behavior
Execution of
rollbackfails because of the current transaction being abortedPossible Solution
Do not check transaction's state when executing
rollback.Steps to Reproduce
Current transaction is aborted ....