Merge branch '2.3' into develop
This commit is contained in:
@ -62,12 +62,14 @@ const char* mariadb_102_users_query =
|
||||
" u.is_role, u.default_role"
|
||||
" FROM mysql.user AS u LEFT JOIN mysql.db AS d "
|
||||
" ON (u.user = d.user AND u.host = d.host) "
|
||||
" WHERE u.plugin IN ('', 'mysql_native_password') "
|
||||
" UNION "
|
||||
" SELECT u.user, u.host, t.db, u.select_priv, "
|
||||
" IF(u.password <> '', u.password, u.authentication_string), "
|
||||
" u.is_role, u.default_role "
|
||||
" FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t "
|
||||
" ON (u.user = t.user AND u.host = t.host)"
|
||||
" WHERE u.plugin IN ('', 'mysql_native_password') "
|
||||
"), users AS ("
|
||||
// Select the root row, the actual user
|
||||
" SELECT t.user, t.host, t.db, t.select_priv, t.password, t.default_role AS role FROM t"
|
||||
@ -90,10 +92,12 @@ const char* mariadb_101_users_query
|
||||
" SELECT u.user, u.host, d.db, u.select_priv, u.password AS password, u.is_role "
|
||||
" FROM mysql.user AS u LEFT JOIN mysql.db AS d "
|
||||
" ON (u.user = d.user AND u.host = d.host) "
|
||||
" WHERE u.plugin IN ('', 'mysql_native_password') "
|
||||
" UNION "
|
||||
" SELECT u.user, u.host, t.db, u.select_priv, u.password AS password, u.is_role "
|
||||
" FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t "
|
||||
" ON (u.user = t.user AND u.host = t.host) "
|
||||
" WHERE u.plugin IN ('', 'mysql_native_password') "
|
||||
") AS t "
|
||||
// Discard any users that are roles
|
||||
"WHERE t.is_role <> 'Y' %s "
|
||||
@ -104,10 +108,12 @@ const char* mariadb_101_users_query
|
||||
" SELECT u.user, u.host, d.db, u.select_priv, u.password AS password, u.default_role "
|
||||
" FROM mysql.user AS u LEFT JOIN mysql.db AS d "
|
||||
" ON (u.user = d.user AND u.host = d.host) "
|
||||
" WHERE u.plugin IN ('', 'mysql_native_password') "
|
||||
" UNION "
|
||||
" SELECT u.user, u.host, t.db, u.select_priv, u.password AS password, u.default_role "
|
||||
" FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t "
|
||||
" ON (u.user = t.user AND u.host = t.host) "
|
||||
" WHERE u.plugin IN ('', 'mysql_native_password') "
|
||||
") AS t "
|
||||
// Join it to the roles_mapping table to only have users with roles
|
||||
"JOIN mysql.roles_mapping AS r "
|
||||
@ -118,10 +124,12 @@ const char* mariadb_101_users_query
|
||||
" SELECT u.user, u.host, d.db, u.select_priv, u.password AS password, u.is_role "
|
||||
" FROM mysql.user AS u LEFT JOIN mysql.db AS d "
|
||||
" ON (u.user = d.user AND u.host = d.host) "
|
||||
" WHERE u.plugin IN ('', 'mysql_native_password') "
|
||||
" UNION "
|
||||
" SELECT u.user, u.host, t.db, u.select_priv, u.password AS password, u.is_role "
|
||||
" FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t "
|
||||
" ON (u.user = t.user AND u.host = t.host) "
|
||||
" WHERE u.plugin IN ('', 'mysql_native_password') "
|
||||
") AS u "
|
||||
"ON (u.user = r.role AND u.is_role = 'Y') "
|
||||
// We only care about users that have a default role assigned
|
||||
|
||||
@ -235,7 +235,12 @@ bool RWSplitSession::route_single_stmt(GWBUF* querybuf)
|
||||
|
||||
RWBackend* target = nullptr;
|
||||
|
||||
if (TARGET_IS_ALL(route_target))
|
||||
if (command == MXS_COM_STMT_EXECUTE && stmt_id == 0)
|
||||
{
|
||||
// Unknown prepared statement ID
|
||||
succp = send_unknown_ps_error(extract_binary_ps_id(querybuf));
|
||||
}
|
||||
else if (TARGET_IS_ALL(route_target))
|
||||
{
|
||||
succp = handle_target_is_all(route_target, querybuf, command, qtype);
|
||||
}
|
||||
|
||||
@ -193,6 +193,14 @@ bool RWSplitSession::route_stored_query()
|
||||
auto query = std::move(m_query_queue.front());
|
||||
m_query_queue.pop_front();
|
||||
|
||||
if (!query.get())
|
||||
{
|
||||
MXS_ALERT("MXS-2464: Query in query queue unexpectedly null. Queue has %lu queries left.",
|
||||
m_query_queue.size());
|
||||
mxb_assert(!true);
|
||||
continue;
|
||||
}
|
||||
|
||||
/** Store the query queue locally for the duration of the routeQuery call.
|
||||
* This prevents recursive calls into this function. */
|
||||
decltype(m_query_queue) temp_storage;
|
||||
@ -1267,3 +1275,11 @@ bool RWSplitSession::supports_hint(HINT_TYPE hint_type) const
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool RWSplitSession::send_unknown_ps_error(uint32_t stmt_id)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Unknown prepared statement handler (" << stmt_id << ") given to MaxScale";
|
||||
GWBUF* err = modutil_create_mysql_err_msg(1, 0, ER_UNKNOWN_STMT_HANDLER, "HY000", ss.str().c_str());
|
||||
return m_client->func.write(m_client, err);
|
||||
}
|
||||
|
||||
@ -175,6 +175,9 @@ private:
|
||||
mxs::RWBackend* old_master,
|
||||
mxs::RWBackend* curr_master);
|
||||
|
||||
// Send unknown prepared statement ID error to client
|
||||
bool send_unknown_ps_error(uint32_t stmt_id);
|
||||
|
||||
GWBUF* handle_causal_read_reply(GWBUF* writebuf, mxs::RWBackend* backend);
|
||||
GWBUF* add_prefix_wait_gtid(SERVER* server, GWBUF* origin);
|
||||
void correct_packet_sequence(GWBUF* buffer);
|
||||
|
||||
Reference in New Issue
Block a user