MXS-2329 Use durations with BLR:[heartbeat|connect_retry]

This commit is contained in:
Johan Wikman
2019-04-29 12:50:33 +03:00
parent b1a495b342
commit 0f5972e010
3 changed files with 28 additions and 13 deletions

View File

@ -173,8 +173,14 @@ it is also possible to use the parameter `passwd`.
#### `heartbeat` #### `heartbeat`
This defines the value of the heartbeat interval in seconds for the connection This defines the value of the heartbeat interval for the connection
to the master. The default value for the heartbeat period is every 5 minutes. to the master. The duration can be specified as documented
[here](../Getting-Started/Configuration-Guide.md#durations). If no explicit
unit is provided, the value is interpreted as seconds in MaxScale 2.4. In
subsequent versions a value without a unit may be rejected. Note that since
the granularity of the parameter is seconds, a value specified in milliseconds
will be rejected, even if the duration is longer than a second.
The default value for the heartbeat period is every 5 minutes.
MariaDB MaxScale requests the master to ensure that a binlog event is sent at MariaDB MaxScale requests the master to ensure that a binlog event is sent at
least every heartbeat period. If there are no real binlog events to send the least every heartbeat period. If there are no real binlog events to send the
@ -390,9 +396,14 @@ disconnected or not reachable.
Default value is 1000. Default value is 1000.
#### `connect_retry` #### `connect_retry`
The option sets the time interval for a new connection retry to master server, The option sets the time interval for a new connection retry to master server.
default value is 60 seconds. The duration can be specified as documented
[here](../Getting-Started/Configuration-Guide.md#durations). If no explicit
unit is provided, the value is interpreted as seconds in MaxScale 2.4. In
subsequent versions a value without a unit may be rejected. Note that since
the granularity of the parameter is seconds, a value specified in milliseconds
will be rejected, even if the duration is longer than a second.
The default value is 60 seconds.
**A complete example** of a service entry for a binlog router service would be as **A complete example** of a service entry for a binlog router service would be as
follows. follows.

View File

@ -211,10 +211,14 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
DEF_LONG_BURST}, DEF_LONG_BURST},
{"burstsize", MXS_MODULE_PARAM_SIZE, {"burstsize", MXS_MODULE_PARAM_SIZE,
DEF_BURST_SIZE}, DEF_BURST_SIZE},
{"heartbeat", MXS_MODULE_PARAM_COUNT, {"heartbeat", MXS_MODULE_PARAM_DURATION,
BLR_HEARTBEAT_DEFAULT_INTERVAL}, BLR_HEARTBEAT_DEFAULT_INTERVAL "s",
{"connect_retry", MXS_MODULE_PARAM_COUNT, MXS_MODULE_OPT_DURATION_S
BLR_MASTER_CONNECT_RETRY}, },
{"connect_retry", MXS_MODULE_PARAM_DURATION,
BLR_MASTER_CONNECT_RETRY "s",
MXS_MODULE_OPT_DURATION_S
},
{"master_retry_count", MXS_MODULE_PARAM_COUNT, {"master_retry_count", MXS_MODULE_PARAM_COUNT,
BLR_MASTER_RETRY_COUNT}, BLR_MASTER_RETRY_COUNT},
{"send_slave_heartbeat", MXS_MODULE_PARAM_BOOL, {"send_slave_heartbeat", MXS_MODULE_PARAM_BOOL,
@ -345,8 +349,8 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
inst->long_burst = params->get_integer("longburst"); inst->long_burst = params->get_integer("longburst");
inst->burst_size = params->get_size("burstsize"); inst->burst_size = params->get_size("burstsize");
inst->binlogdir = params->get_c_str_copy("binlogdir"); inst->binlogdir = params->get_c_str_copy("binlogdir");
inst->heartbeat = params->get_integer("heartbeat"); inst->heartbeat = params->get_duration<std::chrono::seconds>("heartbeat").count();
inst->retry_interval = params->get_integer("connect_retry"); inst->retry_interval = params->get_duration<std::chrono::seconds>("connect_retry").count();
inst->retry_limit = params->get_integer("master_retry_count"); inst->retry_limit = params->get_integer("master_retry_count");
inst->ssl_cert_verification_depth = params->get_integer("ssl_cert_verification_depth"); inst->ssl_cert_verification_depth = params->get_integer("ssl_cert_verification_depth");
inst->mariadb10_compat = params->get_bool("mariadb10-compatibility"); inst->mariadb10_compat = params->get_bool("mariadb10-compatibility");

View File

@ -3383,8 +3383,8 @@ void write_master_config(FILE* config_file, const ChangeMasterConfig& config)
fprintf(config_file, "master_tls_version=%s\n", config.ssl_version.c_str()); fprintf(config_file, "master_tls_version=%s\n", config.ssl_version.c_str());
} }
fprintf(config_file, "master_heartbeat_period=%d\n", config.heartbeat_period); fprintf(config_file, "master_heartbeat_period=%ds\n", config.heartbeat_period);
fprintf(config_file, "master_connect_retry=%d\n", config.connect_retry); fprintf(config_file, "master_connect_retry=%ds\n", config.connect_retry);
} }
} }