MXS-1760: Add use_sql_variables_in test case
The test checks that both text protocol and binary protocol statements produce the correct result.
This commit is contained in:
@ -618,6 +618,10 @@ add_test_executable(mxs1743_rconn_bitmask.cpp mxs1743_rconn_bitmask mxs1743_rcon
|
|||||||
# https://jira.mariadb.org/browse/MXS-1751
|
# https://jira.mariadb.org/browse/MXS-1751
|
||||||
add_test_executable(mxs1751_available_when_donor_crash.cpp mxs1751_available_when_donor_crash mxs1751_available_when_donor_crash LABELS GALERA_BACKEND)
|
add_test_executable(mxs1751_available_when_donor_crash.cpp mxs1751_available_when_donor_crash mxs1751_available_when_donor_crash LABELS GALERA_BACKEND)
|
||||||
|
|
||||||
|
# MXS-1760: With use_sql_variables_in=master, unknown PS errors are logged
|
||||||
|
# https://jira.mariadb.org/browse/MXS-1760
|
||||||
|
add_test_executable(mxs1760_use_sql_variables_in.cpp mxs1760_use_sql_variables_in mxs1760_use_sql_variables_in LABELS readwritesplit REPL_BACKEND)
|
||||||
|
|
||||||
# MXS-1773: Failing LOAD DATA LOCAL INFILE confuses readwritesplit
|
# MXS-1773: Failing LOAD DATA LOCAL INFILE confuses readwritesplit
|
||||||
# https://jira.mariadb.org/browse/MXS-1773
|
# https://jira.mariadb.org/browse/MXS-1773
|
||||||
add_test_executable(mxs1773_failing_ldli.cpp mxs1773_failing_ldli replication LABELS readwritesplit REPL_BACKEND)
|
add_test_executable(mxs1773_failing_ldli.cpp mxs1773_failing_ldli replication LABELS readwritesplit REPL_BACKEND)
|
||||||
|
|||||||
@ -0,0 +1,59 @@
|
|||||||
|
[maxscale]
|
||||||
|
threads=###threads###
|
||||||
|
|
||||||
|
[MySQL-Monitor]
|
||||||
|
type=monitor
|
||||||
|
module=mysqlmon
|
||||||
|
###repl51###
|
||||||
|
servers=server1,server2,server3,server4
|
||||||
|
user=maxskysql
|
||||||
|
password=skysql
|
||||||
|
monitor_interval=1000
|
||||||
|
|
||||||
|
[RW-Split-Router]
|
||||||
|
type=service
|
||||||
|
router=readwritesplit
|
||||||
|
servers=server1,server2,server3,server4
|
||||||
|
user=maxskysql
|
||||||
|
password=skysql
|
||||||
|
use_sql_variables_in=master
|
||||||
|
|
||||||
|
[RW-Split-Listener]
|
||||||
|
type=listener
|
||||||
|
service=RW-Split-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
|
||||||
|
|
||||||
|
[server2]
|
||||||
|
type=server
|
||||||
|
address=###node_server_IP_2###
|
||||||
|
port=###node_server_port_2###
|
||||||
|
protocol=MySQLBackend
|
||||||
|
|
||||||
|
[server3]
|
||||||
|
type=server
|
||||||
|
address=###node_server_IP_3###
|
||||||
|
port=###node_server_port_3###
|
||||||
|
protocol=MySQLBackend
|
||||||
|
|
||||||
|
[server4]
|
||||||
|
type=server
|
||||||
|
address=###node_server_IP_4###
|
||||||
|
port=###node_server_port_4###
|
||||||
|
protocol=MySQLBackend
|
||||||
68
maxscale-system-test/mxs1760_use_sql_variables_in.cpp
Normal file
68
maxscale-system-test/mxs1760_use_sql_variables_in.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
* MXS-1760: Adding use_sql_variables_in=master resulted in error "Client requests unknown
|
||||||
|
* prepared statement ID '0' that does not map to an internal ID"
|
||||||
|
*
|
||||||
|
* https://jira.mariadb.org/browse/MXS-1760
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "testconnections.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
const int NUM_STMT = 2000;
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
TestConnections test(argc, argv);
|
||||||
|
std::vector<MYSQL_STMT*> stmts;
|
||||||
|
|
||||||
|
test.maxscales->connect();
|
||||||
|
|
||||||
|
cout << "Setting variable @a to 123" << endl;
|
||||||
|
mysql_query(test.maxscales->conn_rwsplit[0], "SET @a = 123");
|
||||||
|
int rc = execute_query_check_one(test.maxscales->conn_rwsplit[0], "SELECT @a", "123");
|
||||||
|
test.assert(rc == 0, "Text protocol should return 123 as the value of @a");
|
||||||
|
|
||||||
|
cout << "Preparing and executing " << NUM_STMT << " prepared statements" << endl;
|
||||||
|
for (int i = 0; i < NUM_STMT && test.global_result == 0; i++)
|
||||||
|
{
|
||||||
|
stmts.push_back(mysql_stmt_init(test.maxscales->conn_rwsplit[0]));
|
||||||
|
MYSQL_STMT* stmt = stmts.back();
|
||||||
|
const char* query = "SELECT @a";
|
||||||
|
test.add_result(mysql_stmt_prepare(stmt, query, strlen(query)), "Failed to prepare: %s",
|
||||||
|
mysql_stmt_error(stmt));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto stmt: stmts)
|
||||||
|
{
|
||||||
|
char buffer[100] = "";
|
||||||
|
my_bool err = false;
|
||||||
|
my_bool isnull = false;
|
||||||
|
MYSQL_BIND bind[1] = {};
|
||||||
|
|
||||||
|
bind[0].buffer_length = sizeof(buffer);
|
||||||
|
bind[0].buffer = buffer;
|
||||||
|
bind[0].error = &err;
|
||||||
|
bind[0].is_null = &isnull;
|
||||||
|
|
||||||
|
// Execute a write, should return the master's server ID
|
||||||
|
|
||||||
|
test.add_result(mysql_stmt_execute(stmt), "Failed to execute: %s", mysql_stmt_error(stmt));
|
||||||
|
test.add_result(mysql_stmt_bind_result(stmt, bind), "Failed to bind result: %s", mysql_stmt_error(stmt));
|
||||||
|
|
||||||
|
while (mysql_stmt_fetch(stmt) == 0)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
test.add_result(strcmp(buffer, "123"), "Value is '%s', not '123'", buffer);
|
||||||
|
mysql_stmt_close(stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
test.maxscales->disconnect();
|
||||||
|
test.check_log_err(0, "unknown prepared statement", false);
|
||||||
|
|
||||||
|
return test.global_result;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user