Config post-processing stage now throws an error if num_init_children is
smaller than max_spare_children.
Commit also adjusts the number of child processes spawned at startup based on
the configured process management strategy.
For the Aggressive strategy, max_spare_children number of processes is spawned;
for the other two strategies, min_spare_children number of children gets
created at startup.
pool_config->max_spare_children,pool_config->min_spare_children)));
return false;
}
+ if (pool_config->num_init_children < pool_config->max_spare_children)
+ {
+ ereport(elevel,
+ (errmsg("invalid configuration, max_spare_children:%d can't be greater than num_init_children:%d",
+ pool_config->max_spare_children,pool_config->num_init_children)));
+ return false;
+ }
return true;
}
POOL_SETMASK(&BlockSig);
if (pool_config->process_management == PM_DYNAMIC)
- current_child_process_count = pool_config->max_spare_children;
+ {
+ if (pool_config->process_management_strategy == PM_STRATEGY_AGGRESSIVE)
+ current_child_process_count = pool_config->max_spare_children;
+ else
+ current_child_process_count = pool_config->min_spare_children;
+ }
else
current_child_process_count = pool_config->num_init_children;
-
- /* fork the children */
+ ereport(DEBUG1,
+ (errmsg("Spawning %d child processes",current_child_process_count)));
for (i = 0; i < current_child_process_count; i++)
{
process_info[i].start_time = time(NULL);