Skip to content

Session is completely corrupted by the failed statement in a non-autocommit transaction #23246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hantangwangd opened this issue Jul 18, 2024 · 0 comments · Fixed by #23247 · May be fixed by #24960
Closed

Session is completely corrupted by the failed statement in a non-autocommit transaction #23246

hantangwangd opened this issue Jul 18, 2024 · 0 comments · Fixed by #23247 · May be fixed by #24960
Labels

Comments

@hantangwangd
Copy link
Member

hantangwangd commented Jul 18, 2024

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

  1. Open a CLI console, and use hive connector, for example:
use hive.default;
  1. 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');
  1. After the fail insertion, now we can not execute any sql because of Current transaction is aborted ....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
1 participant