mirror of
https://github.com/MariaDB/server.git
synced 2025-08-18 16:31:36 +02:00

Remove one of the major sources of race condiitons in mariadb-test. Normally, mariadb_close() sends COM_QUIT to the server and immediately disconnects. In mariadb-test it means the test can switch to another connection and sends queries to the server before the server even started parsing the COM_QUIT packet and these queries can see the connection as fully active, as it didn't reach dispatch_command yet. This is a major source of instability in tests and many - but not all, still less than a half - tests employ workarounds. The correct one is a pair count_sessions.inc/wait_until_count_sessions.inc. Also very popular was wait_until_disconnected.inc, which was completely useless, because it verifies that the connection is closed, and after disconnect it always is, it didn't verify whether the server processed COM_QUIT. Sadly the placebo was as widely used as the real thing. Let's fix this by making mariadb-test `disconnect` command _to wait_ for the server to confirm. This makes almost all workarounds redundant. In some cases count_sessions.inc/wait_until_count_sessions.inc is still needed, though, as only `disconnect` command is changed: * after external tools, like `exec $MYSQL` * after failed `connect` command * replication, after `STOP SLAVE` * Federated/CONNECT/SPIDER/etc after `DROP TABLE` and also in some XA tests, because an XA transaction is dissociated from the THD very late, after the server has closed the client connection. Collateral cleanups: fix comments, remove some redundant statements: * DROP IF EXISTS if nothing is known to exist * DROP table/view before DROP DATABASE * REVOKE privileges before DROP USER etc
86 lines
2.4 KiB
Text
86 lines
2.4 KiB
Text
# === Purpose ===
|
|
# The purpose of this test case is to make
|
|
# sure that the binary data in tables is printed
|
|
# as hex when the option binary-as-hex is enabled.
|
|
#
|
|
# === Related bugs and/or worklogs ===
|
|
# Bug #25340722 - PRINT BINARY DATA AS HEX IN THE MYSQL
|
|
# CLIENT (CONTRIBUTION)
|
|
#
|
|
|
|
--source include/not_embedded.inc
|
|
|
|
CREATE TABLE t1 (c1 TINYBLOB,
|
|
c2 BLOB,
|
|
c3 MEDIUMBLOB,
|
|
c4 LONGBLOB,
|
|
c5 TEXT,
|
|
c6 BIT(1),
|
|
c7 CHAR,
|
|
c8 VARCHAR(10),
|
|
c9 GEOMETRY) CHARACTER SET = binary;
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable',
|
|
'mediumblob-text readable', 'longblob-text readable',
|
|
'text readable', b'1', 'c', 'variable',
|
|
POINT(1, 1));
|
|
|
|
CREATE TABLE t2(id int, `col1` binary(10),`col2` blob);
|
|
|
|
SHOW CREATE TABLE t2;
|
|
|
|
INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF');
|
|
|
|
--echo #Print the table contents when binary-as-hex option is off.
|
|
--replace_column 6 # 9 #
|
|
SELECT * FROM t1;
|
|
|
|
--replace_column 2 # 3 #
|
|
SELECT * FROM t2;
|
|
|
|
--echo #Print the table contents after turning on the binary-as-hex option
|
|
--echo
|
|
--echo #Print the table contents in tab format
|
|
--echo
|
|
--exec $MYSQL test --binary-as-hex -e "SELECT * FROM t1; SELECT * FROM t2;"
|
|
--echo
|
|
--echo #Print the table contents in table format
|
|
--echo
|
|
--exec $MYSQL test --binary-as-hex --table -e "SELECT * FROM t1; SELECT * FROM t2 WHERE col2=0x123ABC;"
|
|
--echo
|
|
--echo #Print the table contents vertically
|
|
--echo
|
|
--exec $MYSQL test --binary-as-hex --vertical -e "SELECT * FROM t1;"
|
|
--echo
|
|
--echo #Print the table contents in xml format
|
|
--echo
|
|
--exec $MYSQL test --binary-as-hex --xml -e "SELECT * FROM t1; SELECT * FROM t2;"
|
|
--echo
|
|
--echo #Print the table contents in html format
|
|
--echo
|
|
--exec $MYSQL test --binary-as-hex --html -e "SELECT * FROM t1; SELECT * FROM t2;"
|
|
|
|
#Cleanup
|
|
DROP TABLE t1, t2;
|
|
|
|
# MDEV-14593 human-readable XA RECOVER
|
|
|
|
create table t1 (a int);
|
|
|
|
--write_file $MYSQLTEST_VARDIR/tmp/mdev-14593.sql
|
|
DELIMITER /
|
|
XA START 'tr1', 'bq'/
|
|
INSERT INTO t1 VALUES (0)/
|
|
XA END 'tr1', 'bq'/
|
|
XA PREPARE 'tr1', 'bq'/
|
|
XA RECOVER/
|
|
XA ROLLBACK 'tr1', 'bq'/
|
|
EOF
|
|
--exec $MYSQL test --binary-as-hex < $MYSQLTEST_VARDIR/tmp/mdev-14593.sql 2>&1
|
|
remove_file $MYSQLTEST_VARDIR/tmp/mdev-14593.sql;
|
|
|
|
|
|
#Cleanup
|
|
DROP TABLE t1;
|