35 changed files with 530 additions and 112 deletions
-
90client/mysql.cc
-
7cmake/ssl.cmake
-
1include/my_global.h
-
2include/my_sys.h
-
3libmysql/libmysql.c
-
2mysql-test/mysql-test-run.pl
-
117mysql-test/r/binary_to_hex.result
-
29mysql-test/suite/rpl/r/rpl_reset_slave_fail.result
-
91mysql-test/suite/rpl/t/rpl_reset_slave_fail.test
-
76mysql-test/t/binary_to_hex.test
-
11scripts/CMakeLists.txt
-
8scripts/dheadgen.pl
-
4scripts/mysql_config.pl.in
-
5scripts/mysql_convert_table_format.sh
-
5scripts/mysql_find_rows.sh
-
5scripts/mysql_fix_extensions.sh
-
4scripts/mysql_install_db.pl.in
-
7scripts/mysql_secure_installation.pl.in
-
5scripts/mysql_setpermission.sh
-
5scripts/mysql_zap.sh
-
19scripts/mysqlaccess.sh
-
22scripts/mysqld_multi.sh
-
5scripts/mysqldumpslow.sh
-
4scripts/mysqlhotcopy.sh
-
2sql/item.cc
-
2sql/net_serv.cc
-
1sql/records.cc
-
5sql/rpl_mi.cc
-
52sql/rpl_rli.cc
-
12sql/rpl_rli.h
-
6sql/slave.cc
-
2sql/sql_load.cc
-
10sql/sql_parse.cc
-
5sql/sql_repl.cc
-
18sql/sql_union.cc
@ -0,0 +1,117 @@ |
|||
USE test; |
|||
DROP TABLE IF EXISTS t1, t2; |
|||
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; |
|||
Table Create Table |
|||
t1 CREATE TABLE `t1` ( |
|||
`c1` tinyblob, |
|||
`c2` blob, |
|||
`c3` mediumblob, |
|||
`c4` longblob, |
|||
`c5` blob, |
|||
`c6` bit(1) DEFAULT NULL, |
|||
`c7` binary(1) DEFAULT NULL, |
|||
`c8` varbinary(10) DEFAULT NULL, |
|||
`c9` geometry DEFAULT NULL |
|||
) ENGINE=MyISAM DEFAULT CHARSET=binary |
|||
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; |
|||
Table Create Table |
|||
t2 CREATE TABLE `t2` ( |
|||
`id` int(11) DEFAULT NULL, |
|||
`col1` binary(10) DEFAULT NULL, |
|||
`col2` blob |
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|||
INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF'); |
|||
#Print the table contents when binary-as-hex option is off. |
|||
SELECT * FROM t1; |
|||
c1 c2 c3 c4 c5 c6 c7 c8 c9 |
|||
tinyblob-text readable blob-text readable mediumblob-text readable longblob-text readable text readable # c variable # |
|||
SELECT * FROM t2; |
|||
id col1 col2 |
|||
1 # # |
|||
2 # # |
|||
#Print the table contents after turning on the binary-as-hex option |
|||
|
|||
#Print the table contents in tab format |
|||
|
|||
c1 c2 c3 c4 c5 c6 c7 c8 c9 |
|||
0x74696E79626C6F622D74657874207265616461626C65 0x626C6F622D74657874207265616461626C65 0x6D656469756D626C6F622D74657874207265616461626C65 0x6C6F6E67626C6F622D74657874207265616461626C65 0x74657874207265616461626C65 0x01 0x63 0x7661726961626C65 0x000000000101000000000000000000F03F000000000000F03F |
|||
id col1 col2 |
|||
1 0xAB123400000000000000 0x123ABC |
|||
2 0xDE123400000000000000 0x123DEF |
|||
|
|||
#Print the table contents in table format |
|||
|
|||
+------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+ |
|||
| c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 | c9 | |
|||
+------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+ |
|||
| 0x74696E79626C6F622D74657874207265616461626C65 | 0x626C6F622D74657874207265616461626C65 | 0x6D656469756D626C6F622D74657874207265616461626C65 | 0x6C6F6E67626C6F622D74657874207265616461626C65 | 0x74657874207265616461626C65 | 0x01 | 0x63 | 0x7661726961626C65 | 0x000000000101000000000000000000F03F000000000000F03F | |
|||
+------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+ |
|||
+------+------------------------+------------+ |
|||
| id | col1 | col2 | |
|||
+------+------------------------+------------+ |
|||
| 1 | 0xAB123400000000000000 | 0x123ABC | |
|||
+------+------------------------+------------+ |
|||
|
|||
#Print the table contents vertically |
|||
|
|||
*************************** 1. row *************************** |
|||
c1: 0x74696E79626C6F622D74657874207265616461626C65 |
|||
c2: 0x626C6F622D74657874207265616461626C65 |
|||
c3: 0x6D656469756D626C6F622D74657874207265616461626C65 |
|||
c4: 0x6C6F6E67626C6F622D74657874207265616461626C65 |
|||
c5: 0x74657874207265616461626C65 |
|||
c6: 0x01 |
|||
c7: 0x63 |
|||
c8: 0x7661726961626C65 |
|||
c9: 0x000000000101000000000000000000F03F000000000000F03F |
|||
|
|||
#Print the table contents in xml format |
|||
|
|||
<?xml version="1.0"?> |
|||
|
|||
<resultset statement="SELECT * FROM t1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
|||
<row> |
|||
<field name="c1">0x74696E79626C6F622D74657874207265616461626C65</field> |
|||
<field name="c2">0x626C6F622D74657874207265616461626C65</field> |
|||
<field name="c3">0x6D656469756D626C6F622D74657874207265616461626C65</field> |
|||
<field name="c4">0x6C6F6E67626C6F622D74657874207265616461626C65</field> |
|||
<field name="c5">0x74657874207265616461626C65</field> |
|||
<field name="c6">0x01</field> |
|||
<field name="c7">0x63</field> |
|||
<field name="c8">0x7661726961626C65</field> |
|||
<field name="c9">0x000000000101000000000000000000F03F000000000000F03F</field> |
|||
</row> |
|||
</resultset> |
|||
<?xml version="1.0"?> |
|||
|
|||
<resultset statement="SELECT * FROM t2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
|||
<row> |
|||
<field name="id">1</field> |
|||
<field name="col1">0xAB123400000000000000</field> |
|||
<field name="col2">0x123ABC</field> |
|||
</row> |
|||
|
|||
<row> |
|||
<field name="id">2</field> |
|||
<field name="col1">0xDE123400000000000000</field> |
|||
<field name="col2">0x123DEF</field> |
|||
</row> |
|||
</resultset> |
|||
|
|||
#Print the table contents in html format |
|||
|
|||
<TABLE BORDER=1><TR><TH>c1</TH><TH>c2</TH><TH>c3</TH><TH>c4</TH><TH>c5</TH><TH>c6</TH><TH>c7</TH><TH>c8</TH><TH>c9</TH></TR><TR><TD>0x74696E79626C6F622D74657874207265616461626C65</TD><TD>0x626C6F622D74657874207265616461626C65</TD><TD>0x6D656469756D626C6F622D74657874207265616461626C65</TD><TD>0x6C6F6E67626C6F622D74657874207265616461626C65</TD><TD>0x74657874207265616461626C65</TD><TD>0x01</TD><TD>0x63</TD><TD>0x7661726961626C65</TD><TD>0x000000000101000000000000000000F03F000000000000F03F</TD></TR></TABLE><TABLE BORDER=1><TR><TH>id</TH><TH>col1</TH><TH>col2</TH></TR><TR><TD>1</TD><TD>0xAB123400000000000000</TD><TD>0x123ABC</TD></TR><TR><TD>2</TD><TD>0xDE123400000000000000</TD><TD>0x123DEF</TD></TR></TABLE>DROP TABLE t1, t2; |
|||
@ -0,0 +1,29 @@ |
|||
include/master-slave.inc |
|||
[connection master] |
|||
CREATE TABLE t1 (c1 INT); |
|||
INSERT INTO t1 (c1) VALUES (1); |
|||
include/stop_slave_sql.inc |
|||
FLUSH LOGS; |
|||
FLUSH LOGS; |
|||
INSERT INTO t1 (c1) VALUES (2); |
|||
include/sync_slave_io_with_master.inc |
|||
call mtr.add_suppression("File '.*slave-relay-bin."); |
|||
call mtr.add_suppression("Could not open log file"); |
|||
call mtr.add_suppression("Failed to open the relay log"); |
|||
call mtr.add_suppression("Failed to initialize the master info structure"); |
|||
include/rpl_stop_server.inc [server_number=2] |
|||
# Removing file(s) |
|||
include/rpl_start_server.inc [server_number=2] |
|||
START SLAVE; |
|||
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MariaDB error log |
|||
START SLAVE; |
|||
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MariaDB error log |
|||
RESET SLAVE; |
|||
DROP TABLE t1; |
|||
START SLAVE UNTIL MASTER_LOG_FILE= 'MASTER_LOG_FILE', MASTER_LOG_POS= MASTER_LOG_POS;; |
|||
include/wait_for_slave_sql_to_stop.inc |
|||
include/stop_slave_io.inc |
|||
include/start_slave.inc |
|||
include/diff_tables.inc [master:t1, slave:t1] |
|||
DROP TABLE t1; |
|||
include/rpl_end.inc |
|||
@ -0,0 +1,91 @@ |
|||
############################################################################### |
|||
# Bug#24901077: RESET SLAVE ALL DOES NOT ALWAYS RESET SLAVE |
|||
# |
|||
# Problem: |
|||
# ======= |
|||
# If you have a relay log index file that has ended up with |
|||
# some relay log files that do not exists, then RESET SLAVE |
|||
# ALL is not enough to get back to a clean state. |
|||
############################################################################### |
|||
# Remove all slave-relay-bin.0* files (do not remove slave-relay-bin.index) |
|||
# During server restart rli initialization will fail as there are no |
|||
# relay logs. In case of bug RESET SLAVE will not do the required clean up |
|||
# as rli is not inited and subsequent START SLAVE will fail. |
|||
# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found" |
|||
# because it is different on Unix and Windows systems. |
|||
|
|||
--source include/have_binlog_format_mixed.inc |
|||
--source include/master-slave.inc |
|||
|
|||
--connection master |
|||
CREATE TABLE t1 (c1 INT); |
|||
INSERT INTO t1 (c1) VALUES (1); |
|||
--sync_slave_with_master |
|||
|
|||
--connection slave |
|||
--source include/stop_slave_sql.inc |
|||
--let $MYSQLD_SLAVE_DATADIR= `select @@datadir` |
|||
|
|||
--connection master |
|||
# Generate more relay logs on slave. |
|||
FLUSH LOGS; |
|||
FLUSH LOGS; |
|||
INSERT INTO t1 (c1) VALUES (2); |
|||
|
|||
--source include/sync_slave_io_with_master.inc |
|||
call mtr.add_suppression("File '.*slave-relay-bin."); |
|||
call mtr.add_suppression("Could not open log file"); |
|||
call mtr.add_suppression("Failed to open the relay log"); |
|||
call mtr.add_suppression("Failed to initialize the master info structure"); |
|||
|
|||
# Stop slave |
|||
--let $rpl_server_number= 2 |
|||
--source include/rpl_stop_server.inc |
|||
|
|||
# Delete file(s) |
|||
--echo # Removing $remove_pattern file(s) |
|||
--let $remove_pattern= slave-relay-bin.0* |
|||
--remove_files_wildcard $MYSQLD_SLAVE_DATADIR $remove_pattern |
|||
|
|||
# Start slave |
|||
--let $rpl_server_number= 2 |
|||
--source include/rpl_start_server.inc |
|||
|
|||
# Start slave must fail because of the removed file(s). |
|||
--error ER_MASTER_INFO |
|||
START SLAVE; |
|||
|
|||
# Try a second time, it must fail again. |
|||
--error ER_MASTER_INFO |
|||
START SLAVE; |
|||
|
|||
# Retrieve master executed position before reset slave. |
|||
--let $master_exec_file= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1) |
|||
--let $master_exec_pos= query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1) |
|||
|
|||
# Reset slave. |
|||
# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found" |
|||
# because it is different on Unix and Windows systems. |
|||
--disable_warnings |
|||
RESET SLAVE; |
|||
--enable_warnings |
|||
DROP TABLE t1; |
|||
--replace_result $master_exec_file MASTER_LOG_FILE $master_exec_pos MASTER_LOG_POS |
|||
--eval START SLAVE UNTIL MASTER_LOG_FILE= '$master_exec_file', MASTER_LOG_POS= $master_exec_pos; |
|||
--source include/wait_for_slave_sql_to_stop.inc |
|||
--source include/stop_slave_io.inc |
|||
|
|||
# Start slave. |
|||
--source include/start_slave.inc |
|||
|
|||
--connection master |
|||
--sync_slave_with_master |
|||
# Check consistency. |
|||
--let $diff_tables= master:t1, slave:t1 |
|||
--source include/diff_tables.inc |
|||
|
|||
# Cleanup |
|||
--connection master |
|||
DROP TABLE t1; |
|||
--sync_slave_with_master |
|||
--source include/rpl_end.inc |
|||
@ -0,0 +1,76 @@ |
|||
# === 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) |
|||
# |
|||
|
|||
# Save the initial number of concurrent sessions |
|||
--source include/count_sessions.inc |
|||
--source include/not_embedded.inc |
|||
|
|||
USE test; |
|||
--disable_warnings |
|||
DROP TABLE IF EXISTS t1, t2; |
|||
--enable_warnings |
|||
|
|||
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; |
|||
|
|||
# Wait till all disconnects are completed |
|||
--source include/wait_until_count_sessions.inc |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue