MXS-1778: Rename variables and change default values
The causal read timeout now has a default value of 120 seconds. Removed the redundant `enable` part from the names of the member variables.
This commit is contained in:
@ -338,10 +338,10 @@ void RWSplit::diagnostics(DCB *dcb)
|
||||
config().master_accept_reads ? "true" : "false");
|
||||
dcb_printf(dcb, "\tconnection_keepalive: %d\n",
|
||||
config().connection_keepalive);
|
||||
dcb_printf(dcb, "\tenable_causal_read: %s\n",
|
||||
config().enable_causal_read ? "true" : "false");
|
||||
dcb_printf(dcb, "\tcausal_read_timeout: %s\n",
|
||||
config().causal_read_timeout.c_str());
|
||||
dcb_printf(dcb, "\tcausal_reads: %s\n",
|
||||
config().causal_reads ? "true" : "false");
|
||||
dcb_printf(dcb, "\tcausal_reads_timeout: %s\n",
|
||||
config().causal_reads_timeout.c_str());
|
||||
dcb_printf(dcb, "\tmaster_reconnection: %s\n",
|
||||
config().master_reconnection ? "true" : "false");
|
||||
dcb_printf(dcb, "\tdelayed_retry: %s\n",
|
||||
@ -469,8 +469,8 @@ extern "C" MXS_MODULE *MXS_CREATE_MODULE()
|
||||
{"strict_sp_calls", MXS_MODULE_PARAM_BOOL, "false"},
|
||||
{"master_accept_reads", MXS_MODULE_PARAM_BOOL, "false"},
|
||||
{"connection_keepalive", MXS_MODULE_PARAM_COUNT, "0"},
|
||||
{"enable_causal_read", MXS_MODULE_PARAM_BOOL, "false"},
|
||||
{"causal_read_timeout", MXS_MODULE_PARAM_STRING, "0"},
|
||||
{"causal_reads", MXS_MODULE_PARAM_BOOL, "false"},
|
||||
{"causal_reads_timeout", MXS_MODULE_PARAM_STRING, "120"},
|
||||
{"master_reconnection", MXS_MODULE_PARAM_BOOL, "false"},
|
||||
{"delayed_retry", MXS_MODULE_PARAM_BOOL, "false"},
|
||||
{"delayed_retry_timeout", MXS_MODULE_PARAM_COUNT, "10"},
|
||||
|
@ -159,15 +159,15 @@ struct Config
|
||||
max_slave_replication_lag(config_get_integer(params, "max_slave_replication_lag")),
|
||||
rw_max_slave_conn_percent(0),
|
||||
max_slave_connections(0),
|
||||
enable_causal_read(config_get_bool(params, "enable_causal_read")),
|
||||
causal_read_timeout(config_get_string(params, "causal_read_timeout")),
|
||||
causal_reads(config_get_bool(params, "enable_causal_read")),
|
||||
causal_reads_timeout(config_get_string(params, "causal_read_timeout")),
|
||||
master_reconnection(config_get_bool(params, "master_reconnection")),
|
||||
delayed_retry(config_get_bool(params, "delayed_retry")),
|
||||
delayed_retry_timeout(config_get_integer(params, "delayed_retry_timeout")),
|
||||
transaction_replay(config_get_bool(params, "transaction_replay")),
|
||||
trx_max_size(config_get_size(params, "transaction_replay_max_size"))
|
||||
{
|
||||
if (enable_causal_read)
|
||||
if (causal_reads)
|
||||
{
|
||||
retry_failed_reads = true;
|
||||
}
|
||||
@ -190,13 +190,13 @@ struct Config
|
||||
int rw_max_slave_conn_percent; /**< Maximum percentage of slaves to use for
|
||||
* each connection*/
|
||||
int max_slave_connections; /**< Maximum number of slaves for each connection*/
|
||||
bool enable_causal_read; /**< Enable causual read */
|
||||
std::string causal_read_timeout; /**< Timeout, second parameter of function master_wait_gtid */
|
||||
bool causal_reads; /**< Enable causual read */
|
||||
std::string causal_reads_timeout; /**< Timeout, second parameter of function master_wait_gtid */
|
||||
bool master_reconnection; /**< Allow changes in master server */
|
||||
bool delayed_retry; /**< Delay routing if no target found */
|
||||
uint64_t delayed_retry_timeout; /**< How long to delay until an error is returned */
|
||||
bool transaction_replay; /**< Replay failed transactions */
|
||||
size_t trx_max_size; /**< Max transaction size for replaying */
|
||||
size_t trx_max_size; /**< Max transaction size for replaying */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -892,7 +892,7 @@ GWBUF* RWSplitSession::add_prefix_wait_gtid(SERVER *server, GWBUF *origin)
|
||||
GWBUF* rval = origin;
|
||||
const char* wait_func = (server->server_type == SERVER_TYPE_MARIADB) ?
|
||||
MARIADB_WAIT_GTID_FUNC : MYSQL_WAIT_GTID_FUNC;
|
||||
const char *gtid_wait_timeout = m_router->config().causal_read_timeout.c_str();
|
||||
const char *gtid_wait_timeout = m_router->config().causal_reads_timeout.c_str();
|
||||
const char *gtid_position = m_gtid_pos.c_str();
|
||||
|
||||
/* Create a new buffer to store prefix sql */
|
||||
@ -952,7 +952,7 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool
|
||||
uint8_t cmd = mxs_mysql_get_command(querybuf);
|
||||
GWBUF *send_buf = gwbuf_clone(querybuf);
|
||||
|
||||
if (cmd == COM_QUERY && m_router->config().enable_causal_read && !m_gtid_pos .empty())
|
||||
if (cmd == COM_QUERY && m_router->config().causal_reads && !m_gtid_pos .empty())
|
||||
{
|
||||
send_buf = add_prefix_wait_gtid(target->server(), send_buf);
|
||||
m_wait_gtid = WAITING_FOR_HEADER;
|
||||
|
@ -356,7 +356,7 @@ static void log_unexpected_response(DCB* dcb, GWBUF* buffer)
|
||||
|
||||
GWBUF* RWSplitSession::handle_causal_read_reply(GWBUF *writebuf, SRWBackend& backend)
|
||||
{
|
||||
if (m_config.enable_causal_read)
|
||||
if (m_config.causal_reads)
|
||||
{
|
||||
if (GWBUF_IS_REPLY_OK(writebuf) && backend == m_current_master)
|
||||
{
|
||||
@ -474,7 +474,7 @@ void RWSplitSession::clientReply(GWBUF *writebuf, DCB *backend_dcb)
|
||||
ss_dassert(backend->get_reply_state() == REPLY_STATE_DONE);
|
||||
MXS_INFO("Reply complete, last reply from %s", backend->name());
|
||||
|
||||
if (m_config.enable_causal_read)
|
||||
if (m_config.causal_reads)
|
||||
{
|
||||
// The reply should never be complete while we are still waiting for the header.
|
||||
ss_dassert(m_wait_gtid != WAITING_FOR_HEADER);
|
||||
|
Reference in New Issue
Block a user