Verify the spare children config values only in dynamic process management mode
authorMuhammad Usama <m.usama@gmail.com>
Sun, 23 Jul 2023 17:32:22 +0000 (22:32 +0500)
committerMuhammad Usama <m.usama@gmail.com>
Sun, 23 Jul 2023 17:41:38 +0000 (22:41 +0500)
As suggested by Tatsuo Ishii there is no point in verifying the validity of
min and max spare children configurations for static process management mode,
As these configuration values get ignored in static mode anyway.

src/config/pool_config_variables.c

index faa677698120fe02247a55cedf7935948949570c..c5a6fb34b07d59d0656500cfc48b5128f1119009 100644 (file)
@@ -4959,19 +4959,27 @@ config_post_processor(ConfigContext context, int elevel)
                return false;
        }
 
-       if (pool_config->min_spare_children >= pool_config->max_spare_children)
-       {
-               ereport(elevel,
-                               (errmsg("invalid configuration, max_spare_children:%d must be greater than min_spare_children:%d",
-                               pool_config->max_spare_children,pool_config->min_spare_children)));
-               return false;
-       }
-       if (pool_config->num_init_children < pool_config->max_spare_children)
+       /*
+        * Verify the minimum and maximum number of spare children configuration when
+        * dynamic process management is enabled
+        */
+
+       if (g_pool_config.process_management == PM_DYNAMIC)
        {
-               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;
+               if (pool_config->min_spare_children >= pool_config->max_spare_children)
+               {
+                       ereport(elevel,
+                                       (errmsg("invalid configuration, max_spare_children:%d must be greater than min_spare_children:%d",
+                                       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;
 }