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

Commit6c3c9d4

Browse files
committed
Defer restoration of libraries in parallel workers.
Several users of extensions complained of crashes in parallel workersthat turned out to be due to syscache access from their _PG_init()functions. Reorder the initialization of parallel workers so thatlibraries are restored after the caches are initialized, and inside atransaction.This was reported in bug #15350 and elsewhere. We don't consider itto be a bug: extensions shouldn't do that, because then they can't beused in shared_preload_libraries. However, it's a fairly obscurehazard and these extensions worked in practice before parallel querycame along. So let's make it work. Later commits might add a warningmessage and eventually an error.Back-patch to 9.6, where parallel query landed.Author: Thomas MunroReviewed-by: Amit KapilaReported-by: Kieran McCusker, JimmyDiscussion:https://postgr.es/m/153512195228.1489.8545997741965926448%40wrigleys.postgresql.org
1 parent40cfe86 commit6c3c9d4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,14 +1311,6 @@ ParallelWorkerMain(Datum main_arg)
13111311
fps->parallel_master_pid))
13121312
return;
13131313

1314-
/*
1315-
* Load libraries that were loaded by original backend. We want to do
1316-
* this before restoring GUCs, because the libraries might define custom
1317-
* variables.
1318-
*/
1319-
libraryspace=shm_toc_lookup(toc,PARALLEL_KEY_LIBRARY, false);
1320-
RestoreLibraryState(libraryspace);
1321-
13221314
/*
13231315
* Identify the entry point to be called. In theory this could result in
13241316
* loading an additional library, though most likely the entry point is in
@@ -1341,9 +1333,17 @@ ParallelWorkerMain(Datum main_arg)
13411333
*/
13421334
SetClientEncoding(GetDatabaseEncoding());
13431335

1336+
/*
1337+
* Load libraries that were loaded by original backend. We want to do
1338+
* this before restoring GUCs, because the libraries might define custom
1339+
* variables.
1340+
*/
1341+
libraryspace=shm_toc_lookup(toc,PARALLEL_KEY_LIBRARY, false);
1342+
StartTransactionCommand();
1343+
RestoreLibraryState(libraryspace);
1344+
13441345
/* Restore GUC values from launching backend. */
13451346
gucspace=shm_toc_lookup(toc,PARALLEL_KEY_GUC, false);
1346-
StartTransactionCommand();
13471347
RestoreGUCState(gucspace);
13481348
CommitTransactionCommand();
13491349

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp