Merge commit '09cb4a885f88d30b5108d215dcdaa5163229a230' into develop

This commit is contained in:
Markus Mäkelä
2019-04-04 14:34:17 +03:00
92 changed files with 1560 additions and 1696 deletions

View File

@ -119,6 +119,7 @@ const char CN_INET[] = "inet";
const char CN_LINKS[] = "links";
const char CN_LISTENERS[] = "listeners";
const char CN_LISTENER[] = "listener";
const char CN_LOAD_PERSISTED_CONFIGS[] = "load_persisted_configs";
const char CN_LOCALHOST_MATCH_WILDCARD_HOST[] = "localhost_match_wildcard_host";
const char CN_LOCAL_ADDRESS[] = "local_address";
const char CN_LOG_AUTH_WARNINGS[] = "log_auth_warnings";
@ -1391,7 +1392,8 @@ static bool config_load_and_process(const char* filename, bool (* process_config
const char* persist_cnf = get_config_persistdir();
mxs_mkdir_all(persist_cnf, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (is_directory(persist_cnf) && contains_cnf_files(persist_cnf))
if (config_get_global_options()->load_persisted_configs
&& is_directory(persist_cnf) && contains_cnf_files(persist_cnf))
{
/**
* Set the global flag that we are processing a persisted configuration.
@ -2729,6 +2731,20 @@ static int handle_global_item(const char* name, const char* value)
return 0;
}
}
else if (strcmp(name, CN_LOAD_PERSISTED_CONFIGS) == 0)
{
int b = config_truth_value(value);
if (b != -1)
{
gateway.load_persisted_configs = b;
}
else
{
MXS_ERROR("Invalid value for '%s': %s", CN_LOAD_PERSISTED_CONFIGS, value);
return 0;
}
}
else
{
bool found = false;
@ -2947,6 +2963,7 @@ void config_set_global_defaults()
gateway.query_retry_timeout = DEFAULT_QUERY_RETRY_TIMEOUT;
gateway.passive = false;
gateway.promoted_at = 0;
gateway.load_persisted_configs = true;
gateway.peer_hosts[0] = '\0';
gateway.peer_user[0] = '\0';

View File

@ -972,7 +972,7 @@ bool RWSplitSession::should_migrate_trx(RWBackend* target)
bool RWSplitSession::start_trx_migration(RWBackend* target, GWBUF* querybuf)
{
MXS_INFO("Starting transaction migration from '%s' to '%s'", m_current_master->name(), target->name());
MXS_INFO("Starting transaction migration to '%s'", target->name());
/**
* Stash the current query so that the transaction replay treats

View File

@ -126,12 +126,11 @@ int32_t RWSplitSession::routeQuery(GWBUF* querybuf)
{
MXS_INFO("New query received while transaction replay is active: %s",
mxs::extract_sql(querybuf).c_str());
mxb_assert(!m_interrupted_query.get());
m_interrupted_query.reset(querybuf);
m_query_queue.emplace_back(querybuf);
return 1;
}
if (can_route_queries())
if ((m_query_queue.empty() || GWBUF_IS_REPLAYED(querybuf)) && can_route_queries())
{
/** Gather the information required to make routing decisions */
if (!m_qc.large_query())
@ -432,6 +431,10 @@ void RWSplitSession::trx_replay_next_stmt()
MXS_INFO("Resuming execution: %s", mxs::extract_sql(m_interrupted_query.get()).c_str());
retry_query(m_interrupted_query.release(), 0);
}
else if (!m_query_queue.empty())
{
route_stored_query();
}
}
else
{

View File

@ -270,10 +270,9 @@ private:
inline bool can_route_queries() const
{
return m_query_queue.empty()
&& (m_expected_responses == 0
|| m_qc.load_data_state() == mxs::QueryClassifier::LOAD_DATA_ACTIVE
|| m_qc.large_query());
return m_expected_responses == 0
|| m_qc.load_data_state() == mxs::QueryClassifier::LOAD_DATA_ACTIVE
|| m_qc.large_query();
}
inline mxs::QueryClassifier::current_target_t get_current_target() const