Merge branch '2.3' into 2.4
This commit is contained in:
@ -359,7 +359,7 @@ bool RWSplitSession::route_single_stmt(GWBUF* querybuf)
|
||||
succp = true;
|
||||
MXS_INFO("Delaying routing: %s", extract_sql(querybuf).c_str());
|
||||
}
|
||||
else
|
||||
else if (m_config.master_failure_mode != RW_ERROR_ON_WRITE)
|
||||
{
|
||||
MXS_ERROR("Could not find valid server for target type %s, closing "
|
||||
"connection.", route_target_to_string(route_target));
|
||||
|
@ -366,6 +366,7 @@ static void log_unexpected_response(RWBackend* backend, GWBUF* buffer, GWBUF* cu
|
||||
backend->current_command(),
|
||||
sql.c_str());
|
||||
session_dump_statements(backend->dcb()->session);
|
||||
session_dump_log(backend->dcb()->session);
|
||||
mxb_assert(false);
|
||||
}
|
||||
}
|
||||
@ -1005,7 +1006,9 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
|
||||
MXS_INFO("Master '%s' failed: %s", backend->name(), extract_error(errmsgbuf).c_str());
|
||||
/** The connection to the master has failed */
|
||||
|
||||
if (!backend->is_waiting_result())
|
||||
bool expected_response = backend->is_waiting_result();
|
||||
|
||||
if (!expected_response)
|
||||
{
|
||||
/** The failure of a master is not considered a critical
|
||||
* failure as partial functionality still remains. If
|
||||
@ -1041,14 +1044,6 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
|
||||
can_continue = true;
|
||||
send_readonly_error(m_client);
|
||||
}
|
||||
|
||||
// Decrement the expected response count only if we know we can continue the sesssion.
|
||||
// This keeps the internal logic sound even if another query is routed before the session
|
||||
// is closed.
|
||||
if (can_continue)
|
||||
{
|
||||
m_expected_responses--;
|
||||
}
|
||||
}
|
||||
|
||||
if (session_trx_is_active(session) && m_otrx_state == OTRX_INACTIVE)
|
||||
@ -1076,6 +1071,14 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
|
||||
}
|
||||
}
|
||||
|
||||
// Decrement the expected response count only if we know we can continue the sesssion.
|
||||
// This keeps the internal logic sound even if another query is routed before the session
|
||||
// is closed.
|
||||
if (can_continue && expected_response)
|
||||
{
|
||||
m_expected_responses--;
|
||||
}
|
||||
|
||||
backend->close();
|
||||
backend->set_close_reason("Master connection failed: " + extract_error(errmsgbuf));
|
||||
}
|
||||
|
@ -264,9 +264,12 @@ json_t* SchemaRouter::diagnostics_json() const
|
||||
return rval;
|
||||
}
|
||||
|
||||
static const uint64_t CAPABILITIES = RCAP_TYPE_CONTIGUOUS_INPUT | RCAP_TYPE_PACKET_OUTPUT
|
||||
| RCAP_TYPE_RUNTIME_CONFIG;
|
||||
|
||||
uint64_t SchemaRouter::getCapabilities()
|
||||
{
|
||||
return RCAP_TYPE_CONTIGUOUS_INPUT | RCAP_TYPE_RUNTIME_CONFIG;
|
||||
return schemarouter::CAPABILITIES;
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,7 +283,6 @@ uint64_t SchemaRouter::getCapabilities()
|
||||
*/
|
||||
extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static uint64_t caps = RCAP_TYPE_CONTIGUOUS_INPUT | RCAP_TYPE_RUNTIME_CONFIG;
|
||||
static auto desc = "A database sharding router for simple sharding";
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
@ -289,7 +291,7 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_ROUTER_VERSION,
|
||||
desc,
|
||||
"V1.0.0",
|
||||
caps,
|
||||
schemarouter::CAPABILITIES,
|
||||
&schemarouter::SchemaRouter::s_object,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -1192,11 +1192,13 @@ char* get_lenenc_str(void* data)
|
||||
return rval;
|
||||
}
|
||||
|
||||
static const std::set<std::string> always_ignore = {"mysql", "information_schema", "performance_schema"};
|
||||
|
||||
bool SchemaRouterSession::ignore_duplicate_database(const char* data)
|
||||
{
|
||||
bool rval = false;
|
||||
|
||||
if (m_config->ignored_dbs.find(data) != m_config->ignored_dbs.end())
|
||||
if (m_config->ignored_dbs.count(data) || always_ignore.count(data))
|
||||
{
|
||||
rval = true;
|
||||
}
|
||||
@ -1379,8 +1381,7 @@ void SchemaRouterSession::query_databases()
|
||||
"LEFT JOIN information_schema.tables AS t ON s.schema_name = t.table_schema "
|
||||
"WHERE t.table_name IS NULL "
|
||||
"UNION "
|
||||
"SELECT CONCAT (table_schema, '.', table_name) FROM information_schema.tables "
|
||||
"WHERE table_schema NOT IN ('information_schema', 'performance_schema', 'mysql');");
|
||||
"SELECT CONCAT (table_schema, '.', table_name) FROM information_schema.tables");
|
||||
gwbuf_set_type(buffer, GWBUF_TYPE_COLLECT_RESULT);
|
||||
|
||||
for (SSRBackendList::iterator it = m_backends.begin(); it != m_backends.end(); it++)
|
||||
|
Reference in New Issue
Block a user