!438 支持配置文件同步时间间隔由用户配置

Merge pull request !438 from 薛蒙恩/master
This commit is contained in:
opengauss-bot 2020-11-30 11:17:36 +08:00 committed by Gitee
commit 4f555b77ef
7 changed files with 23 additions and 2 deletions

View File

@ -548,6 +548,7 @@ parallel_setup_cost|real|0,1.79769e+308|NULL|NULL|
force_parallel_mode|enum|off,on,regress|NULL|NULL|
parallel_leader_participation|bool|0,0|NULL|NULL|
catchup2normal_wait_time|int|-1,10000|ms|The maximal allowed duration for waiting from catchup to normal state.|
config_sync_interval|int|0,2147483647|ms|The value is the synchronization interval of the configuration file in milliseconds.|
[gtm]
nodename|string|0,0|NULL|Name of this GTM/GTM-Standby.|
port|int|1,65535|NULL|Listen Port of GTM or GTM standby server.|

View File

@ -4681,6 +4681,22 @@ void set_qunit_case_number_hook(int newval, void* extra)
static void init_configure_names_int()
{
struct config_int local_configure_names_int[] = {
{
{
"config_sync_interval",
PGC_POSTMASTER,
WAL_SETTINGS,
gettext_noop("The synchronization time interval for the config file."),
NULL
},
&g_instance.attr.attr_common.config_sync_interval,
3600000,
0,
INT_MAX,
NULL,
NULL,
NULL
},
{
{
"max_active_global_temporary_table",

View File

@ -316,6 +316,7 @@ hot_standby = on # "on" allows queries during recovery
#wal_receiver_connect_retries = 1 # max retries that receiver connect master
#wal_receiver_buffer_size = 64MB # wal receiver buffer size
#enable_xlog_prune = on # xlog keep for all standbys even through they are not connecting and donnot created replslot.
#config_sync_interval = 3600000 # The parameter is the synchronization interval of the configuration file in milliseconds. The default value is 1 hour = 3600000 milliseconds. 0 indicates that the configuration file is not synchronized.
#------------------------------------------------------------------------------
# QUERY TUNING

View File

@ -1106,7 +1106,7 @@ static void knl_t_walreceiver_init(knl_t_walreceiver_context* walreceiver_cxt)
rc = memset_s(walreceiver_cxt->gucconf_lock_file, MAXPGPATH, 0, MAXPGPATH);
securec_check(rc, "\0", "\0");
walreceiver_cxt->reserve_item = {0};
walreceiver_cxt->check_file_timeout = 60 * 60 * 1000;
walreceiver_cxt->check_file_timeout = g_instance.attr.attr_common.config_sync_interval;
walreceiver_cxt->walRcvCtlBlock = NULL;
walreceiver_cxt->reply_message = (StandbyReplyMessage*)palloc0(sizeof(StandbyReplyMessage));
walreceiver_cxt->feedback_message = (StandbyHSFeedbackMessage*)palloc0(sizeof(StandbyHSFeedbackMessage));

View File

@ -2551,6 +2551,8 @@ static bool ProcessConfigFileMessage(char* buf, Size len)
*/
static void firstSynchStandbyFile(void)
{
if (g_instance.attr.attr_common.config_sync_interval <= 0)
return;
char bufTime[sizeof(ConfigModifyTimeMessage) + 1];
errno_t errorno = EOK;

View File

@ -2906,7 +2906,7 @@ static int WalSndLoop(WalSndSendDataCallback send_data)
}
}
if (sync_config_needed) {
if (sync_config_needed && g_instance.attr.attr_common.config_sync_interval > 0) {
if (t_thrd.walsender_cxt.walsender_shutdown_requested) {
if (!AM_WAL_DB_SENDER && !SendConfigFile(t_thrd.walsender_cxt.gucconf_file))
ereport(LOG, (errmsg("failed to send config to the peer when walsender shutdown.")));

View File

@ -76,6 +76,7 @@ typedef struct knl_instance_attr_common {
bool enable_alarm;
char* Alarm_component;
char* MOTConfigFileName;
int config_sync_interval;
} knl_instance_attr_common;
#endif /* SRC_INCLUDE_KNL_KNL_INSTANCE_ATTR_COMMON_H_ */