MXS-2250 Add test that reveals the problem

Before the MXS-2250 fix, the following ends with an error:

    CREATE TEMPORARY TABLE t (f INT);
    DESCRIBE t;

Reason is that the first is sent to the master (and the table will
not be replicated to slaves) and the latter to some slave.
This commit is contained in:
Johan Wikman 2019-06-05 10:39:36 +03:00
parent b8d601aab2
commit f0c4fd5723
3 changed files with 95 additions and 0 deletions

View File

@ -207,6 +207,9 @@ add_test_executable(mxs2167_extra_port.cpp mxs2167_extra_port mxs2167_extra_port
# Test KILL QUERY functionality
add_test_executable(kill_query.cpp kill_query replication LABELS REPL_BACKEND)
# MXS-2250: DESCRIBE on temporary table should work.
add_test_executable(mxs2250_describe_temp_table.cpp mxs2250_describe_temp_table mxs2250_describe_temp_table LABELS REPL_BACKEND)
############################################
# BEGIN: Tests that require GTID #
############################################

View File

@ -0,0 +1,61 @@
[maxscale]
threads=###threads###
log_warning=1
[server1]
type=server
address=###node_server_IP_1###
port=###node_server_port_1###
protocol=mariadbbackend
[server2]
type=server
address=###node_server_IP_2###
port=###node_server_port_2###
protocol=mariadbbackend
[server3]
type=server
address=###node_server_IP_3###
port=###node_server_port_3###
protocol=mariadbbackend
[server4]
type=server
address=###node_server_IP_4###
port=###node_server_port_4###
protocol=mariadbbackend
[Monitor]
type=monitor
module=mariadbmon
servers=server1,server2,server3,server4
user=maxskysql
password=skysql
monitor_interval=1000
[RWS]
type=service
router=readwritesplit
servers=server1,server2,server3,server4
user=maxskysql
password=skysql
slave_selection_criteria=LEAST_ROUTER_CONNECTIONS
[RWS-Listener]
type=listener
service=RWS
protocol=mariadbclient
port=4006
#socket=/tmp/rwsplit.sock
[CLI]
type=service
router=cli
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
#address=localhost
socket=default

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2019 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2022-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#include "mariadb_func.h"
#include "testconnections.h"
int main(int argc, char* argv[])
{
TestConnections test(argc, argv);
Connection rwsplit = test.maxscales->rwsplit();
test.expect(rwsplit.connect(),
"Could not connect to rwsplit.");
test.expect(rwsplit.query("CREATE TEMPORARY TABLE mxs2250 (a int)"),
"Could not create temporary table.");
test.expect(rwsplit.query("DESCRIBE mxs2250"),
"Could not describe temporary table.");
return test.global_result;
}