Fix backend_application_name cannot be changed by reloading.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 3 Jun 2021 05:39:06 +0000 (14:39 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 3 Jun 2021 05:46:34 +0000 (14:46 +0900)
The manual explicitly stats that it is possible to change
backend_application_name on the fly by reloading the configuration
file but the code set unnecessary restriction on that.

src/config/pool_config_variables.c

index e0d6384746b85fad36861814752ae924940d0996..3310b96c5fd47ca456eb533dc9d4b324f440adb7 100644 (file)
@@ -4120,21 +4120,11 @@ BackendFlagsAssignFunc(ConfigContext context, char *newval, int index, int eleve
 static bool
 BackendAppNameAssignFunc(ConfigContext context, char *newval, int index, int elevel)
 {
-       BACKEND_STATUS backend_status = g_pool_config.backend_desc->backend_info[index].backend_status;
-
-       if (context <= CFGCXT_INIT || backend_status == CON_UNUSED || backend_status == CON_DOWN)
-       {
-               if (newval == NULL || strlen(newval) == 0)
-                       g_pool_config.backend_desc->backend_info[index].backend_application_name[0] = '\0';
-               else
-                       strlcpy(g_pool_config.backend_desc->backend_info[index].backend_application_name, newval, NAMEDATALEN - 1);
-               return true;
-       }
-       /* silent the warning in reload contxt */
-       if (context != CFGCXT_RELOAD)
-               ereport(WARNING,
-                               (errmsg("backend_application_name%d cannot be changed in context %d and backend status = %d", index, context, backend_status)));
-       return false;
+       if (newval == NULL || strlen(newval) == 0)
+               g_pool_config.backend_desc->backend_info[index].backend_application_name[0] = '\0';
+       else
+               strlcpy(g_pool_config.backend_desc->backend_info[index].backend_application_name, newval, NAMEDATALEN - 1);
+       return true;
 }
 
 static bool