pgpool2.git / summary / log / commit / refs

commit    e47f8a3fba395b5cfb23344c35d7eff1791cf82d
Author:   Muhammad Usama <m.usama@gmail.com>
Date:     Sun Aug 19 09:46:49 2018 +0000

    Use failover instead of fail-over pr fail_over
    
    Fix mistakes where "fail_over" and "fail-over" were used instead of the
    "failover". And that also includes a wrongly spelled configuration parameter
    "fail_over_on_backend_error",
    Now we throw a warning message when old config name fail_over_on_backend_error
    is used instead of failover_on_backend_error,
    Using the old config variable name will have no effect.


doc/src/sgml/examples.sgml | 2 +- doc/src/sgml/failover.sgml | 16 +++++++++++----- doc/src/sgml/healthcheck.sgml | 2 +- doc/src/sgml/release-3.6.sgml | 22 +++++++++++----------- src/config/pool_config_variables.c | 27 ++++++++++++++++++++++++++- src/include/pool_config.h | 2 +- src/protocol/pool_connection_pool.c | 8 ++++---- src/sample/pgpool.conf.sample | 2 +- src/sample/pgpool.conf.sample-logical | 2 +- src/sample/pgpool.conf.sample-master-slave | 2 +- src/sample/pgpool.conf.sample-replication | 2 +- src/sample/pgpool.conf.sample-stream | 2 +- src/utils/pool_process_reporting.c | 6 +++--- src/utils/pool_stream.c | 20 ++++++++++---------- src/watchdog/watchdog.c | 2 +- src/watchdog/wd_json_data.c | 4 ++-- 16 files changed, 76 insertions(+), 45 deletions(-) diff --git a/doc/src/sgml/examples.sgml b/doc/src/sgml/examples.sgml index ea97551b7..d8df89bed 100644 --- a/doc/src/sgml/examples.sgml +++ b/doc/src/sgml/examples.sgml @@ -1930,7 +1930,7 @@ PING 35.163.178.3 (35.163.178.3) 56(84) bytes of data. </listitem> <listitem> <para> - Disable <xref linkend="guc-fail-over-on-backend-error"> + Disable <xref linkend="guc-failover-on-backend-error"> to avoid failover when connecting to the backend or detecting errors on backend side while executing queries for the same reasons above. diff --git a/doc/src/sgml/failover.sgml b/doc/src/sgml/failover.sgml index 51968b477..1eb62f35f 100644 --- a/doc/src/sgml/failover.sgml +++ b/doc/src/sgml/failover.sgml @@ -113,7 +113,7 @@ <para> However from <productname>Pgpool-II</productname> 3.6, In the steaming replication mode, client sessions will not be - disconnected when a fail-over occurs any more if the + disconnected when a failover occurs any more if the session does not use the failed standby server. If the primary server goes down, still all sessions will be disconnected. Health check timeout case will also cause @@ -304,10 +304,10 @@ </listitem> </varlistentry> - <varlistentry id="guc-fail-over-on-backend-error" xreflabel="fail_over_on_backend_error"> - <term><varname>fail_over_on_backend_error</varname> (<type>boolean</type>) + <varlistentry id="guc-failover-on-backend-error" xreflabel="failover_on_backend_error"> + <term><varname>failover_on_backend_error</varname> (<type>boolean</type>) <indexterm> - <primary><varname>fail_over_on_backend_error</varname> configuration parameter</primary> + <primary><varname>failover_on_backend_error</varname> configuration parameter</primary> </indexterm> </term> <listitem> @@ -322,7 +322,7 @@ <para> It is recommended to turn on the backend health checking (see <xref linkend="runtime-config-health-check">) - when <varname>fail_over_on_backend_error</varname> is set to off. + when <varname>failover_on_backend_error</varname> is set to off. Note, however, that <productname>Pgpool-II</productname> still triggers the failover when it detects the administrative shutdown of <productname>PostgreSQL</> backend server. @@ -332,6 +332,12 @@ <para> This parameter can be changed by reloading the <productname>Pgpool-II</> configurations. </para> + <note> + <para> + Prior to <productname>Pgpool-II</productname> <emphasis>V4.0</emphasis>, + this configuration parameter name was <varname>fail</varname><emphasis>_</emphasis><varname>over_on_backend_error</varname> + </para> + </note> </listitem> </varlistentry> diff --git a/doc/src/sgml/healthcheck.sgml b/doc/src/sgml/healthcheck.sgml index d75d35145..6db7b0bd9 100644 --- a/doc/src/sgml/healthcheck.sgml +++ b/doc/src/sgml/healthcheck.sgml @@ -174,7 +174,7 @@ </tip> <tip> <para> - It is advised that <xref linkend="guc-fail-over-on-backend-error"> must be disabled, + It is advised that <xref linkend="guc-failover-on-backend-error"> must be disabled, if you want to enable <varname>health_check_max_retries</>. </para> </tip> diff --git a/doc/src/sgml/release-3.6.sgml b/doc/src/sgml/release-3.6.sgml index f2f381f0e..edba4c4a8 100644 --- a/doc/src/sgml/release-3.6.sgml +++ b/doc/src/sgml/release-3.6.sgml @@ -2174,9 +2174,9 @@ <listitem> <para> - Improve the behavior of fail-over. In the steaming + Improve the behavior of failover. In the steaming replication mode, client sessions will not be disconnected - when a fail-over occurs any more if the session does not use + when a failover occurs any more if the session does not use the failed standby server. If the primary server goes down, still all sessions will be disconnected. Also it is possible to connect to <productname>Pgpool-II</productname> even if @@ -2218,7 +2218,7 @@ <listitem> <para> In some cases pg_terminate_backend() now does not trigger a - fail-over. + failover. </para> </listitem> @@ -2248,11 +2248,11 @@ 2016-05-05 [0d66032] Allow to access to pgpool while doing health checking --> <para> - Improve the behavior of fail-over. (Tatsuo Ishii) + Improve the behavior of failover. (Tatsuo Ishii) </para> <para> In the steaming replication mode, client sessions will not - be disconnected when a fail-over occurs any more if the + be disconnected when a failover occurs any more if the session does not use the failed standby server. If the primary server goes down, still all sessions will be disconnected. Health check timeout case will also cause the @@ -2264,9 +2264,9 @@ <para> For user's convenience, "show pool_nodes" command shows the session local load balance node info since this is important - for users in case of fail-over. If the load balance node is + for users in case of failover. If the load balance node is not the failed node, the session will not be affected by - fail-over. + failover. </para> <para> @@ -2277,12 +2277,12 @@ health checking retries. Before any attempt to connect to <productname>Pgpool-II</productname> fails if it is doing a health check against failed node even if - <xref linkend="guc-fail-over-on-backend-error"> is off + <xref linkend="guc-failover-on-backend-error"> is off because <productname>Pgpool-II</productname> child first tries to connect to all backend including the failed one and exits if it fails to connect to a backend (of course it fails). This is a temporary situation and will be resolved - once pgpool executes fail-over. However if the health check + once pgpool executes failover. However if the health check is retrying, the temporary situation keeps longer depending on the setting of <xref linkend="guc-health-check-max-retries"> and @@ -2409,7 +2409,7 @@ 2016-08-26 [f284be4] Handling of pg_terminate_backend for simple query protocol --> <para> - In some cases <function>pg_terminate_backend()</function> now does not trigger a fail-over. (Muhammad Usama) + In some cases <function>pg_terminate_backend()</function> now does not trigger a failover. (Muhammad Usama) </para> <para> Because PostgreSQL returns exactly the same error code as postmaster @@ -2976,7 +2976,7 @@ --> <para> Fix that <function>pool_read()</function> does not emit error messages when <function>read(2)</function> returns -1 if - <xref linkend="guc-fail-over-on-backend-error"> is off. (Tatsuo Ishii) + <xref linkend="guc-failover-on-backend-error"> is off. (Tatsuo Ishii) </para> </listitem> <listitem> diff --git a/src/config/pool_config_variables.c b/src/config/pool_config_variables.c index 4559c61c0..99be52385 100644 --- a/src/config/pool_config_variables.c +++ b/src/config/pool_config_variables.c @@ -104,6 +104,7 @@ static bool WdSlotEmptyCheckFunc(int index); static bool BackendSlotEmptyCheckFunc(int index); /*variable custom assign functions */ +static bool FailOverOnBackendErrorAssignMessage(ConfigContext scontext, bool newval, int elevel); static bool BackendPortAssignFunc(ConfigContext context, int newval, int index, int elevel); static bool BackendHostAssignFunc(ConfigContext context, char *newval, int index, int elevel); static bool BackendDataDirAssignFunc(ConfigContext context, char *newval, int index, int elevel); @@ -369,10 +370,20 @@ static struct config_bool ConfigureNamesBool[] = { {"fail_over_on_backend_error", CFGCXT_RELOAD, FAILOVER_CONFIG, + "Old config parameter for failover_on_backend_error.", + CONFIG_VAR_TYPE_BOOL, false, VAR_HIDDEN_IN_SHOW_ALL + }, + NULL, + true, + FailOverOnBackendErrorAssignMessage, NULL, NULL + }, + + { + {"failover_on_backend_error", CFGCXT_RELOAD, FAILOVER_CONFIG, "Triggers fail over when reading/writing to backend socket fails.", CONFIG_VAR_TYPE_BOOL, false, 0 }, - &g_pool_config.fail_over_on_backend_error, + &g_pool_config.failover_on_backend_error, true, NULL, NULL, NULL }, @@ -4111,6 +4122,20 @@ HBDestinationPortAssignFunc(ConfigContext context, int newval, int index, int el return true; } +/* + * Throws warning for if someone uses the removed fail_over_on_backend + * configuration parameter + */ +static bool +FailOverOnBackendErrorAssignMessage(ConfigContext scontext, bool newval, int elevel) +{ + if (scontext != CFGCXT_BOOT) + ereport(WARNING, + (errmsg("fail_over_on_backend_error is changed to failover_on_backend_error"), + errdetail("setting failover_on_backend_error has no effect"), + errhint("use failover_on_backend_error instead"))); + return true; +} /* * Check DB node spec. node spec should be either "primary", "standby" or * numeric DB node id. diff --git a/src/include/pool_config.h b/src/include/pool_config.h index 32b9b1c84..844e998d0 100644 --- a/src/include/pool_config.h +++ b/src/include/pool_config.h @@ -262,7 +262,7 @@ typedef struct * ended */ char *failback_command; /* execute command when failback happens */ - bool fail_over_on_backend_error; /* If true, trigger fail over when + bool failover_on_backend_error; /* If true, trigger fail over when * writing to the backend * communication socket fails. * This is the same behavior of diff --git a/src/protocol/pool_connection_pool.c b/src/protocol/pool_connection_pool.c index d5f05a5ab..6370cb5f8 100644 --- a/src/protocol/pool_connection_pool.c +++ b/src/protocol/pool_connection_pool.c @@ -890,10 +890,10 @@ static POOL_CONNECTION_POOL * new_connection(POOL_CONNECTION_POOL * p) if (create_cp(s, i) == NULL) { /* - * If fail_over_on_backend_error is true, do failover. Otherwise, + * If failover_on_backend_error is true, do failover. Otherwise, * just exit this session or skip next health node. */ - if (pool_config->fail_over_on_backend_error) + if (pool_config->failover_on_backend_error) { notice_backend_error(i, REQ_DETAIL_SWITCHOVER); ereport(FATAL, @@ -910,7 +910,7 @@ static POOL_CONNECTION_POOL * new_connection(POOL_CONNECTION_POOL * p) { ereport(LOG, (errmsg("failed to create a backend %d connection", i), - errdetail("skip this backend because because fail_over_on_backend_error is off and we are in streaming replication mode and node is standby node"))); + errdetail("skip this backend because because failover_on_backend_error is off and we are in streaming replication mode and node is standby node"))); /* set down status to local status area */ *(my_backend_status[i]) = CON_DOWN; @@ -938,7 +938,7 @@ static POOL_CONNECTION_POOL * new_connection(POOL_CONNECTION_POOL * p) { ereport(FATAL, (errmsg("failed to create a backend %d connection", i), - errdetail("not executing failover because fail_over_on_backend_error is off"))); + errdetail("not executing failover because failover_on_backend_error is off"))); } } child_exit(POOL_EXIT_AND_RESTART); diff --git a/src/sample/pgpool.conf.sample b/src/sample/pgpool.conf.sample index b0d4b3caa..c5304e89d 100644 --- a/src/sample/pgpool.conf.sample +++ b/src/sample/pgpool.conf.sample @@ -466,7 +466,7 @@ failback_command = '' # %R = new master database cluster path # %% = '%' character -fail_over_on_backend_error = on +failover_on_backend_error = on # Initiates failover when reading/writing to the # backend communication socket fails # If set to off, pgpool will report an diff --git a/src/sample/pgpool.conf.sample-logical b/src/sample/pgpool.conf.sample-logical index 809ed6f78..b3f1aeb68 100644 --- a/src/sample/pgpool.conf.sample-logical +++ b/src/sample/pgpool.conf.sample-logical @@ -451,7 +451,7 @@ failback_command = '' # %R = new master database cluster path # %% = '%' character -fail_over_on_backend_error = on +failover_on_backend_error = on # Initiates failover when reading/writing to the # backend communication socket fails # If set to off, pgpool will report an diff --git a/src/sample/pgpool.conf.sample-master-slave b/src/sample/pgpool.conf.sample-master-slave index 56fedcae3..9d330c270 100644 --- a/src/sample/pgpool.conf.sample-master-slave +++ b/src/sample/pgpool.conf.sample-master-slave @@ -465,7 +465,7 @@ failback_command = '' # %R = new master database cluster path # %% = '%' character -fail_over_on_backend_error = on +failover_on_backend_error = on # Initiates failover when reading/writing to the # backend communication socket fails # If set to off, pgpool will report an diff --git a/src/sample/pgpool.conf.sample-replication b/src/sample/pgpool.conf.sample-replication index fa6d5f306..827cea315 100644 --- a/src/sample/pgpool.conf.sample-replication +++ b/src/sample/pgpool.conf.sample-replication @@ -463,7 +463,7 @@ failback_command = '' # %R = new master database cluster path # %% = '%' character -fail_over_on_backend_error = on +failover_on_backend_error = on # Initiates failover when reading/writing to the # backend communication socket fails # If set to off, pgpool will report an diff --git a/src/sample/pgpool.conf.sample-stream b/src/sample/pgpool.conf.sample-stream index 9138862ab..84b791d36 100644 --- a/src/sample/pgpool.conf.sample-stream +++ b/src/sample/pgpool.conf.sample-stream @@ -464,7 +464,7 @@ failback_command = '' # %R = new master database cluster path # %% = '%' character -fail_over_on_backend_error = on +failover_on_backend_error = on # Initiates failover when reading/writing to the # backend communication socket fails # If set to off, pgpool will report an diff --git a/src/utils/pool_process_reporting.c b/src/utils/pool_process_reporting.c index b5d22783d..8c8d4dad8 100644 --- a/src/utils/pool_process_reporting.c +++ b/src/utils/pool_process_reporting.c @@ -605,9 +605,9 @@ get_config(int *nrows) StrNCpy(status[i].desc, "failback command", POOLCONFIG_MAXDESCLEN); i++; - StrNCpy(status[i].name, "fail_over_on_backend_error", POOLCONFIG_MAXNAMELEN); - snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%d", pool_config->fail_over_on_backend_error); - StrNCpy(status[i].desc, "fail over on backend error", POOLCONFIG_MAXDESCLEN); + StrNCpy(status[i].name, "failover_on_backend_error", POOLCONFIG_MAXNAMELEN); + snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%d", pool_config->failover_on_backend_error); + StrNCpy(status[i].desc, "failover on backend error", POOLCONFIG_MAXDESCLEN); i++; StrNCpy(status[i].name, "detach_false_primary", POOLCONFIG_MAXNAMELEN); diff --git a/src/utils/pool_stream.c b/src/utils/pool_stream.c index 63149d499..cfec0338a 100644 --- a/src/utils/pool_stream.c +++ b/src/utils/pool_stream.c @@ -220,10 +220,10 @@ pool_read(POOL_CONNECTION * cp, void *buf, int len) } /* - * if fail_over_on_backend_error is true, then trigger + * if failover_on_backend_error is true, then trigger * failover */ - if (pool_config->fail_over_on_backend_error) + if (pool_config->failover_on_backend_error) { notice_backend_error(cp->db_node_id, REQ_DETAIL_SWITCHOVER); @@ -372,10 +372,10 @@ pool_read2(POOL_CONNECTION * cp, int len) } /* - * if fail_over_on_backend_error is true, then trigger + * if failover_on_backend_error is true, then trigger * failover */ - if (pool_config->fail_over_on_backend_error) + if (pool_config->failover_on_backend_error) { notice_backend_error(cp->db_node_id, REQ_DETAIL_SWITCHOVER); child_exit(POOL_EXIT_AND_RESTART); @@ -388,7 +388,7 @@ pool_read2(POOL_CONNECTION * cp, int len) { ereport(ERROR, (errmsg("unable to read data from DB node %d", cp->db_node_id), - errdetail("do not failover because fail_over_on_backend_error is off"))); + errdetail("do not failover because failover_on_backend_error is off"))); } } else @@ -728,8 +728,8 @@ pool_flush(POOL_CONNECTION * cp) errdetail("pg_terminate_backend was called on the backend"))); } - /* if fail_over_on_backend_error is true, then trigger failover */ - if (pool_config->fail_over_on_backend_error) + /* if failover_on_backend_error is true, then trigger failover */ + if (pool_config->failover_on_backend_error) { notice_backend_error(cp->db_node_id, REQ_DETAIL_SWITCHOVER); ereport(LOG, @@ -743,7 +743,7 @@ pool_flush(POOL_CONNECTION * cp) { ereport(ERROR, (errmsg("unable to flush data to backend"), - errdetail("do not failover because fail_over_on_backend_error is off"))); + errdetail("do not failover because failover_on_backend_error is off"))); } } else @@ -785,7 +785,7 @@ pool_flush_noerror(POOL_CONNECTION * cp) } /* if fail_over_on_backend_erro is true, then trigger failover */ - if (pool_config->fail_over_on_backend_error) + if (pool_config->failover_on_backend_error) { notice_backend_error(cp->db_node_id, REQ_DETAIL_SWITCHOVER); child_exit(POOL_EXIT_AND_RESTART); @@ -798,7 +798,7 @@ pool_flush_noerror(POOL_CONNECTION * cp) { ereport(LOG, (errmsg("unable to flush data to backend"), - errdetail("do not failover because fail_over_on_backend_error is off"))); + errdetail("do not failover because failover_on_backend_error is off"))); return -1; } } diff --git a/src/watchdog/watchdog.c b/src/watchdog/watchdog.c index 16f940b76..724b44920 100644 --- a/src/watchdog/watchdog.c +++ b/src/watchdog/watchdog.c @@ -6666,7 +6666,7 @@ verify_pool_configurations(WatchdogNode * wdNode, POOL_CONFIG * config) WD_VERIFY_RECEIVED_CONFIG_PARAMETER_VAL_BOOL(config, wdNode, replication_stop_on_mismatch); WD_VERIFY_RECEIVED_CONFIG_PARAMETER_VAL_BOOL(config, wdNode, allow_clear_text_frontend_auth); WD_VERIFY_RECEIVED_CONFIG_PARAMETER_VAL_BOOL(config, wdNode, failover_if_affected_tuples_mismatch); - WD_VERIFY_RECEIVED_CONFIG_PARAMETER_VAL_BOOL(config, wdNode, fail_over_on_backend_error); + WD_VERIFY_RECEIVED_CONFIG_PARAMETER_VAL_BOOL(config, wdNode, failover_on_backend_error); WD_VERIFY_RECEIVED_CONFIG_PARAMETER_VAL_BOOL(config, wdNode, replicate_select); WD_VERIFY_RECEIVED_CONFIG_PARAMETER_VAL_BOOL(config, wdNode, master_slave_mode); WD_VERIFY_RECEIVED_CONFIG_PARAMETER_VAL_BOOL(config, wdNode, connection_cache); diff --git a/src/watchdog/wd_json_data.c b/src/watchdog/wd_json_data.c index f14c52e72..734b12ff1 100644 --- a/src/watchdog/wd_json_data.c +++ b/src/watchdog/wd_json_data.c @@ -88,7 +88,7 @@ get_pool_config_from_json(char *json_data, int data_len) goto ERROR_EXIT; if (json_get_int_value_for_key(root, "health_check_retry_delay", &config->health_check_retry_delay)) goto ERROR_EXIT; - if (json_get_bool_value_for_key(root, "fail_over_on_backend_error", &config->fail_over_on_backend_error)) + if (json_get_bool_value_for_key(root, "failover_on_backend_error", &config->failover_on_backend_error)) goto ERROR_EXIT; if (json_get_int_value_for_key(root, "recovery_timeout", &config->recovery_timeout)) goto ERROR_EXIT; @@ -198,7 +198,7 @@ get_pool_config_json(void) jw_put_int(jNode, "health_check_period", pool_config->health_check_period); jw_put_int(jNode, "health_check_max_retries", pool_config->health_check_max_retries); jw_put_int(jNode, "health_check_retry_delay", pool_config->health_check_retry_delay); - jw_put_bool(jNode, "fail_over_on_backend_error", pool_config->fail_over_on_backend_error); + jw_put_bool(jNode, "failover_on_backend_error", pool_config->failover_on_backend_error); jw_put_int(jNode, "recovery_timeout", pool_config->recovery_timeout); jw_put_int(jNode, "search_primary_node_timeout", pool_config->search_primary_node_timeout); jw_put_int(jNode, "client_idle_limit_in_recovery", pool_config->client_idle_limit_in_recovery); [parent: dabf4ac3beb0]