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

Commit33c5baf

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

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

14061410
/* Crank up a transaction state appropriate to a parallel worker. */
@@ -1442,14 +1446,6 @@ ParallelWorkerMain(Datum main_arg)
14421446
*/
14431447
InvalidateSystemCaches();
14441448

1445-
/*
1446-
* Restore GUC values from launching backend. We can't do this earlier,
1447-
* because GUC check hooks that do catalog lookups need to see the same
1448-
* database state as the leader.
1449-
*/
1450-
gucspace=shm_toc_lookup(toc,PARALLEL_KEY_GUC, false);
1451-
RestoreGUCState(gucspace);
1452-
14531449
/*
14541450
* Restore current role id. Skip verifying whether session user is
14551451
* 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
@@ -1221,21 +1221,3 @@ SELECT 1 FROM tenk1_vw_sec
12211221
(9 rows)
12221222

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

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

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp