pgpool2.git / summary / log / commit / refs
commit bf517d8b9e5519b64ae0b04476914c4ebe052203
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Sat Nov 14 11:40:52 2009 +0000
Allow to change weight with reloading pgpool.conf
pool_config.l | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/pool_config.l b/pool_config.l
index da652aaf9..79137b55b 100644
--- a/pool_config.l
+++ b/pool_config.l
@@ -1119,10 +1119,21 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
pool_debug("pool_config: weight slot number %d weight: %f", slot, v);
status = BACKEND_INFO(slot).backend_status;
- if (context == INIT_CONFIG ||
- (context == RELOAD_CONFIG && (context == RELOAD_CONFIG && (status == CON_UNUSED || status == CON_DOWN))))
+
+ if (context == INIT_CONFIG || context == RELOAD_CONFIG)
{
+ double old_v = pool_config->backend_desc->backend_info[slot].unnormalized_weight;
pool_config->backend_desc->backend_info[slot].unnormalized_weight = v;
+
+ /*
+ * Log weight change event only when context is
+ * reloading of pgpool.conf and weight is actually
+ * changed
+ */
+ if (context == RELOAD_CONFIG && old_v != v)
+ {
+ pool_log("Backend weight for backend%d changed from %f to %f. This will take effect from next client session.", slot, old_v, v);
+ }
}
}
else if (!strncmp(key, "backend_data_directory", 22) &&
[parent: ed14bc75f096]