MXS-1713: Fix resultset collection code

The resultset collection was not detected early enough in the code which
caused partial results to be returned to the router.
This commit is contained in:
Markus Mäkelä 2018-03-10 12:47:53 +02:00
parent ff13fa633e
commit 2023ee4dc7
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
4 changed files with 102 additions and 0 deletions

View File

@ -613,6 +613,10 @@ add_test_executable(mxs1677_temp_table.cpp mxs1677_temp_table replication LABELS
# https://jira.mariadb.org/browse/MXS-1678
add_test_executable(mxs1678_relay_master.cpp mxs1678_relay_master replication LABELS REPL_BACKEND)
# MXS-1713: SchemaRouter unable to process SHOW DATABASES for a lot of schemas
# https://jira.mariadb.org/browse/MXS-1713
add_test_executable(mxs1713_lots_of_databases.cpp mxs1713_lots_of_databases mxs1713_lots_of_databases LABELS REPL_BACKEND)
# 'namedserverfilter' test
add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND)

View File

@ -0,0 +1,39 @@
[maxscale]
threads=###threads###
[MySQL Monitor]
type=monitor
module=mysqlmon
###repl51###
servers=server1
user=maxskysql
passwd=skysql
[Sharding router]
type=service
router=schemarouter
servers=server1
user=maxskysql
passwd=skysql
[Sharding Listener]
type=listener
service=Sharding router
protocol=MySQLClient
port=4006
[CLI]
type=service
router=cli
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
socket=default
[server1]
type=server
address=###node_server_IP_1###
port=###node_server_port_1###
protocol=MySQLBackend

View File

@ -0,0 +1,58 @@
/**
* MXS-1713: SchemaRouter unable to process SHOW DATABASES for a lot of schemas
*
* https://jira.mariadb.org/browse/MXS-1713
*/
#include "testconnections.h"
#include <vector>
#include <set>
#include <numeric>
int main(int argc, char** argv)
{
TestConnections test(argc, argv);
const int n_db = 2000;
std::vector<std::string> db_list;
for (int i = 0; i < n_db; i++)
{
db_list.push_back("db" + std::to_string(i));
}
test.tprintf("Create %lu databases...", db_list.size());
test.repl->connect();
for (auto db : db_list)
{
execute_query(test.repl->nodes[0], "CREATE DATABASE %s", db.c_str());
}
test.tprintf("Done!");
test.tprintf("Opening a connection with each database as the default database...", db_list.size());
std::set<std::string> errors;
for (auto db : db_list)
{
MYSQL* conn = open_conn_db(test.maxscales->port(), test.maxscales->ip(), db,
test.maxscales->user_name, test.maxscales->password);
if (execute_query_silent(conn, "SELECT 1") ||
execute_query_silent(conn, "SHOW DATABASES"))
{
errors.insert(mysql_error(conn));
}
mysql_close(conn);
}
test.tprintf("Done!");
test.assert(errors.empty(), "None of the queries should fail: %s",
std::accumulate(errors.begin(), errors.end(), std::string(),
[](const std::string &a, const std::string &b){return a + b + " ";}));
test.tprintf("Dropping databases...");
for (auto db : db_list)
{
execute_query(test.repl->nodes[0], "DROP DATABASE %s", db.c_str());
}
test.tprintf("Done!");
return test.global_result;
}

View File

@ -752,6 +752,7 @@ gw_read_and_write(DCB *dcb)
if (rcap_type_required(capabilities, RCAP_TYPE_PACKET_OUTPUT) ||
rcap_type_required(capabilities, RCAP_TYPE_CONTIGUOUS_OUTPUT) ||
proto->collect_result ||
proto->ignore_replies != 0)
{
GWBUF *tmp = modutil_get_complete_packets(&read_buffer);