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

Commitde4fe83

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 parent265ac02 commitde4fe83

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,15 +1148,6 @@ ParallelWorkerMain(Datum main_arg)
11481148
fps->parallel_master_pid))
11491149
return;
11501150

1151-
/*
1152-
* Load libraries that were loaded by original backend. We want to do
1153-
* this before restoring GUCs, because the libraries might define custom
1154-
* variables.
1155-
*/
1156-
libraryspace=shm_toc_lookup(toc,PARALLEL_KEY_LIBRARY);
1157-
Assert(libraryspace!=NULL);
1158-
RestoreLibraryState(libraryspace);
1159-
11601151
/*
11611152
* Identify the entry point to be called. In theory this could result in
11621153
* loading an additional library, though most likely the entry point is in
@@ -1186,10 +1177,19 @@ ParallelWorkerMain(Datum main_arg)
11861177
*/
11871178
SetClientEncoding(GetDatabaseEncoding());
11881179

1180+
/*
1181+
* Load libraries that were loaded by original backend. We want to do
1182+
* this before restoring GUCs, because the libraries might define custom
1183+
* variables.
1184+
*/
1185+
libraryspace=shm_toc_lookup(toc,PARALLEL_KEY_LIBRARY);
1186+
Assert(libraryspace!=NULL);
1187+
StartTransactionCommand();
1188+
RestoreLibraryState(libraryspace);
1189+
11891190
/* Restore GUC values from launching backend. */
11901191
gucspace=shm_toc_lookup(toc,PARALLEL_KEY_GUC);
11911192
Assert(gucspace!=NULL);
1192-
StartTransactionCommand();
11931193
RestoreGUCState(gucspace);
11941194
CommitTransactionCommand();
11951195

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp