@@ -237,6 +237,16 @@ start_bgworker(const char bgworker_name[BGW_MAXLEN],
237
237
return true;
238
238
}
239
239
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
+
240
250
241
251
/*
242
252
* --------------------------------------
@@ -314,10 +324,13 @@ create_partitions_for_value_bg_worker(Oid relid, Datum value, Oid value_type)
314
324
#endif
315
325
316
326
/* 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
+ }
321
334
322
335
/* Save the result (partition Oid) */
323
336
child_oid = bgw_args -> result ;
@@ -742,6 +755,8 @@ partition_table_concurrently(PG_FUNCTION_ARGS)
742
755
{
743
756
/* Couldn't start, free CPS slot */
744
757
cps_set_status (& concurrent_part_slots [empty_slot_idx ], CPS_FREE );
758
+
759
+ start_bgworker_errmsg (concurrent_part_bgw );
745
760
}
746
761
747
762
/* Tell user everything's fine */
0 commit comments