Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 485f025

Browse files
committed
improve error messages in BGWs
1 parent f9c842e commit 485f025

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/pathman_workers.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,16 @@ start_bgworker(const char bgworker_name[BGW_MAXLEN],
237237
return true;
238238
}
239239

240+
/*
241+
* Show generic error message if we failed to start bgworker.
242+
*/
243+
static inline void
244+
start_bgworker_errmsg(const char *bgworker_name)
245+
{
246+
ereport(ERROR, (errmsg("could not start %s", bgworker_name),
247+
errhint("consider increasing max_worker_processes")));
248+
}
249+
240250

241251
/*
242252
* --------------------------------------
@@ -314,10 +324,13 @@ create_partitions_for_value_bg_worker(Oid relid, Datum value, Oid value_type)
314324
#endif
315325

316326
/* Start worker and wait for it to finish */
317-
(void) start_bgworker(spawn_partitions_bgw,
318-
CppAsString(bgw_main_spawn_partitions),
319-
UInt32GetDatum(segment_handle),
320-
true);
327+
if (!start_bgworker(spawn_partitions_bgw,
328+
CppAsString(bgw_main_spawn_partitions),
329+
UInt32GetDatum(segment_handle),
330+
true))
331+
{
332+
start_bgworker_errmsg(spawn_partitions_bgw);
333+
}
321334

322335
/* Save the result (partition Oid) */
323336
child_oid = bgw_args->result;
@@ -742,6 +755,8 @@ partition_table_concurrently(PG_FUNCTION_ARGS)
742755
{
743756
/* Couldn't start, free CPS slot */
744757
cps_set_status(&concurrent_part_slots[empty_slot_idx], CPS_FREE);
758+
759+
start_bgworker_errmsg(concurrent_part_bgw);
745760
}
746761

747762
/* Tell user everything's fine */

0 commit comments

Comments
 (0)