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

Commitafbf32f

Browse files
committed
Revert "Allow parallel workers to cope with a newly-created session user ID."
This reverts commit4853630.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 parent4853630 commitafbf32f

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
@@ -1402,6 +1402,10 @@ ParallelWorkerMain(Datum main_arg)
14021402
libraryspace=shm_toc_lookup(toc,PARALLEL_KEY_LIBRARY, false);
14031403
StartTransactionCommand();
14041404
RestoreLibraryState(libraryspace);
1405+
1406+
/* Restore GUC values from launching backend. */
1407+
gucspace=shm_toc_lookup(toc,PARALLEL_KEY_GUC, false);
1408+
RestoreGUCState(gucspace);
14051409
CommitTransactionCommand();
14061410

14071411
/* Crank up a transaction state appropriate to a parallel worker. */
@@ -1443,14 +1447,6 @@ ParallelWorkerMain(Datum main_arg)
14431447
*/
14441448
InvalidateSystemCaches();
14451449

1446-
/*
1447-
* Restore GUC values from launching backend. We can't do this earlier,
1448-
* because GUC check hooks that do catalog lookups need to see the same
1449-
* database state as the leader.
1450-
*/
1451-
gucspace=shm_toc_lookup(toc,PARALLEL_KEY_GUC, false);
1452-
RestoreGUCState(gucspace);
1453-
14541450
/*
14551451
* Restore current role id. Skip verifying whether session user is
14561452
* 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
@@ -519,16 +519,14 @@ check_transaction_read_only(bool *newval, void **extra, GucSource source)
519519
* We allow idempotent changes at any time, but otherwise this can only be
520520
* changed in a toplevel transaction that has not yet taken a snapshot.
521521
*
522-
* As in check_transaction_read_only, allow it if not inside a transaction,
523-
* or if restoring state in a parallel worker.
522+
* As in check_transaction_read_only, allow it if not inside a transaction.
524523
*/
525524
bool
526525
check_XactIsoLevel(int*newval,void**extra,GucSourcesource)
527526
{
528527
intnewXactIsoLevel=*newval;
529528

530-
if (newXactIsoLevel!=XactIsoLevel&&
531-
IsTransactionState()&& !InitializingParallelWorker)
529+
if (newXactIsoLevel!=XactIsoLevel&&IsTransactionState())
532530
{
533531
if (FirstSnapshotSet)
534532
{
@@ -563,10 +561,6 @@ check_XactIsoLevel(int *newval, void **extra, GucSource source)
563561
bool
564562
check_transaction_deferrable(bool*newval,void**extra,GucSourcesource)
565563
{
566-
/* Just accept the value when restoring state in a parallel worker */
567-
if (InitializingParallelWorker)
568-
return true;
569-
570564
if (IsSubTransaction())
571565
{
572566
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 force_parallel_mode = 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 force_parallel_mode=1;
472-
select current_setting('session_authorization');
473-
rollback;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp