Skip to content

Commit

Permalink
Improve defensive code for crash in AtEOXact_Parallel (#2002)
Browse files Browse the repository at this point in the history
Setting GUC during parallel operation will cause GUC inconsistency
because there is no way to sync the GUC value among parallel workers.

This commit only allows setting insert_identity during parallel
operation initialization.

Task: BABEL-4340/4419/4423
Signed-off-by: Xiaohui Fanhe <[email protected]>
  • Loading branch information
xhfanhe authored Nov 10, 2023
1 parent 15638a8 commit 939ff04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
18 changes: 17 additions & 1 deletion contrib/babelfishpg_tsql/src/pl_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,24 @@ set_procid(Oid oid)
static void
assign_identity_insert(const char *newval, void *extra)
{
/*
* Workers synchronize the parameter at the beginning of each parallel
* operation. Avoid performing parameter assignment uring parallel operation.
*/
if (IsParallelWorker())
return;
{
if (InitializingParallelWorker)
return;

/*
* A change other than during startup, for example due to a SET clause
* attached to a function definition, should be rejected, as there is
* nothing we can do inside the worker to make it take effect.
*/
ereport(ERROR,
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
errmsg("cannot change identity_insert during a parallel operation")));
}

if (strcmp(newval, "") != 0)
{
Expand Down
11 changes: 0 additions & 11 deletions test/JDBC/parallel_query_jdbc_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -298,22 +298,11 @@ ignore#!#test_windows_login-vu-prepare
ignore#!#test_windows_login-vu-verify
ignore#!#test_windows_login-vu-cleanup

# JIRA - BABEL-4419
ignore#!#BABEL-1056
ignore#!#BABEL-GUC-PLAN
ignore#!#BABEL-3092
ignore#!#BABEL-COLUMN-CONSTRAINT
ignore#!#BABEL-1251-vu-verify
ignore#!#BABEL-1251

# JIRA - BABEL-4421
ignore#!#Test-sp_addrolemember-dep-vu-verify
ignore#!#Test-sp_droprolemember-dep-vu-verify
ignore#!#babel_table_type

# BABEL-4423
ignore#!#BABEL-IDENTITY

# BABEL-4424
ignore#!#TestDecimal
ignore#!#TestNumeric
Expand Down

0 comments on commit 939ff04

Please sign in to comment.