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

Appearance settings

Commit 3fa5d08

Browse filesBrowse files
committed
Forbid to spawn partitions using bgw from bgw spawning partitions.
1 parent dbcbd02 commit 3fa5d08
Copy full SHA for 3fa5d08

File tree

1 file changed

+10
-0
lines changed
Filter options

1 file changed

+10
-0
lines changed

‎src/pathman_workers.c

Copy file name to clipboardExpand all lines: src/pathman_workers.c
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ static const char *spawn_partitions_bgw = "SpawnPartitionsWorker";
8484
static const char *concurrent_part_bgw = "ConcurrentPartWorker";
8585

8686

87+
/* Used for preventing spawn bgw recursion trouble */
88+
static bool am_spawn_bgw = false;
89+
8790
/*
8891
* Estimate amount of shmem needed for concurrent partitioning.
8992
*/
@@ -312,6 +315,11 @@ create_partitions_for_value_bg_worker(Oid relid, Datum value, Oid value_type)
312315
SpawnPartitionArgs *bgw_args;
313316
Oid child_oid = InvalidOid;
314317

318+
if (am_spawn_bgw)
319+
ereport(ERROR,
320+
(errmsg("Attempt to spawn partition using bgw from bgw spawning partitions"),
321+
errhint("Probably init_callback has INSERT to its table?")));
322+
315323
/* Create a dsm segment for the worker to pass arguments */
316324
segment = create_partitions_bg_worker_segment(relid, value, value_type);
317325
segment_handle = dsm_segment_handle(segment);
@@ -363,6 +371,8 @@ bgw_main_spawn_partitions(Datum main_arg)
363371
/* We're now ready to receive signals */
364372
BackgroundWorkerUnblockSignals();
365373

374+
am_spawn_bgw = true;
375+
366376
/* Create resource owner */
367377
CurrentResourceOwner = ResourceOwnerCreate(NULL, spawn_partitions_bgw);
368378

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.