Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit33187ab

Browse files
committed
Revert "Allow parallel workers to cope with a newly-created session user ID."
This reverts commit849326e.Some buildfarm animals are failing with "cannot change"client_encoding" during a parallel operation". It looks likeassign_client_encoding is unhappy at being asked to roll back aclient_encoding setting after a parallel worker encounters afailure. There must be more to it though: why didn't I see thisduring local testing? In any case, it's clear that moving theRestoreGUCState() call is not as side-effect-free as I thought.Given that the bugf5f30c2 intended to fix has gone unreportedfor years, it's not something that's urgent to fix; I'm notwilling to risk messing with it further with only days to ournext release wrap.
1 parent849326e commit33187ab

File tree

4 files changed

+6
-43
lines changed

4 files changed

+6
-43
lines changed

‎src/backend/access/transam/parallel.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,10 @@ ParallelWorkerMain(Datum main_arg)
14141414
libraryspace=shm_toc_lookup(toc,PARALLEL_KEY_LIBRARY, false);
14151415
StartTransactionCommand();
14161416
RestoreLibraryState(libraryspace);
1417+
1418+
/* Restore GUC values from launching backend. */
1419+
gucspace=shm_toc_lookup(toc,PARALLEL_KEY_GUC, false);
1420+
RestoreGUCState(gucspace);
14171421
CommitTransactionCommand();
14181422

14191423
/* Crank up a transaction state appropriate to a parallel worker. */
@@ -1455,14 +1459,6 @@ ParallelWorkerMain(Datum main_arg)
14551459
*/
14561460
InvalidateSystemCaches();
14571461

1458-
/*
1459-
* Restore GUC values from launching backend. We can't do this earlier,
1460-
* because GUC check hooks that do catalog lookups need to see the same
1461-
* database state as the leader.
1462-
*/
1463-
gucspace=shm_toc_lookup(toc,PARALLEL_KEY_GUC, false);
1464-
RestoreGUCState(gucspace);
1465-
14661462
/*
14671463
* Restore current role id. Skip verifying whether session user is
14681464
* allowed to become this role and blindly restore the leader's state for

‎src/backend/commands/variable.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,16 +577,14 @@ check_transaction_read_only(bool *newval, void **extra, GucSource source)
577577
* We allow idempotent changes at any time, but otherwise this can only be
578578
* changed in a toplevel transaction that has not yet taken a snapshot.
579579
*
580-
* As in check_transaction_read_only, allow it if not inside a transaction,
581-
* or if restoring state in a parallel worker.
580+
* As in check_transaction_read_only, allow it if not inside a transaction.
582581
*/
583582
bool
584583
check_transaction_isolation(int*newval,void**extra,GucSourcesource)
585584
{
586585
intnewXactIsoLevel=*newval;
587586

588-
if (newXactIsoLevel!=XactIsoLevel&&
589-
IsTransactionState()&& !InitializingParallelWorker)
587+
if (newXactIsoLevel!=XactIsoLevel&&IsTransactionState())
590588
{
591589
if (FirstSnapshotSet)
592590
{
@@ -621,10 +619,6 @@ check_transaction_isolation(int *newval, void **extra, GucSource source)
621619
bool
622620
check_transaction_deferrable(bool*newval,void**extra,GucSourcesource)
623621
{
624-
/* Just accept the value when restoring state in a parallel worker */
625-
if (InitializingParallelWorker)
626-
return true;
627-
628622
if (IsSubTransaction())
629623
{
630624
GUC_check_errcode(ERRCODE_ACTIVE_SQL_TRANSACTION);

‎src/test/regress/expected/select_parallel.out

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,21 +1219,3 @@ SELECT 1 FROM tenk1_vw_sec
12191219
(9 rows)
12201220

12211221
rollback;
1222-
-- test that a newly-created session role propagates to workers.
1223-
begin;
1224-
create role regress_parallel_worker;
1225-
set session authorization regress_parallel_worker;
1226-
select current_setting('session_authorization');
1227-
current_setting
1228-
-------------------------
1229-
regress_parallel_worker
1230-
(1 row)
1231-
1232-
set debug_parallel_query = 1;
1233-
select current_setting('session_authorization');
1234-
current_setting
1235-
-------------------------
1236-
regress_parallel_worker
1237-
(1 row)
1238-
1239-
rollback;

‎src/test/regress/sql/select_parallel.sql

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,3 @@ SELECT 1 FROM tenk1_vw_sec
462462
WHERE (SELECTsum(f1)FROM int4_tblWHERE f1< unique1)<100;
463463

464464
rollback;
465-
466-
-- test that a newly-created session role propagates to workers.
467-
begin;
468-
create role regress_parallel_worker;
469-
set session authorization regress_parallel_worker;
470-
select current_setting('session_authorization');
471-
set debug_parallel_query=1;
472-
select current_setting('session_authorization');
473-
rollback;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp