From 0ef30fe73218842abea32153879a54e1bc8c0877 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Wed, 12 Jan 2011 18:35:06 +0000 Subject: [PATCH 01/26] BUG#59444: rpl_row_show_relaylog_events fails on daily-5.5 test runs The test started failing on the same day patch for BUG 49978 was pushed. BUG 49978 changed part of the replication testing infrastructure in mysql-test-run. This caused the test to fail sporadically with result differences on relay log file names. When the test fails the relay-log filenames are shifted by one, eg: -show relaylog events in 'slave-relay-bin.000002' from ; +show relaylog events in 'slave-relay-bin.000003' from ; The problem was caused by a bad cleanup when using the include files: - include/setup_fake_relay_log.inc - include/cleanup_fake_relay_log.inc Which would leave a spurious relay-log file around (not listed in slave-relay-bin.index), causing the server to shift the name of the relay logs by one, even if cleaning up with RESET SLAVE. We fix this by removing the relay-log file when it is not needed anymore, ie at setup time and after recreating the fake relay-log index. Additionally, to make the affected test more resilient, we deployed a call to rpl_reset.inc (which resets both master and slave, including log files) before actually running the test case. Finally, appart from the reported bug, we also fix: (a) an unrelated issue with the failing test itself - in some cases, the test was not setting the log file name to use when it should; (b) one typo. mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc: Added call to rpl_reset.inc. Deployed missing instructions to get the binlog file name before including show_relaylog/binlog_events.inc --- .../rpl_tests/rpl_show_relaylog_events.inc | 42 ++-- mysql-test/include/setup_fake_relay_log.inc | 3 + .../rpl/r/rpl_row_show_relaylog_events.result | 232 +++++++++--------- .../r/rpl_stm_mix_show_relaylog_events.result | 196 +++++++-------- 4 files changed, 243 insertions(+), 230 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc index d32dd485e19..d230b743ae8 100644 --- a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc +++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc @@ -1,3 +1,6 @@ +-- connection master +-- source include/rpl_reset.inc + -- connection master CREATE TABLE t1 (a INT); @@ -8,18 +11,19 @@ INSERT INTO t1 VALUES (4); INSERT INTO t1 VALUES (5); INSERT INTO t1 VALUES (6); --- echo [MASTER] ********* SOW BINLOG EVENTS IN ... ********* +-- echo [MASTER] ********* SHOW BINLOG EVENTS IN ... ********* +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); -- source include/show_binlog_events.inc --- echo [MASTER] ********* SOW BINLOG EVENTS ********* +-- echo [MASTER] ********* SHOW BINLOG EVENTS ********* let $binlog_file= ; -- source include/show_binlog_events.inc --- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +-- echo [MASTER] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* let $binlog_limit= 3; -- source include/show_binlog_events.inc --- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +-- echo [MASTER] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* let $binlog_limit= 1,4; -- source include/show_binlog_events.inc @@ -28,38 +32,39 @@ let $binlog_limit= ; -- sync_slave_with_master --- echo [SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +-- echo [SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); -- source include/show_binlog_events.inc --- echo [SLAVE] ********* SOW BINLOG EVENTS ********* +-- echo [SLAVE] ********* SHOW BINLOG EVENTS ********* let $binlog_file= ; -- source include/show_binlog_events.inc --- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +-- echo [SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* let $binlog_limit= 3; -- source include/show_binlog_events.inc --- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +-- echo [SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* let $binlog_limit= 1,4; -- source include/show_binlog_events.inc # clear show_binlog_event/show_relaylog_events parameters let $binlog_limit= ; --- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* +-- echo [SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); -- source include/show_relaylog_events.inc --- echo [SLAVE] ********* SOW RELAYLOG EVENTS ********* +-- echo [SLAVE] ********* SHOW RELAYLOG EVENTS ********* let $binlog_file= ; -- source include/show_relaylog_events.inc --- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows ********* +-- echo [MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT rows ********* let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); let $binlog_limit= 3; -- source include/show_relaylog_events.inc --- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows ********* +-- echo [MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT offset,rows ********* let $binlog_limit= 1,3; -- source include/show_relaylog_events.inc @@ -74,28 +79,29 @@ DROP TABLE t1; let $binlog_file= ; let $binlog_limit= ; --- echo [MASTER] ********* SOW BINLOG EVENTS IN ... ********* +-- echo [MASTER] ********* SHOW BINLOG EVENTS IN ... ********* let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); -- source include/show_binlog_events.inc --- echo [MASTER] ********* SOW BINLOG EVENTS ********* +-- echo [MASTER] ********* SHOW BINLOG EVENTS ********* let $binlog_file= ; -- source include/show_binlog_events.inc -- sync_slave_with_master --- echo [SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +-- echo [SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); -- source include/show_binlog_events.inc --- echo [SLAVE] ********* SOW BINLOG EVENTS ********* +-- echo [SLAVE] ********* SHOW BINLOG EVENTS ********* let $binlog_file= ; -- source include/show_binlog_events.inc --- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* +-- echo [SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* +let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); -- source include/show_relaylog_events.inc --- echo [SLAVE] ********* SOW RELAYLOG EVENTS ********* +-- echo [SLAVE] ********* SHOW RELAYLOG EVENTS ********* let $binlog_file= ; -- source include/show_relaylog_events.inc diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index da3ce8e6038..4f1d4f6f162 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -74,6 +74,7 @@ let $_fake_relay_index= $_fake_datadir/$_fake_filename.index; let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; RESET SLAVE; +let $_orphan_relay_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); # Create relay log file. --copy_file $fake_relay_log $_fake_relay_log @@ -102,6 +103,8 @@ RESET SLAVE; # Setup replication from existing relay log. eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4; +# remove the orphan log file (became spurious) +-- remove_file $_fake_datadir/$_orphan_relay_file --let $include_filename= setup_fake_relay_log.inc --source include/end_include_file.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result index 71d1ca9a928..3ec148b9e62 100644 --- a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result +++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result @@ -1,5 +1,6 @@ include/master-slave.inc [connection master] +include/rpl_reset.inc CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); @@ -7,7 +8,35 @@ INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (4); INSERT INTO t1 VALUES (5); INSERT INTO t1 VALUES (6); -[MASTER] ********* SOW BINLOG EVENTS IN ... ********* +[MASTER] ********* SHOW BINLOG EVENTS IN ... ********* +show binlog events in 'master-bin.000001' from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +[MASTER] ********* SHOW BINLOG EVENTS ********* show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -35,48 +64,48 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT -[MASTER] ********* SOW BINLOG EVENTS ********* -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -[MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +[MASTER] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* show binlog events from limit 3; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) -[MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +[MASTER] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* show binlog events from limit 1,4; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT -[SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +[SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* +show binlog events in 'slave-bin.000001' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +[SLAVE] ********* SHOW BINLOG EVENTS ********* show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -104,101 +133,73 @@ slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Table_map # # table_id: # (test.t1) slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT -[SLAVE] ********* SOW BINLOG EVENTS ********* -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +[SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* show binlog events from limit 3; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Table_map # # table_id: # (test.t1) -[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +[SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* show binlog events from limit 1,4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Table_map # # table_id: # (test.t1) slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT -[SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* -show relaylog events in 'slave-relay-bin.000002' from ; +[SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* +show relaylog events in 'slave-relay-bin.000003' from ; Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=4 -slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT) -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Table_map # # table_id: # (test.t1) -slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F -slave-relay-bin.000002 # Query # # COMMIT -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Table_map # # table_id: # (test.t1) -slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F -slave-relay-bin.000002 # Query # # COMMIT -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Table_map # # table_id: # (test.t1) -slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F -slave-relay-bin.000002 # Query # # COMMIT -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Table_map # # table_id: # (test.t1) -slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F -slave-relay-bin.000002 # Query # # COMMIT -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Table_map # # table_id: # (test.t1) -slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F -slave-relay-bin.000002 # Query # # COMMIT -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Table_map # # table_id: # (test.t1) -slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F -slave-relay-bin.000002 # Query # # COMMIT -[SLAVE] ********* SOW RELAYLOG EVENTS ********* +slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +[SLAVE] ********* SHOW RELAYLOG EVENTS ********* show relaylog events from ; Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000001 # Rotate # # slave-relay-bin.000002;pos=4 -[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows ********* -show relaylog events in 'slave-relay-bin.000002' from limit 3; +slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4 +[MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT rows ********* +show relaylog events in 'slave-relay-bin.000003' from limit 3; Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=4 -slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT) -[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows ********* -show relaylog events in 'slave-relay-bin.000002' from limit 1,3; +slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +[MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT offset,rows ********* +show relaylog events in 'slave-relay-bin.000003' from limit 1,3; Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT) -slave-relay-bin.000002 # Query # # BEGIN +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-relay-bin.000003 # Query # # BEGIN FLUSH LOGS; FLUSH LOGS; DROP TABLE t1; -[MASTER] ********* SOW BINLOG EVENTS IN ... ********* +[MASTER] ********* SHOW BINLOG EVENTS IN ... ********* show binlog events in 'master-bin.000002' from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ -[MASTER] ********* SOW BINLOG EVENTS ********* +[MASTER] ********* SHOW BINLOG EVENTS ********* show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -227,11 +228,11 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Rotate # # master-bin.000002;pos=4 -[SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +[SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* show binlog events in 'slave-bin.000002' from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ -[SLAVE] ********* SOW BINLOG EVENTS ********* +[SLAVE] ********* SHOW BINLOG EVENTS ********* show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -260,14 +261,15 @@ slave-bin.000001 # Table_map # # table_id: # (test.t1) slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Rotate # # slave-bin.000002;pos=4 -[SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* +[SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* +show relaylog events in 'slave-relay-bin.000006' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4 +slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +[SLAVE] ********* SHOW RELAYLOG EVENTS ********* show relaylog events from ; Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000004 # Rotate # # master-bin.000002;pos=4 -slave-relay-bin.000004 # Rotate # # slave-relay-bin.000005;pos=4 -[SLAVE] ********* SOW RELAYLOG EVENTS ********* -show relaylog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000004 # Rotate # # master-bin.000002;pos=4 -slave-relay-bin.000004 # Rotate # # slave-relay-bin.000005;pos=4 +slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4 +slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4 include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result index 0e34c0dfb19..c18c507aa0a 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result +++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result @@ -1,5 +1,6 @@ include/master-slave.inc [connection master] +include/rpl_reset.inc CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); @@ -7,7 +8,29 @@ INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (4); INSERT INTO t1 VALUES (5); INSERT INTO t1 VALUES (6); -[MASTER] ********* SOW BINLOG EVENTS IN ... ********* +[MASTER] ********* SHOW BINLOG EVENTS IN ... ********* +show binlog events in 'master-bin.000001' from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) +master-bin.000001 # Query # # COMMIT +[MASTER] ********* SHOW BINLOG EVENTS ********* show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -29,42 +52,42 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) master-bin.000001 # Query # # COMMIT -[MASTER] ********* SOW BINLOG EVENTS ********* -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) -master-bin.000001 # Query # # COMMIT -[MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +[MASTER] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* show binlog events from limit 3; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) -[MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +[MASTER] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* show binlog events from limit 1,4; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -[SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +[SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* +show binlog events in 'slave-bin.000001' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) +slave-bin.000001 # Query # # COMMIT +[SLAVE] ********* SHOW BINLOG EVENTS ********* show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -86,89 +109,67 @@ slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) slave-bin.000001 # Query # # COMMIT -[SLAVE] ********* SOW BINLOG EVENTS ********* -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) -slave-bin.000001 # Query # # COMMIT -[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +[SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* show binlog events from limit 3; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) -[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +[SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* show binlog events from limit 1,4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Query # # BEGIN -[SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* -show relaylog events in 'slave-relay-bin.000002' from ; +[SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* +show relaylog events in 'slave-relay-bin.000003' from ; Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=4 -slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT) -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (1) -slave-relay-bin.000002 # Query # # COMMIT -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (2) -slave-relay-bin.000002 # Query # # COMMIT -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (3) -slave-relay-bin.000002 # Query # # COMMIT -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (4) -slave-relay-bin.000002 # Query # # COMMIT -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (5) -slave-relay-bin.000002 # Query # # COMMIT -slave-relay-bin.000002 # Query # # BEGIN -slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (6) -slave-relay-bin.000002 # Query # # COMMIT -[SLAVE] ********* SOW RELAYLOG EVENTS ********* +slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (1) +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (2) +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (3) +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (4) +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (5) +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (6) +slave-relay-bin.000003 # Query # # COMMIT +[SLAVE] ********* SHOW RELAYLOG EVENTS ********* show relaylog events from ; Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000001 # Rotate # # slave-relay-bin.000002;pos=4 -[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows ********* -show relaylog events in 'slave-relay-bin.000002' from limit 3; +slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4 +[MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT rows ********* +show relaylog events in 'slave-relay-bin.000003' from limit 3; Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=4 -slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT) -[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows ********* -show relaylog events in 'slave-relay-bin.000002' from limit 1,3; +slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +[MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT offset,rows ********* +show relaylog events in 'slave-relay-bin.000003' from limit 1,3; Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT) -slave-relay-bin.000002 # Query # # BEGIN +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-relay-bin.000003 # Query # # BEGIN FLUSH LOGS; FLUSH LOGS; DROP TABLE t1; -[MASTER] ********* SOW BINLOG EVENTS IN ... ********* +[MASTER] ********* SHOW BINLOG EVENTS IN ... ********* show binlog events in 'master-bin.000002' from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ -[MASTER] ********* SOW BINLOG EVENTS ********* +[MASTER] ********* SHOW BINLOG EVENTS ********* show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -191,11 +192,11 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) master-bin.000001 # Query # # COMMIT master-bin.000001 # Rotate # # master-bin.000002;pos=4 -[SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +[SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* show binlog events in 'slave-bin.000002' from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ -[SLAVE] ********* SOW BINLOG EVENTS ********* +[SLAVE] ********* SHOW BINLOG EVENTS ********* show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -218,14 +219,15 @@ slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Rotate # # slave-bin.000002;pos=4 -[SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* +[SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* +show relaylog events in 'slave-relay-bin.000006' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4 +slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +[SLAVE] ********* SHOW RELAYLOG EVENTS ********* show relaylog events from ; Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000004 # Rotate # # master-bin.000002;pos=4 -slave-relay-bin.000004 # Rotate # # slave-relay-bin.000005;pos=4 -[SLAVE] ********* SOW RELAYLOG EVENTS ********* -show relaylog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000004 # Rotate # # master-bin.000002;pos=4 -slave-relay-bin.000004 # Rotate # # slave-relay-bin.000005;pos=4 +slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4 +slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4 include/rpl_end.inc From 0ac54682680382e44234eebb6ab0dea6bfbe0334 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 13 Jan 2011 12:21:57 +0000 Subject: [PATCH 02/26] BUG#59444 Refactoring effort on test case rpl_show_relaylog_events requested by reviewers. --- .../rpl_tests/rpl_show_binlog_events.inc | 17 ++ ...l_show_log_events_with_varying_options.inc | 11 ++ .../rpl_tests/rpl_show_relaylog_events.inc | 102 ++-------- .../rpl/r/rpl_row_show_relaylog_events.result | 182 ++++++------------ .../r/rpl_stm_mix_show_relaylog_events.result | 165 ++++++---------- 5 files changed, 158 insertions(+), 319 deletions(-) create mode 100644 mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc create mode 100644 mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc diff --git a/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc new file mode 100644 index 00000000000..4530f8c639a --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc @@ -0,0 +1,17 @@ +# Include file for rpl_show_relaylog_events.inc + +--let $log_type= BINLOG +if ($is_relay_log) { + --let $log_type= RELAYLOG +} +--let $args= +if ($binlog_file != '') { + --let $args= IN +} +if ($binlog_limit) { + --let $args= $args LIMIT $binlog_limit +} +--echo ******** [$CURRENT_CONNECTION] SHOW $log_type EVENTS $args ******** +--source include/show_events.inc + + diff --git a/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc b/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc new file mode 100644 index 00000000000..411f388aaf3 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc @@ -0,0 +1,11 @@ +# Include file for rpl_show_log_events.inc + +--let $binlog_limit= +--source extra/rpl_tests/rpl_show_binlog_events.inc +--let $binlog_limit= 1 +--source extra/rpl_tests/rpl_show_binlog_events.inc +--let $binlog_limit= 1,3 +--source extra/rpl_tests/rpl_show_binlog_events.inc +--let $binlog_limit= +--let $binlog_file= +--source extra/rpl_tests/rpl_show_binlog_events.inc diff --git a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc index d230b743ae8..b94648479c6 100644 --- a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc +++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc @@ -7,103 +7,37 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); -INSERT INTO t1 VALUES (4); -INSERT INTO t1 VALUES (5); -INSERT INTO t1 VALUES (6); --- echo [MASTER] ********* SHOW BINLOG EVENTS IN ... ********* -let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); --- source include/show_binlog_events.inc +--let $is_relay_log= 0 +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc --- echo [MASTER] ********* SHOW BINLOG EVENTS ********* -let $binlog_file= ; --- source include/show_binlog_events.inc +--sync_slave_with_master +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc --- echo [MASTER] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* -let $binlog_limit= 3; --- source include/show_binlog_events.inc - --- echo [MASTER] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* -let $binlog_limit= 1,4; --- source include/show_binlog_events.inc - -# clear show_binlog_event/show_relaylog_events parameters -let $binlog_limit= ; - --- sync_slave_with_master - --- echo [SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* -let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); --- source include/show_binlog_events.inc - --- echo [SLAVE] ********* SHOW BINLOG EVENTS ********* -let $binlog_file= ; --- source include/show_binlog_events.inc - --- echo [SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* -let $binlog_limit= 3; --- source include/show_binlog_events.inc - --- echo [SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* -let $binlog_limit= 1,4; --- source include/show_binlog_events.inc - -# clear show_binlog_event/show_relaylog_events parameters -let $binlog_limit= ; - --- echo [SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* -let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); --- source include/show_relaylog_events.inc - --- echo [SLAVE] ********* SHOW RELAYLOG EVENTS ********* -let $binlog_file= ; --- source include/show_relaylog_events.inc - --- echo [MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT rows ********* -let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); -let $binlog_limit= 3; --- source include/show_relaylog_events.inc - --- echo [MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT offset,rows ********* -let $binlog_limit= 1,3; --- source include/show_relaylog_events.inc +--let $is_relay_log= 1 +--let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc FLUSH LOGS; -let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); -- connection master FLUSH LOGS; DROP TABLE t1; -# clear show_binlog_event/show_relaylog_events parameters -let $binlog_file= ; -let $binlog_limit= ; +--let $is_relay_log= 0 +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc --- echo [MASTER] ********* SHOW BINLOG EVENTS IN ... ********* -let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); --- source include/show_binlog_events.inc +--sync_slave_with_master +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc --- echo [MASTER] ********* SHOW BINLOG EVENTS ********* -let $binlog_file= ; --- source include/show_binlog_events.inc +--let $is_relay_log= 1 +--let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc --- sync_slave_with_master - --- echo [SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* -let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); --- source include/show_binlog_events.inc - --- echo [SLAVE] ********* SHOW BINLOG EVENTS ********* -let $binlog_file= ; --- source include/show_binlog_events.inc - --- echo [SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* -let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); --- source include/show_relaylog_events.inc - --- echo [SLAVE] ********* SHOW RELAYLOG EVENTS ********* -let $binlog_file= ; --- source include/show_relaylog_events.inc # clear show_binlog_event/show_relaylog_events parameters let $binlog_file= ; diff --git a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result index 3ec148b9e62..7c55e44ed59 100644 --- a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result +++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result @@ -5,10 +5,7 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); -INSERT INTO t1 VALUES (4); -INSERT INTO t1 VALUES (5); -INSERT INTO t1 VALUES (6); -[MASTER] ********* SHOW BINLOG EVENTS IN ... ********* +******** [master] SHOW BINLOG EVENTS IN ******** show binlog events in 'master-bin.000001' from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -24,19 +21,17 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT +******** [master] SHOW BINLOG EVENTS IN LIMIT 1 ******** +show binlog events in 'master-bin.000001' from limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +******** [master] SHOW BINLOG EVENTS IN LIMIT 1,3 ******** +show binlog events in 'master-bin.000001' from limit 1,3; +Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -[MASTER] ********* SHOW BINLOG EVENTS ********* +******** [master] SHOW BINLOG EVENTS ******** show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -52,32 +47,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -[MASTER] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* -show binlog events from limit 3; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -[MASTER] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* -show binlog events from limit 1,4; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -[SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* +******** [slave] SHOW BINLOG EVENTS IN ******** show binlog events in 'slave-bin.000001' from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -93,19 +63,17 @@ slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Table_map # # table_id: # (test.t1) slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT +******** [slave] SHOW BINLOG EVENTS IN LIMIT 1 ******** +show binlog events in 'slave-bin.000001' from limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +******** [slave] SHOW BINLOG EVENTS IN LIMIT 1,3 ******** +show binlog events in 'slave-bin.000001' from limit 1,3; +Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Table_map # # table_id: # (test.t1) slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -[SLAVE] ********* SHOW BINLOG EVENTS ********* +******** [slave] SHOW BINLOG EVENTS ******** show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -121,32 +89,7 @@ slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Table_map # # table_id: # (test.t1) slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -[SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* -show binlog events from limit 3; -Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -[SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* -show binlog events from limit 1,4; -Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -[SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* +******** [slave] SHOW RELAYLOG EVENTS IN ******** show relaylog events in 'slave-relay-bin.000003' from ; Log_name Pos Event_type Server_id End_log_pos Info slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 @@ -164,42 +107,35 @@ slave-relay-bin.000003 # Query # # BEGIN slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F slave-relay-bin.000003 # Query # # COMMIT -slave-relay-bin.000003 # Query # # BEGIN -slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) -slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F -slave-relay-bin.000003 # Query # # COMMIT -slave-relay-bin.000003 # Query # # BEGIN -slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) -slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F -slave-relay-bin.000003 # Query # # COMMIT -slave-relay-bin.000003 # Query # # BEGIN -slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) -slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F -slave-relay-bin.000003 # Query # # COMMIT -[SLAVE] ********* SHOW RELAYLOG EVENTS ********* -show relaylog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4 -[MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT rows ********* -show relaylog events in 'slave-relay-bin.000003' from limit 3; +******** [slave] SHOW RELAYLOG EVENTS IN LIMIT 1 ******** +show relaylog events in 'slave-relay-bin.000003' from limit 1; Log_name Pos Event_type Server_id End_log_pos Info slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 -slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) -[MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT offset,rows ********* +******** [slave] SHOW RELAYLOG EVENTS IN LIMIT 1,3 ******** show relaylog events in 'slave-relay-bin.000003' from limit 1,3; Log_name Pos Event_type Server_id End_log_pos Info slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) slave-relay-bin.000003 # Query # # BEGIN +******** [slave] SHOW RELAYLOG EVENTS ******** +show relaylog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4 FLUSH LOGS; FLUSH LOGS; DROP TABLE t1; -[MASTER] ********* SHOW BINLOG EVENTS IN ... ********* +******** [master] SHOW BINLOG EVENTS IN ******** show binlog events in 'master-bin.000002' from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ -[MASTER] ********* SHOW BINLOG EVENTS ********* +******** [master] SHOW BINLOG EVENTS IN LIMIT 1 ******** +show binlog events in 'master-bin.000002' from limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +******** [master] SHOW BINLOG EVENTS IN LIMIT 1,3 ******** +show binlog events in 'master-bin.000002' from limit 1,3; +Log_name Pos Event_type Server_id End_log_pos Info +******** [master] SHOW BINLOG EVENTS ******** show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -215,24 +151,19 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT master-bin.000001 # Rotate # # master-bin.000002;pos=4 -[SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* +******** [slave] SHOW BINLOG EVENTS IN ******** show binlog events in 'slave-bin.000002' from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ -[SLAVE] ********* SHOW BINLOG EVENTS ********* +******** [slave] SHOW BINLOG EVENTS IN LIMIT 1 ******** +show binlog events in 'slave-bin.000002' from limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +******** [slave] SHOW BINLOG EVENTS IN LIMIT 1,3 ******** +show binlog events in 'slave-bin.000002' from limit 1,3; +Log_name Pos Event_type Server_id End_log_pos Info +******** [slave] SHOW BINLOG EVENTS ******** show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -248,26 +179,23 @@ slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Table_map # # table_id: # (test.t1) slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Rotate # # slave-bin.000002;pos=4 -[SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* +******** [slave] SHOW RELAYLOG EVENTS IN ******** show relaylog events in 'slave-relay-bin.000006' from ; Log_name Pos Event_type Server_id End_log_pos Info slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4 slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ -[SLAVE] ********* SHOW RELAYLOG EVENTS ********* +******** [slave] SHOW RELAYLOG EVENTS IN LIMIT 1 ******** +show relaylog events in 'slave-relay-bin.000006' from limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4 +******** [slave] SHOW RELAYLOG EVENTS IN LIMIT 1,3 ******** +show relaylog events in 'slave-relay-bin.000006' from limit 1,3; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +******** [slave] SHOW RELAYLOG EVENTS ******** show relaylog events from ; Log_name Pos Event_type Server_id End_log_pos Info slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4 diff --git a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result index c18c507aa0a..f706fa0fe75 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result +++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result @@ -5,10 +5,7 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); -INSERT INTO t1 VALUES (4); -INSERT INTO t1 VALUES (5); -INSERT INTO t1 VALUES (6); -[MASTER] ********* SHOW BINLOG EVENTS IN ... ********* +******** [master] SHOW BINLOG EVENTS IN ******** show binlog events in 'master-bin.000001' from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -21,16 +18,17 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) master-bin.000001 # Query # # COMMIT +******** [master] SHOW BINLOG EVENTS IN LIMIT 1 ******** +show binlog events in 'master-bin.000001' from limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +******** [master] SHOW BINLOG EVENTS IN LIMIT 1,3 ******** +show binlog events in 'master-bin.000001' from limit 1,3; +Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) -master-bin.000001 # Query # # COMMIT -[MASTER] ********* SHOW BINLOG EVENTS ********* +******** [master] SHOW BINLOG EVENTS ******** show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -43,29 +41,7 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) -master-bin.000001 # Query # # COMMIT -[MASTER] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* -show binlog events from limit 3; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) -[MASTER] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* -show binlog events from limit 1,4; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -[SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* +******** [slave] SHOW BINLOG EVENTS IN ******** show binlog events in 'slave-bin.000001' from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -78,16 +54,17 @@ slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) slave-bin.000001 # Query # # COMMIT +******** [slave] SHOW BINLOG EVENTS IN LIMIT 1 ******** +show binlog events in 'slave-bin.000001' from limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +******** [slave] SHOW BINLOG EVENTS IN LIMIT 1,3 ******** +show binlog events in 'slave-bin.000001' from limit 1,3; +Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) -slave-bin.000001 # Query # # COMMIT -[SLAVE] ********* SHOW BINLOG EVENTS ********* +******** [slave] SHOW BINLOG EVENTS ******** show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -100,29 +77,7 @@ slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) -slave-bin.000001 # Query # # COMMIT -[SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT rows ********* -show binlog events from limit 3; -Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) -[SLAVE] ********* SHOW BINLOG EVENTS ... LIMIT offset,rows ********* -show binlog events from limit 1,4; -Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -[SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* +******** [slave] SHOW RELAYLOG EVENTS IN ******** show relaylog events in 'slave-relay-bin.000003' from ; Log_name Pos Event_type Server_id End_log_pos Info slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 @@ -137,39 +92,35 @@ slave-relay-bin.000003 # Query # # COMMIT slave-relay-bin.000003 # Query # # BEGIN slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (3) slave-relay-bin.000003 # Query # # COMMIT -slave-relay-bin.000003 # Query # # BEGIN -slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (4) -slave-relay-bin.000003 # Query # # COMMIT -slave-relay-bin.000003 # Query # # BEGIN -slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (5) -slave-relay-bin.000003 # Query # # COMMIT -slave-relay-bin.000003 # Query # # BEGIN -slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (6) -slave-relay-bin.000003 # Query # # COMMIT -[SLAVE] ********* SHOW RELAYLOG EVENTS ********* -show relaylog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4 -[MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT rows ********* -show relaylog events in 'slave-relay-bin.000003' from limit 3; +******** [slave] SHOW RELAYLOG EVENTS IN LIMIT 1 ******** +show relaylog events in 'slave-relay-bin.000003' from limit 1; Log_name Pos Event_type Server_id End_log_pos Info slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 -slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) -[MASTER] ********* SHOW RELAYLOG EVENTS ... LIMIT offset,rows ********* +******** [slave] SHOW RELAYLOG EVENTS IN LIMIT 1,3 ******** show relaylog events in 'slave-relay-bin.000003' from limit 1,3; Log_name Pos Event_type Server_id End_log_pos Info slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) slave-relay-bin.000003 # Query # # BEGIN +******** [slave] SHOW RELAYLOG EVENTS ******** +show relaylog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4 FLUSH LOGS; FLUSH LOGS; DROP TABLE t1; -[MASTER] ********* SHOW BINLOG EVENTS IN ... ********* +******** [master] SHOW BINLOG EVENTS IN ******** show binlog events in 'master-bin.000002' from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ -[MASTER] ********* SHOW BINLOG EVENTS ********* +******** [master] SHOW BINLOG EVENTS IN LIMIT 1 ******** +show binlog events in 'master-bin.000002' from limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +******** [master] SHOW BINLOG EVENTS IN LIMIT 1,3 ******** +show binlog events in 'master-bin.000002' from limit 1,3; +Log_name Pos Event_type Server_id End_log_pos Info +******** [master] SHOW BINLOG EVENTS ******** show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -182,21 +133,19 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) -master-bin.000001 # Query # # COMMIT master-bin.000001 # Rotate # # master-bin.000002;pos=4 -[SLAVE] ********* SHOW BINLOG EVENTS IN ... ********* +******** [slave] SHOW BINLOG EVENTS IN ******** show binlog events in 'slave-bin.000002' from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ -[SLAVE] ********* SHOW BINLOG EVENTS ********* +******** [slave] SHOW BINLOG EVENTS IN LIMIT 1 ******** +show binlog events in 'slave-bin.000002' from limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +******** [slave] SHOW BINLOG EVENTS IN LIMIT 1,3 ******** +show binlog events in 'slave-bin.000002' from limit 1,3; +Log_name Pos Event_type Server_id End_log_pos Info +******** [slave] SHOW BINLOG EVENTS ******** show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) @@ -209,23 +158,23 @@ slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) -slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Rotate # # slave-bin.000002;pos=4 -[SLAVE] ********* SHOW RELAYLOG EVENTS IN ... ********* +******** [slave] SHOW RELAYLOG EVENTS IN ******** show relaylog events in 'slave-relay-bin.000006' from ; Log_name Pos Event_type Server_id End_log_pos Info slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4 slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ -[SLAVE] ********* SHOW RELAYLOG EVENTS ********* +******** [slave] SHOW RELAYLOG EVENTS IN LIMIT 1 ******** +show relaylog events in 'slave-relay-bin.000006' from limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4 +******** [slave] SHOW RELAYLOG EVENTS IN LIMIT 1,3 ******** +show relaylog events in 'slave-relay-bin.000006' from limit 1,3; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +******** [slave] SHOW RELAYLOG EVENTS ******** show relaylog events from ; Log_name Pos Event_type Server_id End_log_pos Info slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4 From 4ef8e64284cde01fcd49ef02da4f8df96a179926 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 13 Jan 2011 14:31:37 +0000 Subject: [PATCH 03/26] BUG#59444 Added comments to rpl_show_relaylog_events as requested by reviewer. --- .../rpl_tests/rpl_show_relaylog_events.inc | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc index b94648479c6..a56e08ece42 100644 --- a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc +++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc @@ -8,6 +8,12 @@ INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); +# PART I +# +# SHOWs contents of binary logs on the master and both, binary and +# relay logs, on the slave. +# + --let $is_relay_log= 0 --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) --source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc @@ -20,8 +26,21 @@ INSERT INTO t1 VALUES (3); --let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) --source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc -FLUSH LOGS; +# +# PART II +# +# Although this second part of the test may seem redudant it is +# actually needed to assert that SHOW RELAYLOG EVENTS works properly +# with respect to the ordering of the relay log in relay-log.index. +# +# If no file is specified with "IN" then first relay log file in +# relay-log.index (ie, the oldest one) should be picked and its +# contents displayed. The same happens for SHOW BINLOG EVENTS, so we +# show them both. All in all, this is the reason for re-assert after +# MASTER and SLAVE's FLUSH LOGS operations. +# +FLUSH LOGS; -- connection master FLUSH LOGS; DROP TABLE t1; From 7bf234032a6debc28f24fbbffe7e3cacb7b1803b Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Fri, 14 Jan 2011 10:05:14 +0100 Subject: [PATCH 04/26] Bug #59241 invalid memory read in do_div_mod with doubly assigned variables Fix: copy my_decimal by value, to avoid dangling pointers. mysql-test/r/func_math.result: New test case. mysql-test/t/func_math.test: New test case. sql/item_cmpfunc.cc: No need to call fix_buffer_pointer() anymore. sql/item_func.cc: Copy my_decimal by value, to avoid dangling pointers. sql/my_decimal.h: Implement proper copy constructor and assignment operator for my_decimal. sql/sql_analyse.cc: No need to call fix_buffer_pointer() anymore. strings/decimal.c: Remove #line directive: it messes up TAGS and it confuses gdb when debugging. --- mysql-test/r/func_math.result | 9 +++++++++ mysql-test/t/func_math.test | 6 ++++++ sql/item_cmpfunc.cc | 3 +-- sql/item_func.cc | 16 +++++++--------- sql/my_decimal.h | 21 +++++++++++++++++++-- sql/sql_analyse.cc | 7 +------ strings/decimal.c | 4 +--- 7 files changed, 44 insertions(+), 22 deletions(-) diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 31648aae7b0..db4f6ddcf20 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -641,3 +641,12 @@ INSERT INTO t1 (SELECT -pi()); Warnings: Warning 1265 Data truncated for column 'a' at row 1 DROP TABLE t1; +# +# Bug #59241 invalid memory read +# in do_div_mod with doubly assigned variables +# +SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa'))); +((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa'))) +NULL +Warnings: +Warning 1366 Incorrect decimal value: '' for column '' at row -1 diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index b089d10a33b..fe253617a27 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -489,3 +489,9 @@ as foo; CREATE TABLE t1(a char(0)); INSERT INTO t1 (SELECT -pi()); DROP TABLE t1; + +--echo # +--echo # Bug #59241 invalid memory read +--echo # in do_div_mod with doubly assigned variables +--echo # +SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa'))); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index ac13ca8a8c5..5e9c0fc78b8 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2086,7 +2086,6 @@ void Item_func_interval::fix_length_and_dec() if (dec != &range->dec) { range->dec= *dec; - range->dec.fix_buffer_pointer(); } } else diff --git a/sql/item_func.cc b/sql/item_func.cc index d959e59337d..47007d8a71c 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1581,24 +1581,22 @@ longlong Item_func_int_div::val_int() if (args[0]->result_type() != INT_RESULT || args[1]->result_type() != INT_RESULT) { - my_decimal value0, value1, tmp; - my_decimal *val0, *val1; - longlong res; - int err; - - val0= args[0]->val_decimal(&value0); - val1= args[1]->val_decimal(&value1); + my_decimal tmp; + my_decimal val0= *args[0]->val_decimal(&tmp); + my_decimal val1= *args[1]->val_decimal(&tmp); if ((null_value= (args[0]->null_value || args[1]->null_value))) return 0; + int err; if ((err= my_decimal_div(E_DEC_FATAL_ERROR & ~E_DEC_DIV_ZERO, &tmp, - val0, val1, 0)) > 3) + &val0, &val1, 0)) > 3) { if (err == E_DEC_DIV_ZERO) signal_divide_by_null(); return 0; } + longlong res; if (my_decimal2int(E_DEC_FATAL_ERROR, &tmp, unsigned_flag, &res) & E_DEC_OVERFLOW) raise_integer_overflow(); diff --git a/sql/my_decimal.h b/sql/my_decimal.h index e5b1573608a..e2f5c95dac2 100644 --- a/sql/my_decimal.h +++ b/sql/my_decimal.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2006 MySQL AB +/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -102,6 +102,24 @@ class my_decimal :public decimal_t public: + my_decimal(const my_decimal &rhs) : decimal_t(rhs) + { + for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++) + buffer[i]= rhs.buffer[i]; + fix_buffer_pointer(); + } + + my_decimal& operator=(const my_decimal &rhs) + { + if (this == &rhs) + return *this; + decimal_t::operator=(rhs); + for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++) + buffer[i]= rhs.buffer[i]; + fix_buffer_pointer(); + return *this; + } + void init() { len= DECIMAL_BUFF_LENGTH; @@ -248,7 +266,6 @@ inline void my_decimal2decimal(const my_decimal *from, my_decimal *to) { *to= *from; - to->fix_buffer_pointer(); } diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 4b6756188dd..e3c0ed28052 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -521,9 +521,6 @@ void field_decimal::add() { found = 1; min_arg = max_arg = sum[0] = *dec; - min_arg.fix_buffer_pointer(); - max_arg.fix_buffer_pointer(); - sum[0].fix_buffer_pointer(); my_decimal_mul(E_DEC_FATAL_ERROR, sum_sqr, dec, dec); cur_sum= 0; min_length = max_length = length; @@ -545,12 +542,10 @@ void field_decimal::add() if (my_decimal_cmp(dec, &min_arg) < 0) { min_arg= *dec; - min_arg.fix_buffer_pointer(); } if (my_decimal_cmp(dec, &max_arg) > 0) { max_arg= *dec; - max_arg.fix_buffer_pointer(); } } } diff --git a/strings/decimal.c b/strings/decimal.c index 7625ed80ec3..e081c063033 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,8 +13,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#line 18 "decimal.c" - /* ======================================================================= NOTE: this library implements SQL standard "exact numeric" type From f77dd0902141d068ecb6e0cf025febc23d532e20 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 14 Jan 2011 11:52:55 +0200 Subject: [PATCH 05/26] bumped up the version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f85cac84d7e..17335ff3fc5 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=9 +MYSQL_VERSION_PATCH=10 MYSQL_VERSION_EXTRA= From c1b186f945ee4bb7151d72f2be9665f886a9f847 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 14 Jan 2011 14:59:23 +0200 Subject: [PATCH 06/26] Bug #55509 : main.lowercase_table2 fails on Mac OSX (again) The test passes on MacOSX. removing it from the experimental list. --- mysql-test/collections/default.experimental | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 22378ebe174..298205e1b7d 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -12,7 +12,6 @@ main.gis # Bug#52208 2010-11-24 alik gis fails o main.gis-rtree @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server main.information_schema # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically -main.lowercase_table2 @darwin # Bug#55509 2010-07-26 alik main.lowercase_table2 fails on Mac OSX (again) main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible) main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun From 745a9f92ec7feb22071d5c867b020fb0fcd0251e Mon Sep 17 00:00:00 2001 From: Guilhem Bichot Date: Fri, 14 Jan 2011 14:21:46 +0100 Subject: [PATCH 07/26] Fix for BUG#59432 "--autocommit=on does not work (@@global.autocommit is 0)" mysql-test/r/mysqld--help-notwin.result: consequence of introducing opt_autocommit and its default mysql-test/suite/sys_vars/r/autocommit_func4.result: Before this fix, this test would have shown @@global.autocommit == 0 in spite of --autocommit=on. mysql-test/suite/sys_vars/r/autocommit_func5.result: result unchanged by the fix sql/mysqld.cc: atoi(argument) was reliable for =0|1 parameters. Now that boolean options must support =on/off/true/false, atoi(argument) is wrong (being always 0 for those strings). Instead, let the internal logic of my_getopt (in particular get_bool_argument()) set a boolean opt_autocommit properly, and use that to set global_system_variables.option_bits. --- mysql-test/r/mysqld--help-notwin.result | 2 + mysql-test/r/mysqld--help-win.result | 2 + .../suite/sys_vars/r/autocommit_func4.result | 46 +++++++++++++++++++ .../suite/sys_vars/r/autocommit_func5.result | 42 +++++++++++++++++ .../sys_vars/t/autocommit_func4-master.opt | 1 + .../suite/sys_vars/t/autocommit_func4.test | 1 + .../sys_vars/t/autocommit_func5-master.opt | 1 + .../suite/sys_vars/t/autocommit_func5.test | 1 + sql/mysqld.cc | 23 ++++------ sql/mysqld.h | 3 +- 10 files changed, 107 insertions(+), 15 deletions(-) create mode 100644 mysql-test/suite/sys_vars/r/autocommit_func4.result create mode 100644 mysql-test/suite/sys_vars/r/autocommit_func5.result create mode 100644 mysql-test/suite/sys_vars/t/autocommit_func4-master.opt create mode 100644 mysql-test/suite/sys_vars/t/autocommit_func4.test create mode 100644 mysql-test/suite/sys_vars/t/autocommit_func5-master.opt create mode 100644 mysql-test/suite/sys_vars/t/autocommit_func5.test diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result index 60ba06c8f7e..6659a291e0b 100644 --- a/mysql-test/r/mysqld--help-notwin.result +++ b/mysql-test/r/mysqld--help-notwin.result @@ -20,6 +20,7 @@ The following options may be given as the first argument: Offset added to Auto-increment columns. Used when auto-increment-increment != 1 --autocommit Set default value for autocommit (0 or 1) + (Defaults to on; use --skip-autocommit to disable.) --automatic-sp-privileges Creating and dropping stored procedures alters ACLs (Defaults to on; use --skip-automatic-sp-privileges to disable.) @@ -732,6 +733,7 @@ abort-slave-event-count 0 allow-suspicious-udfs FALSE auto-increment-increment 1 auto-increment-offset 1 +autocommit TRUE automatic-sp-privileges TRUE back-log 50 big-tables FALSE diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result index dfb53937245..240c29294e2 100644 --- a/mysql-test/r/mysqld--help-win.result +++ b/mysql-test/r/mysqld--help-win.result @@ -20,6 +20,7 @@ The following options may be given as the first argument: Offset added to Auto-increment columns. Used when auto-increment-increment != 1 --autocommit Set default value for autocommit (0 or 1) + (Defaults to on; use --skip-autocommit to disable.) --automatic-sp-privileges Creating and dropping stored procedures alters ACLs (Defaults to on; use --skip-automatic-sp-privileges to disable.) @@ -736,6 +737,7 @@ abort-slave-event-count 0 allow-suspicious-udfs FALSE auto-increment-increment 1 auto-increment-offset 1 +autocommit TRUE automatic-sp-privileges TRUE back-log 50 big-tables FALSE diff --git a/mysql-test/suite/sys_vars/r/autocommit_func4.result b/mysql-test/suite/sys_vars/r/autocommit_func4.result new file mode 100644 index 00000000000..5fcb50526f2 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/autocommit_func4.result @@ -0,0 +1,46 @@ +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name varchar(30) +) ENGINE = INNODB; +SELECT @@global.autocommit; +@@global.autocommit +1 +SELECT @@autocommit; +@@autocommit +1 +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; +id name +1 Record_1 +2 Record_2 +ROLLBACK; +SELECT * from t1; +id name +1 Record_1 +2 Record_2 +set @@global.autocommit = 1-@@global.autocommit; +set @@autocommit = 1-@@autocommit; +SELECT @@global.autocommit; +@@global.autocommit +0 +SELECT @@autocommit; +@@autocommit +0 +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; +id name +1 Record_1 +2 Record_2 +3 Record_1 +4 Record_2 +ROLLBACK; +SELECT * from t1; +id name +1 Record_1 +2 Record_2 +DROP TABLE t1; +set @@global.autocommit = 1-@@global.autocommit; diff --git a/mysql-test/suite/sys_vars/r/autocommit_func5.result b/mysql-test/suite/sys_vars/r/autocommit_func5.result new file mode 100644 index 00000000000..6807c594cb1 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/autocommit_func5.result @@ -0,0 +1,42 @@ +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name varchar(30) +) ENGINE = INNODB; +SELECT @@global.autocommit; +@@global.autocommit +0 +SELECT @@autocommit; +@@autocommit +0 +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; +id name +1 Record_1 +2 Record_2 +ROLLBACK; +SELECT * from t1; +id name +set @@global.autocommit = 1-@@global.autocommit; +set @@autocommit = 1-@@autocommit; +SELECT @@global.autocommit; +@@global.autocommit +1 +SELECT @@autocommit; +@@autocommit +1 +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; +id name +3 Record_1 +4 Record_2 +ROLLBACK; +SELECT * from t1; +id name +3 Record_1 +4 Record_2 +DROP TABLE t1; +set @@global.autocommit = 1-@@global.autocommit; diff --git a/mysql-test/suite/sys_vars/t/autocommit_func4-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func4-master.opt new file mode 100644 index 00000000000..788990274dd --- /dev/null +++ b/mysql-test/suite/sys_vars/t/autocommit_func4-master.opt @@ -0,0 +1 @@ +--autocommit=on diff --git a/mysql-test/suite/sys_vars/t/autocommit_func4.test b/mysql-test/suite/sys_vars/t/autocommit_func4.test new file mode 100644 index 00000000000..9bb4c26d5d5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/autocommit_func4.test @@ -0,0 +1 @@ +--source suite/sys_vars/inc/autocommit_func2.inc diff --git a/mysql-test/suite/sys_vars/t/autocommit_func5-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func5-master.opt new file mode 100644 index 00000000000..409cb3ec891 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/autocommit_func5-master.opt @@ -0,0 +1 @@ +--autocommit=off diff --git a/mysql-test/suite/sys_vars/t/autocommit_func5.test b/mysql-test/suite/sys_vars/t/autocommit_func5.test new file mode 100644 index 00000000000..9bb4c26d5d5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/autocommit_func5.test @@ -0,0 +1 @@ +--source suite/sys_vars/inc/autocommit_func2.inc diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c3afa1a5399..d670a076ecd 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -283,6 +283,7 @@ const char *first_keyword= "first", *binary_keyword= "BINARY"; const char *my_localhost= "localhost", *delayed_user= "DELAYED"; bool opt_large_files= sizeof(my_off_t) > 4; +static my_bool opt_autocommit; ///< for --autocommit command-line option /* Used with --help for detailed option @@ -5655,8 +5656,9 @@ struct my_option my_long_options[]= Because Sys_var_bit does not support command-line options, we need to explicitely add one for --autocommit */ - {"autocommit", OPT_AUTOCOMMIT, "Set default value for autocommit (0 or 1)", - NULL, NULL, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, NULL}, + {"autocommit", 0, "Set default value for autocommit (0 or 1)", + &opt_autocommit, &opt_autocommit, 0, + GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, NULL}, {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.", &my_bind_addr_str, &my_bind_addr_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -7111,13 +7113,6 @@ mysqld_get_one_option(int optid, if (argument == NULL) /* no argument */ log_error_file_ptr= const_cast(""); break; - case OPT_AUTOCOMMIT: - const ulonglong turn_bit_on= (argument && (atoi(argument) == 0)) ? - OPTION_NOT_AUTOCOMMIT : OPTION_AUTOCOMMIT; - global_system_variables.option_bits= - (global_system_variables.option_bits & - ~(OPTION_NOT_AUTOCOMMIT | OPTION_AUTOCOMMIT)) | turn_bit_on; - break; } return 0; } @@ -7268,10 +7263,12 @@ static int get_options(int *argc_ptr, char ***argv_ptr) else global_system_variables.option_bits&= ~OPTION_BIG_SELECTS; - if (global_system_variables.option_bits & OPTION_AUTOCOMMIT) - global_system_variables.option_bits&= ~OPTION_NOT_AUTOCOMMIT; - else - global_system_variables.option_bits|= OPTION_NOT_AUTOCOMMIT; + // Synchronize @@global.autocommit on --autocommit + const ulonglong turn_bit_on= opt_autocommit ? + OPTION_AUTOCOMMIT : OPTION_NOT_AUTOCOMMIT; + global_system_variables.option_bits= + (global_system_variables.option_bits & + ~(OPTION_NOT_AUTOCOMMIT | OPTION_AUTOCOMMIT)) | turn_bit_on; global_system_variables.sql_mode= expand_sql_mode(global_system_variables.sql_mode); diff --git a/sql/mysqld.h b/sql/mysqld.h index 9218503d477..2099e57e96d 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -394,8 +394,7 @@ enum options_mysqld OPT_UPDATE_LOG, OPT_WANT_CORE, OPT_ENGINE_CONDITION_PUSHDOWN, - OPT_LOG_ERROR, - OPT_AUTOCOMMIT + OPT_LOG_ERROR }; From 175e89260e8dfb00e7bc8c293253724407e293e1 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Fri, 14 Jan 2011 15:03:37 +0100 Subject: [PATCH 08/26] Bug #59498 div function broken in mysql-trunk mysql-test/r/func_math.result: New test case. mysql-test/t/func_math.test: New test case. sql/item_func.cc: Check for null before converting value to my_decimal. --- mysql-test/r/func_math.result | 6 ++++++ mysql-test/t/func_math.test | 5 +++++ sql/item_func.cc | 11 ++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index db4f6ddcf20..3149a2a3344 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -650,3 +650,9 @@ SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa'))); NULL Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +# +# Bug #59498 div function broken in mysql-trunk +# +SELECT 1 div null; +1 div null +NULL diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index fe253617a27..e56b9c7d20d 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -495,3 +495,8 @@ DROP TABLE t1; --echo # in do_div_mod with doubly assigned variables --echo # SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa'))); + +--echo # +--echo # Bug #59498 div function broken in mysql-trunk +--echo # +SELECT 1 div null; diff --git a/sql/item_func.cc b/sql/item_func.cc index 47007d8a71c..1bb253fb649 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1582,10 +1582,15 @@ longlong Item_func_int_div::val_int() args[1]->result_type() != INT_RESULT) { my_decimal tmp; - my_decimal val0= *args[0]->val_decimal(&tmp); - my_decimal val1= *args[1]->val_decimal(&tmp); - if ((null_value= (args[0]->null_value || args[1]->null_value))) + my_decimal *val0p= args[0]->val_decimal(&tmp); + if ((null_value= args[0]->null_value)) return 0; + my_decimal val0= *val0p; + + my_decimal *val1p= args[1]->val_decimal(&tmp); + if ((null_value= args[1]->null_value)) + return 0; + my_decimal val1= *val1p; int err; if ((err= my_decimal_div(E_DEC_FATAL_ERROR & ~E_DEC_DIV_ZERO, &tmp, From 5bf45c676f3365fa1b28a8014a8550ead982bfa2 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Sat, 15 Jan 2011 02:18:22 +0400 Subject: [PATCH 09/26] Bug#46393 If for slow_query_log a string is entered it does not complain. For all the boolean system variables we now issue warnings if the value wasn't recognized. Before that we just silently set them to FALSE in this case. per-file comments: mysys/my_getopt.c Bug #46393 If for slow_query_log a string is entered it does not complain. warning issued if no documented value was specified. --- mysys/my_getopt.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 51c45ff1309..efa7e0bb1b3 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -611,13 +611,21 @@ static char *check_struct_option(char *cur_arg, char *key_name) @param[in] argument The value argument @return boolean value */ -static my_bool get_bool_argument(const char *argument) +static my_bool get_bool_argument(const struct my_option *opts, + const char *argument) { if (!my_strcasecmp(&my_charset_latin1, argument, "true") || - !my_strcasecmp(&my_charset_latin1, argument, "on")) + !my_strcasecmp(&my_charset_latin1, argument, "on") || + !my_strcasecmp(&my_charset_latin1, argument, "1")) return 1; - else - return (my_bool) atoi(argument); + else if (!my_strcasecmp(&my_charset_latin1, argument, "false") || + !my_strcasecmp(&my_charset_latin1, argument, "off") || + !my_strcasecmp(&my_charset_latin1, argument, "0")) + return 0; + my_getopt_error_reporter(WARNING_LEVEL, + "option '%s': boolean value '%s' wasn't recognized. Set to OFF.", + opts->name, argument); + return 0; } /* @@ -647,7 +655,7 @@ static int setval(const struct my_option *opts, void *value, char *argument, switch ((opts->var_type & GET_TYPE_MASK)) { case GET_BOOL: /* If argument differs from 0, enable option, else disable */ - *((my_bool*) value)= get_bool_argument(argument); + *((my_bool*) value)= get_bool_argument(opts, argument); break; case GET_INT: *((int*) value)= (int) getopt_ll(argument, opts, &err); From 6d45683b38e989dfcf76fabc5d81bf185bff1694 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Sun, 16 Jan 2011 09:29:05 +0530 Subject: [PATCH 10/26] Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Postfix covering other mysql standard clients like mysql_upgrade, mysqlbinlog, mysqlcheck, mysqlimport, mysqlshow and mysqlslap. client/client_priv.h: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Added an entry for 'default-auth' option. client/mysql.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysql_upgrade.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqladmin.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlbinlog.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlcheck.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqldump.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlimport.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlshow.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlslap.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. mysql-test/r/plugin_auth.result: Added test case for Bug#58139 for mysql_upgrade. mysql-test/t/plugin_auth.test: Added test case for Bug#58139 for mysql_upgrade. --- client/client_priv.h | 1 + client/mysql.cc | 4 ++-- client/mysql_upgrade.c | 11 +++++++++++ client/mysqladmin.cc | 4 ++-- client/mysqlbinlog.cc | 15 +++++++++++++++ client/mysqlcheck.c | 15 +++++++++++++++ client/mysqldump.c | 4 ++-- client/mysqlimport.c | 15 +++++++++++++++ client/mysqlshow.c | 14 ++++++++++++++ client/mysqlslap.c | 14 ++++++++++++++ mysql-test/r/plugin_auth.result | 4 +++- mysql-test/t/plugin_auth.test | 5 ++++- 12 files changed, 98 insertions(+), 8 deletions(-) diff --git a/client/client_priv.h b/client/client_priv.h index 1a81768adc4..cc589e55d52 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -85,6 +85,7 @@ enum options_client OPT_WRITE_BINLOG, OPT_DUMP_DATE, OPT_INIT_COMMAND, OPT_PLUGIN_DIR, + OPT_DEFAULT_AUTH, OPT_DEFAULT_PLUGIN, OPT_MAX_CLIENT_OPTION }; diff --git a/client/mysql.cc b/client/mysql.cc index 241cca49a5d..8fea1b054f3 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -162,7 +162,7 @@ static int wait_time = 5; static STATUS status; static ulong select_limit,max_join_size,opt_connect_timeout=0; static char mysql_charsets_dir[FN_REFLEN+1]; -static char *opt_plugin_dir= 0, *opt_default_auth; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; static const char *xmlmeta[] = { "&", "&", "<", "<", @@ -1564,7 +1564,7 @@ static struct my_option my_long_options[] = {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_PLUGIN_DIR, + {"default_auth", OPT_DEFAULT_AUTH, "Default authentication client-side plugin to use.", (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 4fbf08102bd..b364acd5e61 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -45,6 +45,8 @@ static DYNAMIC_STRING ds_args; static DYNAMIC_STRING conn_args; static char *opt_password= 0; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; + static my_bool tty_password= 0; static char opt_tmpdir[FN_REFLEN] = ""; @@ -88,6 +90,10 @@ static struct my_option my_long_options[]= {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade " "has already been executed for the current version of MySQL.", &opt_force, &opt_force, 0, @@ -102,6 +108,9 @@ static struct my_option my_long_options[]= {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 @@ -283,6 +292,8 @@ get_one_option(int optid, const struct my_option *opt, case 'S': /* --socket */ case OPT_MYSQL_PROTOCOL: /* --protocol */ case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */ + case OPT_PLUGIN_DIR: /* --plugin-dir */ + case OPT_DEFAULT_AUTH: /* --default-auth */ add_one_option(&conn_args, opt, argument); break; } diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index db362f14b6f..580caa38c0d 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -42,7 +42,7 @@ static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations; static uint opt_count_iterations= 0, my_end_arg; static ulong opt_connect_timeout, opt_shutdown_timeout; static char * unix_port=0; -static char *opt_plugin_dir= 0, *opt_default_auth; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; #ifdef HAVE_SMEM static char *shared_memory_base_name=0; @@ -208,7 +208,7 @@ static struct my_option my_long_options[] = {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_PLUGIN_DIR, + {"default_auth", OPT_DEFAULT_AUTH, "Default authentication client-side plugin to use.", (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index bf4920c6f77..91b075a8970 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -79,6 +79,8 @@ static char* host = 0; static int port= 0; static uint my_end_arg; static const char* sock= 0; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; + #ifdef HAVE_SMEM static char *shared_memory_base_name= 0; #endif @@ -1039,6 +1041,10 @@ static struct my_option my_long_options[] = {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"disable-log-bin", 'D', "Disable binary log. This is useful, if you " "enabled --to-last-log and are sending the output to the same MySQL server. " "This way you could avoid an endless loop. You would also like to use it " @@ -1064,6 +1070,9 @@ static struct my_option my_long_options[] = 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', "Password to connect to remote server.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 @@ -1381,6 +1390,12 @@ static Exit_status safe_connect() return ERROR_STOP; } + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); + if (opt_protocol) mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol); #ifdef HAVE_SMEM diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 7b188d7ce18..f38d674ae8d 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -40,6 +40,7 @@ static int my_end_arg; static char * opt_mysql_unix_port = 0; static char *opt_password = 0, *current_user = 0, *default_charset= 0, *current_host= 0; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; static int first_error = 0; DYNAMIC_ARRAY tables4repair; #ifdef HAVE_SMEM @@ -99,6 +100,10 @@ static struct my_option my_long_options[] = {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"fast",'F', "Check only tables that haven't been closed properly.", &opt_fast, &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -136,6 +141,9 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 @@ -796,6 +804,13 @@ static int dbConnect(char *host, char *user, char *passwd) if (shared_memory_base_name) mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); #endif + + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(&mysql_connection, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(&mysql_connection, MYSQL_DEFAULT_AUTH, opt_default_auth); + mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset); if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd, NULL, opt_mysql_port, opt_mysql_unix_port, 0))) diff --git a/client/mysqldump.c b/client/mysqldump.c index 5c3dc5ddd04..66f0c2801f5 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -137,7 +137,7 @@ FILE *stderror_file=0; static char *shared_memory_base_name=0; #endif static uint opt_protocol= 0; -static char *opt_plugin_dir= 0, *opt_default_auth; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; /* Dynamic_string wrapper functions. In this file use these @@ -503,7 +503,7 @@ static struct my_option my_long_options[] = {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_PLUGIN_DIR, + {"default_auth", OPT_DEFAULT_AUTH, "Default authentication client-side plugin to use.", (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysqlimport.c b/client/mysqlimport.c index aea1cb79e74..7966766c1eb 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -60,6 +60,7 @@ static char *opt_password=0, *current_user=0, *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; static uint opt_mysql_port= 0, opt_protocol= 0; static char * opt_mysql_unix_port=0; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; static longlong opt_ignore_lines= -1; #include @@ -90,6 +91,10 @@ static struct my_option my_long_options[] = {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"delete", 'd', "First delete all rows from table.", &opt_delete, &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"fields-terminated-by", OPT_FTB, @@ -139,6 +144,9 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 @@ -429,6 +437,13 @@ static MYSQL *db_connect(char *host, char *database, if (shared_memory_base_name) mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); #endif + + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); + mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset); if (!(mysql_real_connect(mysql,host,user,passwd, database,opt_mysql_port,opt_mysql_unix_port, diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 8cd70db1424..f8a32aae2c0 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -34,6 +34,7 @@ static my_bool debug_info_flag= 0, debug_check_flag= 0; static uint my_end_arg= 0; static uint opt_verbose=0; static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; #ifdef HAVE_SMEM static char *shared_memory_base_name=0; @@ -124,6 +125,12 @@ int main(int argc, char **argv) #endif mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); + if (!(mysql_real_connect(&mysql,host,user,opt_password, (first_argument_uses_wildcards) ? "" : argv[0],opt_mysql_port,opt_mysql_unix_port, @@ -182,6 +189,10 @@ static struct my_option my_long_options[] = {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR, @@ -195,6 +206,9 @@ static struct my_option my_long_options[] = "Password to use when connecting to server. If password is not given, it's " "solicited on the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 01d96f1f75e..237fa18c226 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -122,6 +122,7 @@ static char *host= NULL, *opt_password= NULL, *user= NULL, *pre_system= NULL, *post_system= NULL, *opt_mysql_unix_port= NULL; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; const char *delimiter= "\n"; @@ -338,6 +339,12 @@ int main(int argc, char **argv) #endif mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); + if (!opt_only_print) { if (!(mysql_real_connect(&mysql, host, user, opt_password, @@ -581,6 +588,10 @@ static struct my_option my_long_options[] = GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"delimiter", 'F', "Delimiter to use in SQL statements supplied in file or command line.", &delimiter, &delimiter, 0, GET_STR, REQUIRED_ARG, @@ -620,6 +631,9 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection.", &opt_mysql_port, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result index b155b296ac1..fa6908530b7 100644 --- a/mysql-test/r/plugin_auth.result +++ b/mysql-test/r/plugin_auth.result @@ -319,7 +319,7 @@ Proxied_user With_grant 1 FLUSH PRIVILEGES; # -# Bug#58139 : default-auth option not recognized in MySQL standardi +# Bug#58139 : default-auth option not recognized in MySQL standard # command line clients # # Executing 'mysql' @@ -328,4 +328,6 @@ FLUSH PRIVILEGES; # Executing 'mysqladmin' mysqld is alive # Executing 'mysqldump' +# Executing 'mysql_upgrade' +The --upgrade-system-tables option was used, databases won't be touched. End of 5.5 tests diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test index 49fbfa6995b..5efb50a41e1 100644 --- a/mysql-test/t/plugin_auth.test +++ b/mysql-test/t/plugin_auth.test @@ -395,7 +395,7 @@ FLUSH PRIVILEGES; FLUSH PRIVILEGES; --echo # ---echo # Bug#58139 : default-auth option not recognized in MySQL standardi +--echo # Bug#58139 : default-auth option not recognized in MySQL standard --echo # command line clients --echo # @@ -408,4 +408,7 @@ FLUSH PRIVILEGES; --echo # Executing 'mysqldump' --exec $MYSQL_DUMP -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --compact --default-auth=auth_test_plugin $PLUGIN_AUTH_OPT test +--echo # Executing 'mysql_upgrade' +--exec $MYSQL_UPGRADE -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-auth=auth_test_plugin $PLUGIN_AUTH_OPT --skip-verbose --force --upgrade-system-tables + --echo End of 5.5 tests From 8e3dde5e2f993f912bb420df6d1406b6bc7be254 Mon Sep 17 00:00:00 2001 From: "John H. Embretsen" Date: Mon, 17 Jan 2011 08:12:38 +0100 Subject: [PATCH 11/26] Fix for Bug#45730 - Test case disabled in show_check.test due to WL#1324. Enabled test snippet for bug 4374, tested on Mac OS X 10.6 as well as Solaris. Moved test snippet to a different place in the file, in order to avoid having to save and restore "SET NAMES" setting. New surroundings expect latin1, as is used in the testsnippet. An extra copy of the commented test snippet is removed, a comment is added, SQL keywords are converted to uppercase, and engine name "heap" is updated to "Memory". Also added Copyright statement and a notice about the file's encoding(s). --- mysql-test/r/show_check.result | 11 +++++++ mysql-test/t/show_check.test | 58 ++++++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 17 deletions(-) diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index d42cb680112..9cb57b06c38 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1325,6 +1325,17 @@ Tables_in_test Table_type été BASE TABLE drop table `été`; set names latin1; +# +# Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection +# Character set: Latin-1 (ISO-8859-1) +# +SET NAMES latin1; +CREATE DATABASE `ä`; +CREATE TABLE `ä`.`ä` (a int) ENGINE=Memory; +SHOW TABLE STATUS FROM `ä` LIKE 'ä'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +ä MEMORY 10 Fixed 0 8 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL +DROP DATABASE `ä`; show columns from `#mysql50#????????`; Got one of the listed errors DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 32b1f6bbc90..14e29722409 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -1,3 +1,33 @@ +# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2 of +# the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA +# + +################################################################################ +# +# NOTICE: +# +# This file unfortunately contains characters in various different encodings. +# Be careful when editing this file to ensure that you (or your editor) do +# not change things (such as encodings) on lines that you did not mean to +# modify. +# +################################################################################ + + # Uses GRANT commands that usually disabled in embedded server -- source include/not_embedded.inc @@ -223,14 +253,6 @@ CREATE TABLE """a" (i INT); SHOW CREATE TABLE """a"; DROP TABLE """a"; -# Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection -#set names latin1; -#create database `ä`; -#create table `ä`.`ä` (a int) engine=heap; -#--replace_column 7 # 8 # 9 # -#show table status from `ä` LIKE 'ä'; -#drop database `ä`; - # to test quotes around keywords.. : SET sql_mode= ''; @@ -362,15 +384,6 @@ delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; flush privileges; -# This test fails on MAC OSX, so it is temporary disabled. -# This needs WL#1324 to be done. -#set names latin1; -#create database `ä`; -#create table `ä`.`ä` (a int) engine=heap; -#--replace_column 7 # 8 # 9 # -#show table status from `ä` LIKE 'ä'; -#drop database `ä`; - # Test that USING is always shown in SHOW CREATE TABLE when it was # specified during table creation, but not otherwise. (Bug#7235) CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY; @@ -1053,6 +1066,17 @@ show full tables; drop table `été`; set names latin1; +--echo # +--echo # Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection +--echo # Character set: Latin-1 (ISO-8859-1) +--echo # +SET NAMES latin1; +CREATE DATABASE `ä`; +CREATE TABLE `ä`.`ä` (a int) ENGINE=Memory; +--replace_column 7 # 8 # 9 # +SHOW TABLE STATUS FROM `ä` LIKE 'ä'; +DROP DATABASE `ä`; + # # Bug#26402 Server crashes with old-style named table # From c5aa3313aa44c13e40875a8e2fae01db26377c59 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Mon, 17 Jan 2011 15:44:37 +0800 Subject: [PATCH 12/26] BUG#57953 my_load_defaults return junk argument ----args-separator---- to caller After fix of bug#25192, load_defaults() will add an args separator to distinguish options loaded from configure files from that provided in the command line. One problem of this is that the args separator would be added no matter the application need it or not. Fixed the problem by adding an option: bool my_getopt_use_args_separator; to control whether the separator will be added or not. And also added functions: bool my_getopt_is_args_separator(const char* arg); to check if the argument is the separator or not. --- extra/my_print_defaults.c | 2 +- include/my_sys.h | 3 +- mysys/default.c | 59 +++++++++++++++++++++-------- mysys/my_getopt.c | 4 +- sql-common/client.c | 2 +- sql/mysqld.cc | 2 + storage/ndb/test/run-test/setup.cpp | 4 +- 7 files changed, 54 insertions(+), 22 deletions(-) diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 89fd4104c6f..25ec8beb59f 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -193,7 +193,7 @@ int main(int argc, char **argv) } for (argument= arguments+1 ; *argument ; argument++) - if (*argument != args_separator) /* skip arguments separator */ + if (!my_getopt_is_args_separator(*argument)) /* skip arguments separator */ puts(*argument); my_free(load_default_groups); free_defaults(arguments); diff --git a/include/my_sys.h b/include/my_sys.h index 96b40415c56..484dc684b03 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -817,7 +817,8 @@ extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); extern int get_defaults_options(int argc, char **argv, char **defaults, char **extra_defaults, char **group_suffix); -extern const char *args_separator; +extern my_bool my_getopt_use_args_separator; +extern my_bool my_getopt_is_args_separator(const char* arg); extern int my_load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv, const char ***); extern int load_defaults(const char *conf_file, const char **groups, diff --git a/mysys/default.c b/mysys/default.c index 75eb4709e1e..432c3086254 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -61,9 +61,23 @@ check the pointer, use "----args-separator----" here to ease debug if someone misused it. + The args seprator will only be added when + my_getopt_use_args_seprator is set to TRUE before calling + load_defaults(); + See BUG#25192 */ -const char *args_separator= "----args-separator----"; +static const char *args_separator= "----args-separator----"; +inline static void set_args_separator(char** arg) +{ + DBUG_ASSERT(my_getopt_use_args_separator); + *arg= (char*)args_separator; +} +my_bool my_getopt_use_args_separator= FALSE; +my_bool my_getopt_is_args_separator(const char* arg) +{ + return (arg == args_separator); +} const char *my_defaults_file=0; const char *my_defaults_group_suffix=0; const char *my_defaults_extra_file=0; @@ -503,6 +517,7 @@ int my_load_defaults(const char *conf_file, const char **groups, char *ptr,**res; struct handle_option_ctx ctx; const char **dirs; + uint args_sep= my_getopt_use_args_separator ? 1 : 0; DBUG_ENTER("load_defaults"); init_alloc_root(&alloc,512,0); @@ -515,17 +530,28 @@ int my_load_defaults(const char *conf_file, const char **groups, if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults")) { /* remove the --no-defaults argument and return only the other arguments */ - uint i; + uint i, j; if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+ (*argc + 1)*sizeof(char*)))) goto err; res= (char**) (ptr+sizeof(alloc)); res[0]= **argv; /* Copy program name */ - /* set arguments separator */ - res[1]= (char *)args_separator; - for (i=2 ; i < (uint) *argc ; i++) - res[i]=argv[0][i]; - res[i]=0; /* End pointer */ + j= 1; /* Start from 1 for the reset result args */ + if (my_getopt_use_args_separator) + { + /* set arguments separator */ + set_args_separator(&res[1]); + j++; + } + for (i=2 ; i < (uint) *argc ; i++, j++) + res[j]=argv[0][i]; + res[j]=0; /* End pointer */ + /* + Update the argc, if have not added args separator, then we have + to decrease argc because we have removed the "--no-defaults". + */ + if (!my_getopt_use_args_separator) + (*argc)--; *argv=res; *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ if (default_directories) @@ -559,7 +585,7 @@ int my_load_defaults(const char *conf_file, const char **groups, or a forced default file */ if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+ - (args.elements + *argc + 1 + 1) *sizeof(char*)))) + (args.elements + *argc + 1 + args_sep) *sizeof(char*)))) goto err; res= (char**) (ptr+sizeof(alloc)); @@ -580,16 +606,19 @@ int my_load_defaults(const char *conf_file, const char **groups, --*argc; ++*argv; /* skip argument */ } - /* set arguments separator for arguments from config file and - command line */ - res[args.elements+1]= (char *)args_separator; + if (my_getopt_use_args_separator) + { + /* set arguments separator for arguments from config file and + command line */ + set_args_separator(&res[args.elements+1]); + } if (*argc) - memcpy((uchar*) (res+1+args.elements+1), (char*) ((*argv)+1), + memcpy((uchar*) (res+1+args.elements+args_sep), (char*) ((*argv)+1), (*argc-1)*sizeof(char*)); - res[args.elements+ *argc+1]=0; /* last null */ + res[args.elements+ *argc+args_sep]=0; /* last null */ - (*argc)+=args.elements+1; + (*argc)+=args.elements+args_sep; *argv= (char**) res; *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ delete_dynamic(&args); @@ -599,7 +628,7 @@ int my_load_defaults(const char *conf_file, const char **groups, printf("%s would have been started with the following arguments:\n", **argv); for (i=1 ; i < *argc ; i++) - if ((*argv)[i] != args_separator) /* skip arguments separator */ + if (!my_getopt_is_args_separator((*argv)[i])) /* skip arguments separator */ printf("%s ", (*argv)[i]); puts(""); exit(0); diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index efa7e0bb1b3..6f7ed070ccf 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -176,7 +176,7 @@ int handle_options(int *argc, char ***argv, */ for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++) { - if (*pos == args_separator) + if (my_getopt_is_args_separator(*pos)) { is_cmdline_arg= 0; break; @@ -188,7 +188,7 @@ int handle_options(int *argc, char ***argv, char **first= pos; char *cur_arg= *pos; opt_found= 0; - if (!is_cmdline_arg && (cur_arg == args_separator)) + if (!is_cmdline_arg && (my_getopt_is_args_separator(cur_arg))) { is_cmdline_arg= 1; diff --git a/sql-common/client.c b/sql-common/client.c index 354c04b717b..3b7fc11a537 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1207,7 +1207,7 @@ void mysql_read_default_options(struct st_mysql_options *options, char **option=argv; while (*++option) { - if (option[0] == args_separator) /* skip arguments separator */ + if (my_getopt_is_args_separator(option[0])) /* skip arguments separator */ continue; /* DBUG_PRINT("info",("option: %s",option[0])); */ if (option[0][0] == '-' && option[0][1] == '-') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d670a076ecd..188ed7c6885 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4207,8 +4207,10 @@ int mysqld_main(int argc, char **argv) orig_argc= argc; orig_argv= argv; + my_getopt_use_args_separator= TRUE; if (load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv)) return 1; + my_getopt_use_args_separator= FALSE; defaults_argc= argc; defaults_argv= argv; remaining_argc= argc; diff --git a/storage/ndb/test/run-test/setup.cpp b/storage/ndb/test/run-test/setup.cpp index 60f8285888c..fc30c998865 100644 --- a/storage/ndb/test/run-test/setup.cpp +++ b/storage/ndb/test/run-test/setup.cpp @@ -105,7 +105,7 @@ setup_config(atrt_config& config) */ for (j = 0; j<(size_t)argc; j++) { - if (tmp[j] == args_separator) /* skip arguments separator */ + if (my_getopt_is_args_separator(tmp[j])) /* skip arguments separator */ continue; for (k = 0; proc_args[k].name; k++) { @@ -375,7 +375,7 @@ load_options(int argc, char** argv, int type, atrt_options& opts) * Skip the separator for arguments from config file and command * line */ - if (argv[i] == args_separator) + if (my_getopt_is_args_separator(argv[i])) continue; for (size_t j = 0; f_options[j].name; j++) { From 7f3decd9b22827135af2aef7bfb711a960a86022 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 4 Jan 2011 11:23:45 +0100 Subject: [PATCH 13/26] Bug #58991 DEFAULT_CHARSET and DEFAULT_COLLATION does not work with CMake. cmake/character_sets.cmake: Fix typo in variable name. Some cosmetics. config.h.cmake: Do not use hard-coded defaults for charset and collation. --- cmake/character_sets.cmake | 14 ++++++++------ config.h.cmake | 9 ++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cmake/character_sets.cmake b/cmake/character_sets.cmake index d51444ec433..1cf63ed1462 100644 --- a/cmake/character_sets.cmake +++ b/cmake/character_sets.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,17 +13,19 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#Charsets and collations +# Charsets and collations IF(NOT DEFAULT_CHARSET) -SET(DEFAULT_CHARSET "latin1") + SET(DEFAULT_CHARSET "latin1") ENDIF() -IF(NOT DEFAULT_COLLATIONS) -SET(DEFAULT_COLLATION "latin1_swedish_ci") +IF(NOT DEFAULT_COLLATION) + SET(DEFAULT_COLLATION "latin1_swedish_ci") ENDIF() SET(CHARSETS ${DEFAULT_CHARSET} latin1 utf8 utf8mb4) -SET(CHARSETS_COMPLEX big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32) +SET(CHARSETS_COMPLEX + big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 + sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32) SET(CHARSETS_AVAILABLE binary armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257 diff --git a/config.h.cmake b/config.h.cmake index 204e1032410..65ebd077da6 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1,6 +1,5 @@ -/* Copyright (C) 2009, 2011, Oracle and/or its affiliates. All rights - reserved - +/* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. @@ -516,8 +515,8 @@ #cmakedefine CYBOZU 1 /* Character sets and collations */ -#cmakedefine MYSQL_DEFAULT_CHARSET_NAME "latin1" -#cmakedefine MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" +#cmakedefine MYSQL_DEFAULT_CHARSET_NAME "@MYSQL_DEFAULT_CHARSET_NAME@" +#cmakedefine MYSQL_DEFAULT_COLLATION_NAME "@MYSQL_DEFAULT_COLLATION_NAME@" #cmakedefine USE_MB 1 #cmakedefine USE_MB_IDENT 1 From faafae781adc87d80dc0e7c5e631996ed015f8ed Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Fri, 14 Jan 2011 11:33:12 +0100 Subject: [PATCH 14/26] BUG#59063: rpl_migration_crash_safe fails on Windows Backported the fix to 5.1. Problem: the auxiliary test files rpl_start_server.inc and rpl_stop_server.inc write a file that is later read by mtr. The bug was that the file was written with platform-dependent newline terminators, i.e., \r\n on windows, whereas mtr only understands \n. Fix: write the file so that it uses \n on all platforms. mysql-test/include/rpl_start_server.inc: Force test to use \n instead of platform-dependent newline terminator. mysql-test/include/rpl_stop_server.inc: Force test to use \n instead of platform-dependent newline terminator. --- mysql-test/include/rpl_start_server.inc | 10 +++++++++- mysql-test/include/rpl_stop_server.inc | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mysql-test/include/rpl_start_server.inc b/mysql-test/include/rpl_start_server.inc index c59c7759910..ac8106f141c 100644 --- a/mysql-test/include/rpl_start_server.inc +++ b/mysql-test/include/rpl_start_server.inc @@ -45,7 +45,15 @@ if ($rpl_server_parameters) --source include/rpl_connection.inc # Write file to make mysql-test-run.pl start up the server again ---exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +--let WRITE_TO_FILE= $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +--let WRITE_TO_VAR= $_rpl_start_server_command +perl; +my $file= $ENV{'WRITE_TO_FILE'}; +my $var= $ENV{'WRITE_TO_VAR'}; +open WRITE_FILE, ">> $file" or die "Error opening $file: $!"; +print WRITE_FILE $var, "\n" or die "Error appending to $file: $!"; +close WRITE_FILE or die "Error closing $file: $!"; +EOF --source include/rpl_reconnect.inc diff --git a/mysql-test/include/rpl_stop_server.inc b/mysql-test/include/rpl_stop_server.inc index e1f8839dd69..a90981d6de8 100644 --- a/mysql-test/include/rpl_stop_server.inc +++ b/mysql-test/include/rpl_stop_server.inc @@ -44,7 +44,9 @@ if ($rpl_debug) # Write file to make mysql-test-run.pl expect the "crash", but don't start # it until it's told to ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +wait +EOF # Send shutdown to the connected server and give # it 10 seconds to die before zapping it From ab2d29ec6b84eb4531d2d63887ac29f7d9617e60 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Fri, 14 Jan 2011 19:50:34 +0530 Subject: [PATCH 15/26] Bug#13618 : mysqldump --xml omits comment on table field When mysqldump tries to dump information in xml format, the result does not contain field level comments. In order to retrieve various informations for a field/column, mysqldump currently uses 'show fields from ' statement. The attributes returned by the statement lacks the information regarding field comments. Fixed by changing the query to one that probes I_S to retrieve required field informations, including the field comment. client/mysqldump.c: Bug#13618 : mysqldump --xml omits comment on table field. Replaced the 'show fields' command by a statement that queries I_S, in order to retrieve information on all the attributes that 'show fields' returns along-with an additional column_comment information. mysql-test/r/client_xml.result: Result modifications for bug#13618. mysql-test/r/mysqldump.result: Result modifications for bug#13618. mysql-test/t/mysqldump.test: Added a testcase for bug#13618. --- client/mysqldump.c | 13 ++++++++++-- mysql-test/r/client_xml.result | 6 +++--- mysql-test/r/mysqldump.result | 37 ++++++++++++++++++++++++---------- mysql-test/t/mysqldump.test | 9 +++++++++ 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index e35672c2a2c..57e3f5b0349 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2247,6 +2247,15 @@ static uint get_table_structure(char *table, char *db, char *table_type, const char *insert_option; char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH]; + const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, " + "`COLUMN_TYPE` AS `Type`, " + "`IS_NULLABLE` AS `Null`, " + "`COLUMN_KEY` AS `Key`, " + "`COLUMN_DEFAULT` AS `Default`, " + "`EXTRA` AS `Extra`, " + "`COLUMN_COMMENT` AS `Comment` " + "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE " + "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'"; FILE *sql_file= md_result_file; int len; MYSQL_RES *result; @@ -2514,8 +2523,8 @@ static uint get_table_structure(char *table, char *db, char *table_type, verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n", my_progname, mysql_error(mysql)); - my_snprintf(query_buff, sizeof(query_buff), "show fields from %s", - result_table); + my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table); + if (mysql_query_with_error_report(mysql, &result, query_buff)) DBUG_RETURN(0); diff --git a/mysql-test/r/client_xml.result b/mysql-test/r/client_xml.result index aa4bdb2bd61..7f74a092af7 100644 --- a/mysql-test/r/client_xml.result +++ b/mysql-test/r/client_xml.result @@ -21,9 +21,9 @@ insert into t1 values (1, 2, 'a&b ab'); - - - + + + diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index d26eaac7a93..289e7f66406 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -14,7 +14,7 @@ INSERT INTO t1 VALUES (1), (2); - + @@ -150,9 +150,9 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES"); - - - + + + @@ -178,7 +178,7 @@ INSERT INTO t1 VALUES ("1\""), ("\"2"); - + @@ -1612,10 +1612,10 @@ CREATE TABLE `t2` ( - + - + @@ -1623,10 +1623,10 @@ CREATE TABLE `t2` ( - + - + @@ -3644,8 +3644,8 @@ INSERT INTO t1 VALUES(1,0xff00fef0); - - + + @@ -4576,5 +4576,20 @@ LENGTH(a) 800 DROP TABLE t1, t2; # +# Bug #13618 : mysqldump --xml ommit comment on table field +# +CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT'; + + + + + + + + + + +DROP TABLE `comment_table`; +# # End of 5.1 tests # diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 9246d488dd8..fe0b05dbb42 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -2164,6 +2164,15 @@ SELECT LENGTH(a) FROM t2; DROP TABLE t1, t2; ########################################################################### + +--echo # +--echo # Bug #13618 : mysqldump --xml ommit comment on table field +--echo # + +CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT'; +--exec $MYSQL_DUMP --compact --skip-create --xml test +DROP TABLE `comment_table`; + --echo # --echo # End of 5.1 tests --echo # From 335fcd91b300f1670eb57378b5391a52be152add Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Sat, 15 Jan 2011 00:56:09 +0400 Subject: [PATCH 16/26] Bug#52208 gis fails on some platforms (Solaris, HP-UX, Linux) IA64 and some other arcitectures use different float rounding mode and i find no decent way to make it consistent. So the test changed to be insensitive to this. per-file messages: mysql-test/t/gis.test Bug#52208 gis fails on some platforms (Solaris, HP-UX, Linux) --replace_result added --- mysql-test/t/gis.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 97fc6f94b6a..bdbbfc7c064 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -358,7 +358,7 @@ t1 where object_id=85998; # Expected result is 36.3310176346905, but IA64 returns 36.3310176346904 # due to fused multiply-add instructions. ---replace_result 36.3310176346904 36.3310176346905 +--replace_result 36.3310176346904 36.3310176346905 -114.87787186923326 -114.87787186923313 36.33101763469053 36.33101763469059 36.33101763469043 36.33101763469059 select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from t1 where object_id=85984; From 12c6d1f355c45d00421862837a1810a5d0b28049 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 15 Jan 2011 13:48:16 +0800 Subject: [PATCH 17/26] BUG#49124 Security issue with /*!-versioned */ SQL statements on Slave Backport to 5.0. /*![:version:] Query Code */, where [:version:] is a sequence of 5 digits representing the mysql server version(e.g /*!50200 ... */), is a special comment that the query in it can be executed on those servers whose versions are larger than the version appearing in the comment. It leads to a security issue when slave's version is larger than master's. A malicious user can improve his privileges on slaves. Because slave SQL thread is running with SUPER privileges, so it can execute queries that he/she does not have privileges on master. This bug is fixed with the logic below: - To replace '!' with ' ' in the magic comments which are not applied on master. So they become common comments and will not be applied on slave. - Example: 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/ will be binlogged as 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/ --- mysql-test/r/rpl_conditional_comments.result | 57 +++++++++++++++ mysql-test/t/rpl_conditional_comments.test | 73 ++++++++++++++++++++ sql/mysql_priv.h | 2 +- sql/sql_lex.cc | 25 ++++++- sql/sql_lex.h | 8 +-- sql/sql_parse.cc | 12 ++-- 6 files changed, 163 insertions(+), 14 deletions(-) create mode 100644 mysql-test/r/rpl_conditional_comments.result create mode 100644 mysql-test/t/rpl_conditional_comments.test diff --git a/mysql-test/r/rpl_conditional_comments.result b/mysql-test/r/rpl_conditional_comments.result new file mode 100644 index 00000000000..105d3bc59f3 --- /dev/null +++ b/mysql-test/r/rpl_conditional_comments.result @@ -0,0 +1,57 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +CREATE TABLE t1(c1 INT); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) + +# Case 1: +# ------------------------------------------------------------------ +# In a statement, some CCs are applied while others are not. The CCs +# which are not applied on master will be binlogged as common comments. +/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; /* 99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /* 99999 ,(11)*/ +Comparing tables master:test.t1 and slave:test.t1 + +# Case 2: +# ----------------------------------------------------------------- +# Verify whether it can be binlogged correctly when executing prepared +# statement. +PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/'; +EXECUTE stmt; +DROP TABLE t1; +CREATE TABLE t1(c1 INT); +EXECUTE stmt; +Comparing tables master:test.t1 and slave:test.t1 + +SET @value=62; +PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/'; +EXECUTE stmt USING @value; +DROP TABLE t1; +CREATE TABLE t1(c1 INT); +EXECUTE stmt USING @value; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/ +master-bin.000001 # Query # # use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) +master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/ +master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/ +master-bin.000001 # Query # # use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) +master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/ +Comparing tables master:test.t1 and slave:test.t1 + +# Case 3: +# ----------------------------------------------------------------- +# Verify it can restore the '!', if the it is an uncomplete conditional +# comments +SELECT c1 FROM /*!99999 t1 WHEREN; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!99999 t1 WHEREN' at line 1 +DROP TABLE t1; diff --git a/mysql-test/t/rpl_conditional_comments.test b/mysql-test/t/rpl_conditional_comments.test new file mode 100644 index 00000000000..f1f46b8fc41 --- /dev/null +++ b/mysql-test/t/rpl_conditional_comments.test @@ -0,0 +1,73 @@ +############################################################################### +# After the patch for BUG#49124: +# - Use ' ' instead of '!' in the conditional comments which are not applied on +# master. So they become common comments and will not be applied on slave. +# +# - Example: +# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/ +# will be binlogged as +# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/'. +############################################################################### +source include/master-slave.inc; + +CREATE TABLE t1(c1 INT); +source include/show_binlog_events.inc; +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); + +--echo +--echo # Case 1: +--echo # ------------------------------------------------------------------ +--echo # In a statement, some CCs are applied while others are not. The CCs +--echo # which are not applied on master will be binlogged as common comments. + +/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/; + +source include/show_binlog_events.inc; +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); +sync_slave_with_master; +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +--echo +--echo # Case 2: +--echo # ----------------------------------------------------------------- +--echo # Verify whether it can be binlogged correctly when executing prepared +--echo # statement. +PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/'; +EXECUTE stmt; +DROP TABLE t1; +CREATE TABLE t1(c1 INT); +EXECUTE stmt; + +sync_slave_with_master; +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +--echo +SET @value=62; +PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/'; +EXECUTE stmt USING @value; +DROP TABLE t1; +CREATE TABLE t1(c1 INT); +EXECUTE stmt USING @value; + +source include/show_binlog_events.inc; +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); + +sync_slave_with_master; +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +--echo +--echo # Case 3: +--echo # ----------------------------------------------------------------- +--echo # Verify it can restore the '!', if the it is an uncomplete conditional +--echo # comments +--error 1064 +SELECT c1 FROM /*!99999 t1 WHEREN; + +DROP TABLE t1; +source include/master-slave-end.inc; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 55bcd30999d..5f8458f4f1e 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -751,7 +751,7 @@ bool do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch); -void mysql_parse(THD *thd, const char *inBuf, uint length, +void mysql_parse(THD *thd, char *rawbuf, uint length, const char ** semicolon); bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 17ee53d446b..a013d5466c1 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -109,7 +109,7 @@ st_parsing_options::reset() } Lex_input_stream::Lex_input_stream(THD *thd, - const char* buffer, + char* buffer, unsigned int length) : m_thd(thd), yylineno(1), @@ -580,7 +580,7 @@ int MYSQLlex(void *arg, void *yythd) state=MY_LEX_COMMENT; break; } - yylval->lex_str.str=(char*) (lip->ptr=lip->tok_start);// Set to first chr + yylval->lex_str.str=lip->ptr=(char*)lip->tok_start;// Set to first chr yylval->lex_str.length=1; c=yyGet(); if (c != ')') @@ -946,6 +946,9 @@ int MYSQLlex(void *arg, void *yythd) state = MY_LEX_START; // Try again break; case MY_LEX_LONG_COMMENT: /* Long C comment? */ + { + char *version_mark= NULL; + if (yyPeek() != '*') { state=MY_LEX_CHAR; // Probable division @@ -956,6 +959,8 @@ int MYSQLlex(void *arg, void *yythd) if (yyPeek() == '!') // MySQL command in comment { ulong version=MYSQL_VERSION_ID; + version_mark= lip->ptr; + yySkip(); state=MY_LEX_START; if (my_isdigit(cs,yyPeek())) @@ -964,9 +969,18 @@ int MYSQLlex(void *arg, void *yythd) } if (version <= MYSQL_VERSION_ID) { - lex->in_comment=1; + lex->in_comment=1; + version_mark= NULL; break; } + else + { + /* + Patch and skip the conditional comment to avoid it + being propagated infinitely (eg. to a slave). + */ + *version_mark= ' '; + } } /* Discard: @@ -995,8 +1009,13 @@ int MYSQLlex(void *arg, void *yythd) } /* Unbalanced comments with a missing '*' '/' are a syntax error */ if (! comment_closed) + { + if (version_mark != NULL) + *version_mark= '!'; return (ABORT_SYM); + } break; + } case MY_LEX_END_LONG_COMMENT: if (lex->in_comment && yyPeek() == '/') { diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 5c0367632e1..7a315d81aa5 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -935,7 +935,7 @@ struct st_parsing_options class Lex_input_stream { public: - Lex_input_stream(THD *thd, const char* buff, unsigned int length); + Lex_input_stream(THD *thd, char* buff, unsigned int length); ~Lex_input_stream(); /** Current thread. */ @@ -951,7 +951,7 @@ public: LEX_YYSTYPE yylval; /** Pointer to the current position in the input stream. */ - const char* ptr; + char* ptr; /** Starting position of the last token parsed. */ const char* tok_start; @@ -966,7 +966,7 @@ public: const char* tok_start_prev; /** Begining of the query text in the input stream. */ - const char* buf; + char* buf; /** Current state of the lexical analyser. */ enum my_lex_states next_state; @@ -1355,7 +1355,7 @@ public: class Parser_state { public: - Parser_state(THD *thd, const char* buff, unsigned int length) + Parser_state(THD *thd, char* buff, unsigned int length) : m_lip(thd, buff, length), m_yacc() {} diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1bd68e5424f..0f75b835315 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6414,13 +6414,13 @@ void mysql_init_multi_delete(LEX *lex) /** Parse a query. @param thd Current thread - @param inBuf Begining of the query text + @param rawbuf Begining of the query text @param length Length of the query text @param [out] semicolon For multi queries, position of the character of the next query in the query text. */ -void mysql_parse(THD *thd, const char *inBuf, uint length, +void mysql_parse(THD *thd, char *rawbuf, uint length, const char ** found_semicolon) { DBUG_ENTER("mysql_parse"); @@ -6446,14 +6446,14 @@ void mysql_parse(THD *thd, const char *inBuf, uint length, lex_start(thd); mysql_reset_thd_for_next_command(thd); - if (query_cache_send_result_to_client(thd, (char*) inBuf, length) <= 0) + if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0) { LEX *lex= thd->lex; sp_cache_flush_obsolete(&thd->sp_proc_cache); sp_cache_flush_obsolete(&thd->sp_func_cache); - Parser_state parser_state(thd, inBuf, length); + Parser_state parser_state(thd, rawbuf, length); thd->m_parser_state= &parser_state; int err= MYSQLparse(thd); @@ -6538,13 +6538,13 @@ void mysql_parse(THD *thd, const char *inBuf, uint length, 1 can be ignored */ -bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length) +bool mysql_test_parse_for_slave(THD *thd, char *rawbuf, uint length) { LEX *lex= thd->lex; bool error= 0; DBUG_ENTER("mysql_test_parse_for_slave"); - Parser_state parser_state(thd, inBuf, length); + Parser_state parser_state(thd, rawbuf, length); thd->m_parser_state= &parser_state; lex_start(thd); From 208b677637ef9d140c1629a0de4d4963c02ea533 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Sun, 16 Jan 2011 02:04:08 +0530 Subject: [PATCH 18/26] Bug#58221 : mysqladmin --sleep=x --count=x keeps looping When mysqldadmin is run with sleep and count options, it goes into an infinite loop and keeps executing the specified command. This happened because the statement, responsible for decrementing the count value, was missing. Fixed by adding a statement which will decrement the count value for each iteration. client/mysqladmin.cc: Bug#58221 : mysqladmin --sleep=x --count=x keeps looping Added a condition to check and decrement the count value stored in nr_iterations per iteration. mysql-test/r/mysqladmin.result: Added a testcase for Bug#58221. mysql-test/t/mysqladmin.test: Added a testcase for Bug#58221. --- client/mysqladmin.cc | 3 +++ mysql-test/r/mysqladmin.result | 8 ++++++++ mysql-test/t/mysqladmin.test | 12 ++++++++++++ 3 files changed, 23 insertions(+) diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index fe3e51a4d61..18ee8fae400 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -416,6 +416,9 @@ int main(int argc,char *argv[]) if (interval) /* --sleep=interval given */ { + if (opt_count_iterations && --nr_iterations == 0) + break; + /* If connection was dropped (unintentionally, or due to SHUTDOWN), re-establish it if --wait ("retry-connect") was given and user diff --git a/mysql-test/r/mysqladmin.result b/mysql-test/r/mysqladmin.result index 57927f8aa67..748152bffcc 100644 --- a/mysql-test/r/mysqladmin.result +++ b/mysql-test/r/mysqladmin.result @@ -2,3 +2,11 @@ mysqld is alive mysqladmin: unknown variable 'database=db1' Warning: mysqladmin: unknown variable 'loose-database=db2' mysqld is alive +# +# Bug#58221 : mysqladmin --sleep=x --count=x keeps looping +# +# Executing mysqladmin with --sleep=1 and --count=2. +# Done. +# Displaying the output : +mysqld is alive +mysqld is alive diff --git a/mysql-test/t/mysqladmin.test b/mysql-test/t/mysqladmin.test index 839ecf00b60..a2b12dbc9b6 100644 --- a/mysql-test/t/mysqladmin.test +++ b/mysql-test/t/mysqladmin.test @@ -33,3 +33,15 @@ EOF --exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf; + +--echo # +--echo # Bug#58221 : mysqladmin --sleep=x --count=x keeps looping +--echo # + +--echo # Executing mysqladmin with --sleep=1 and --count=2. +--exec $MYSQLADMIN -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --sleep=1 --count=2 ping > $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp +--echo # Done. +--echo # Displaying the output : +--cat_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp + +--remove_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp From a2850a2f5323bfe8eaae17746c88986cee37fc76 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 17 Jan 2011 12:30:22 +0300 Subject: [PATCH 19/26] Bug#59149 valgrind warnings with "like .. escape .." function Problem: when processing a query like: SELECT '' LIKE '1' ESCAPE COUNT(1); escape_item->val_str() was never executed and the "escape" class member stayed initialized, which led to valgrind uninitialized memory error. Note, a query with some tables in "FROM" clause returns ER_WRONG_ARGUMENTS in the same situation: SELECT '' LIKE '1' ESCAPE COUNT(1) FROM t1; ERROR 1210 (HY000): Incorrect arguments to ESCAPE Fix: disallowing using aggregate functions in ESCAPE clause, even if there are no tables used. There is no much use of that anyway. --- mysql-test/r/func_like.result | 5 +++++ mysql-test/t/func_like.test | 5 +++++ sql/item_sum.h | 1 + 3 files changed, 11 insertions(+) diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index 21da211160b..76174982e8e 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -182,4 +182,9 @@ INSERT INTO t2 VALUES (1), (2), (3); SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a; 1 DROP TABLE t1, t2; +# +# Bug#59149 valgrind warnings with "like .. escape .." function +# +SELECT '' LIKE '1' ESCAPE COUNT(1); +ERROR HY000: Incorrect arguments to ESCAPE End of 5.1 tests diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index 1204d04d9a0..f1fe52274b2 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -126,5 +126,10 @@ INSERT INTO t2 VALUES (1), (2), (3); SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a; DROP TABLE t1, t2; +--echo # +--echo # Bug#59149 valgrind warnings with "like .. escape .." function +--echo # +--error ER_WRONG_ARGUMENTS +SELECT '' LIKE '1' ESCAPE COUNT(1); --echo End of 5.1 tests diff --git a/sql/item_sum.h b/sql/item_sum.h index de988c196ec..f8819d63bf4 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -339,6 +339,7 @@ public: forced_const= TRUE; } virtual bool const_item() const { return forced_const; } + virtual bool const_during_execution() const { return false; } virtual void print(String *str, enum_query_type query_type); void fix_num_length_and_dec(); From 6665ca25afdeea7a3fd2db0094d3f67af37e14ba Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 17 Jan 2011 15:11:33 +0300 Subject: [PATCH 20/26] Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function Introduced by the fix for bug#44766. Problem: it's not correct to use args[0]->str_value as a buffer, because args[0] may need this buffer for its own purposes. Fix: adding a new class member tmp_value to use as return value. @ mysql-test/r/ctype_many.result @ mysql-test/t/ctype_many.test Adding tests @ sql/item_strfunc.cc Changing code into traditional style: use "str" as a buffer for the argument and tmp_value for the result value. @ sql/item_strfunc.h Adding tmp_value --- mysql-test/r/ctype_many.result | 15 +++++++++++++++ mysql-test/t/ctype_many.test | 16 ++++++++++++++++ sql/item_strfunc.cc | 12 +++--------- sql/item_strfunc.h | 1 + 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result index 89e05bf4484..dbec746cdae 100644 --- a/mysql-test/r/ctype_many.result +++ b/mysql-test/r/ctype_many.result @@ -1683,3 +1683,18 @@ ARMENIAN CAPIT DA 2 ARMENIAN CAPIT ECH 2 ARMENIAN CAPIT ZA 2 DROP TABLE t1; +# +# Start of 5.1 tests +# +# +# Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function +# +SET NAMES latin1; +DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1) +AS BINARY(0)) USING utf8); +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'Zpq' +Warning 1292 Truncated incorrect BINARY(0) value: '1.' +# +# End of 5.1 tests +# diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test index 0903c3dd7fa..84048761228 100644 --- a/mysql-test/t/ctype_many.test +++ b/mysql-test/t/ctype_many.test @@ -211,3 +211,19 @@ SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f; DROP TABLE t1; # End of 4.1 tests + + +--echo # +--echo # Start of 5.1 tests +--echo # + +--echo # +--echo # Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function +--echo # + +SET NAMES latin1; +DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1) + AS BINARY(0)) USING utf8); +--echo # +--echo # End of 5.1 tests +--echo # diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 204a2dfc663..c637c9c29b8 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2761,22 +2761,16 @@ String *Item_func_conv_charset::val_str(String *str) DBUG_ASSERT(fixed == 1); if (use_cached_value) return null_value ? 0 : &str_value; - /* - Here we don't pass 'str' as a parameter to args[0]->val_str() - as 'str' may point to 'str_value' (e.g. see Item::save_in_field()), - which we use below to convert string. - Use argument's 'str_value' instead. - */ - String *arg= args[0]->val_str(&args[0]->str_value); + String *arg= args[0]->val_str(str); uint dummy_errors; if (!arg) { null_value=1; return 0; } - null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(), + null_value= tmp_value.copy(arg->ptr(), arg->length(), arg->charset(), conv_charset, &dummy_errors); - return null_value ? 0 : check_well_formed_result(&str_value); + return null_value ? 0 : check_well_formed_result(&tmp_value); } void Item_func_conv_charset::fix_length_and_dec() diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 6645a4c637a..408062ddc08 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -713,6 +713,7 @@ public: class Item_func_conv_charset :public Item_str_func { bool use_cached_value; + String tmp_value; public: bool safe; CHARSET_INFO *conv_charset; // keep it public From b36350842cc8385340e03e9ec18350bcecf3ca03 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Mon, 17 Jan 2011 18:51:01 +0000 Subject: [PATCH 21/26] BUG#42879: CHANGE MASTER RELAY_LOG_FILE=path fails on windows Re-enabling the test case on windows since BUG#12190 has fixed the issue. --- mysql-test/suite/rpl/t/rpl_cross_version.test | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mysql-test/suite/rpl/t/rpl_cross_version.test b/mysql-test/suite/rpl/t/rpl_cross_version.test index 7a8cbfd8237..94c9f0432ce 100644 --- a/mysql-test/suite/rpl/t/rpl_cross_version.test +++ b/mysql-test/suite/rpl/t/rpl_cross_version.test @@ -12,11 +12,6 @@ --source include/master-slave.inc -# The test is disabled for windows due to -# Bug #42879 CHANGE MASTER RELAY_LOG_FILE=path fails on windows -# Todo: release it from not_windows ---source include/not_windows.inc - # # Bug#31240 load data infile replication between (4.0 or 4.1) and 5.1 fails # From afa2ec12d076947d70baa10a5dd4922fa483a1a4 Mon Sep 17 00:00:00 2001 From: Vinay Fisrekar Date: Tue, 18 Jan 2011 09:24:52 +0530 Subject: [PATCH 22/26] BUG#58858 : sys_vars.innodb_max_dirty_pages_pct_func fails sporadically Committing After latest merge. Modified check_pct procedure to check return value of wait condition instead of calling "dirty_pct". Adding Review comments: 1) Added comment for success variable value 2) Procedure check_pct changed For Adding BOOLEAN input and SELECT QUERY Change --- .../sys_vars/r/innodb_max_dirty_pages_pct_func.result | 8 ++++---- .../sys_vars/t/innodb_max_dirty_pages_pct_func.test | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result index baf06092126..55de5adbc33 100644 --- a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result +++ b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result @@ -64,12 +64,12 @@ SET last = pct; END IF; END WHILE; END// -CREATE PROCEDURE check_pct(IN num DECIMAL) +CREATE PROCEDURE check_pct(IN success_on_wait BOOLEAN) BEGIN -IF (dirty_pct() < num) THEN +IF (success_on_wait > 0) THEN SELECT 'BELOW_MAX' AS PCT_VALUE; ELSE -SELECT 'ABOVE_MAX' AS PCT_VALUE; +SELECT 'ABOVE_MAX or TimeOut Of The Test' AS PCT_VALUE; END IF; END// CREATE TABLE t1( @@ -83,7 +83,7 @@ CALL add_until(10); FLUSH TABLES; CALL add_records(500); 'We expect dirty pages pct to be BELOW_MAX after some time depending on performance' -CALL check_pct(10); +CALL check_pct(1); PCT_VALUE BELOW_MAX DROP PROCEDURE add_records; diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test index b577ae5fcc4..c7a9e567e69 100644 --- a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test @@ -117,12 +117,12 @@ BEGIN END WHILE; END// -CREATE PROCEDURE check_pct(IN num DECIMAL) +CREATE PROCEDURE check_pct(IN success_on_wait BOOLEAN) BEGIN - IF (dirty_pct() < num) THEN + IF (success_on_wait > 0) THEN SELECT 'BELOW_MAX' AS PCT_VALUE; ELSE - SELECT 'ABOVE_MAX' AS PCT_VALUE; + SELECT 'ABOVE_MAX or TimeOut Of The Test' AS PCT_VALUE; END IF; END// @@ -155,7 +155,8 @@ let $wait_condition= SELECT (dirty_pct() <= @@global.innodb_max_dirty_pages_pct) --source include/wait_condition.inc --echo 'We expect dirty pages pct to be BELOW_MAX after some time depending on performance' -CALL check_pct(10); +# Value For $sucess will be set from include/wait_condition.inc file. It can have values 1 or 0. It will be 1 if dirty_pct() <= @@global.innodb_max_dirty_pages_pct else it will be 0. +eval CALL check_pct($success); DROP PROCEDURE add_records; DROP PROCEDURE add_until; DROP PROCEDURE check_pct; From 5574a2cd91eaf76fd2263b38d64d8c617d3c1d02 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 18 Jan 2011 09:38:41 +0300 Subject: [PATCH 23/26] Bug#44332 my_xml_scan reads behind the end of buffer Problem: the scanner function tested for strings "" without checking input string boundaries, which led to valgrind's "Conditional jump or move depends on uninitialised value(s)" error. Fix: Adding boundary checking. @ mysql-test/r/xml.result @ mysql-test/t/xml.test Adding test @ strings/xml.c Adding a helper function my_xml_parser_prefix_cmp(), with input string boundary check. --- mysql-test/r/xml.result | 11 +++++++++++ mysql-test/t/xml.test | 5 +++++ strings/xml.c | 23 +++++++++++++++++------ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 92f84381415..0a71a596505 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1113,4 +1113,15 @@ SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1); ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1)); ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing +# +# Bug #44332 my_xml_scan reads behind the end of buffer +# +SELECT UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1'); +UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1') +NULL +Warnings: +Warning 1525 Incorrect XML value: 'parse error at line 1 pos 2: END-OF-INPUT unexpected (ident or '/' wanted)' +SELECT UPDATEXML(CONVERT(_latin1'", 3); p->cur++) - {} - if (!memcmp(p->cur, "-->", 3)) - p->cur+=3; + for (; p->cur < p->end; p->cur++) + { + if (!my_xml_parser_prefix_cmp(p, C_STRING_WITH_LEN("-->"))) + { + p->cur+= 3; + break; + } + } a->end=p->cur; lex=MY_XML_COMMENT; } - else if (!memcmp(p->cur, "cur+= 9; for (; p->cur < p->end - 2 ; p->cur++) From 4bdfcf59f2796955296566e1167cff3ce0381039 Mon Sep 17 00:00:00 2001 From: "John H. Embretsen" Date: Tue, 18 Jan 2011 13:04:17 +0100 Subject: [PATCH 24/26] Post push test fix for show_check.test. Fix for bug#45740 introduced test case using SHOW TABLE STATUS against a Memory table using latin1 character in table name. The test failed on Windows and FreeBSD due to a difference in the value for Avg_row_length. The average row length normally depends on the values for data length and row count. According to the 5.5 manual data length is approximate with Memory tables. With MyISAM and InnoDB the Avg_row_length is the same on Windows and Solaris. The solution implemented by this patch is to mask out the value for Avg_row_length, as it may vary when using Memory tables. --- mysql-test/r/show_check.result | 2 +- mysql-test/t/show_check.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 9cb57b06c38..feeba25c536 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1334,7 +1334,7 @@ CREATE DATABASE ` CREATE TABLE `ä`.`ä` (a int) ENGINE=Memory; SHOW TABLE STATUS FROM `ä` LIKE 'ä'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -ä MEMORY 10 Fixed 0 8 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL +ä MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL DROP DATABASE `ä`; show columns from `#mysql50#????????`; Got one of the listed errors diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 14e29722409..a334a5f7791 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -1073,7 +1073,7 @@ set names latin1; SET NAMES latin1; CREATE DATABASE `ä`; CREATE TABLE `ä`.`ä` (a int) ENGINE=Memory; ---replace_column 7 # 8 # 9 # +--replace_column 6 # 7 # 8 # 9 # SHOW TABLE STATUS FROM `ä` LIKE 'ä'; DROP DATABASE `ä`; From 77bc81b89ca65edb244fe4da30ca61e2f97cb5de Mon Sep 17 00:00:00 2001 From: Libing Song Date: Wed, 19 Jan 2011 01:23:49 +0800 Subject: [PATCH 25/26] Bug#58546 test rpl_packet timeout failure sporadically on PB rpl_packet got a timeout failure sporadically on PB when stopping slave. The real reason of this bug is that STOP SLAVE stopped IO thread first and then stopped SQL thread. It was possible that IO thread stopped after replicating part of a transaction which SQL thread was executing. SQL thread would be hung if the transaction could not be rolled back safely. After this patch, STOP SLAVE will stop SQL thread first and then stop IO thread, which guarantees that IO thread will fetch the reset of the events of the transaction that SQL thread is executing, so that SQL thread can finish the transaction if it cannot be rolled back safely. Added below auxiliary files to make the test code neater. restart_slave_sql.inc rpl_connection_master.inc rpl_connection_slave.inc rpl_connection_slave1.inc --- mysql-test/include/restart_slave_sql.inc | 43 +++++++++++++ mysql-test/include/rpl_connection_master.inc | 2 + mysql-test/include/rpl_connection_slave.inc | 2 + mysql-test/include/rpl_connection_slave1.inc | 2 + mysql-test/suite/rpl/r/rpl_stop_slave.result | 42 +++++++++++++ mysql-test/suite/rpl/t/rpl_packet.test | 2 +- mysql-test/suite/rpl/t/rpl_stop_slave.test | 64 +++++++++++++++++++- sql/slave.cc | 22 +++---- sql/sql_repl.cc | 23 +++++++ 9 files changed, 189 insertions(+), 13 deletions(-) create mode 100644 mysql-test/include/restart_slave_sql.inc create mode 100644 mysql-test/include/rpl_connection_master.inc create mode 100644 mysql-test/include/rpl_connection_slave.inc create mode 100644 mysql-test/include/rpl_connection_slave1.inc diff --git a/mysql-test/include/restart_slave_sql.inc b/mysql-test/include/restart_slave_sql.inc new file mode 100644 index 00000000000..ee6c6d7ced6 --- /dev/null +++ b/mysql-test/include/restart_slave_sql.inc @@ -0,0 +1,43 @@ +# ==== Purpose ==== +# +# Provide a earier way to restart SQL thread when you want to stop sql thread +# and then start it immediately. +# +# Sources stop_slave_sql.inc to stop SQL thread on the current connection. +# Then issues START SLAVE SQL_THREAD and then waits until +# the SQL threads have started, or until a timeout is reached. +# +# Please use this instead of 'STOP|START SLAVE SQL_THREAD', to reduce the risk of +# test case bugs. +# +# +# ==== Usage ==== +# +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/restart_slave_sql.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= restart_slave.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + +source include/stop_slave_sql.inc; +START SLAVE SQL_THREAD; +source include/wait_for_slave_sql_to_start.inc; + + +--let $include_filename= restart_slave.inc +--source include/end_include_file.inc \ No newline at end of file diff --git a/mysql-test/include/rpl_connection_master.inc b/mysql-test/include/rpl_connection_master.inc new file mode 100644 index 00000000000..e54e34071c8 --- /dev/null +++ b/mysql-test/include/rpl_connection_master.inc @@ -0,0 +1,2 @@ +let $rpl_connection_name= master; +source include/rpl_connection.inc; \ No newline at end of file diff --git a/mysql-test/include/rpl_connection_slave.inc b/mysql-test/include/rpl_connection_slave.inc new file mode 100644 index 00000000000..ef3876394d6 --- /dev/null +++ b/mysql-test/include/rpl_connection_slave.inc @@ -0,0 +1,2 @@ +let $rpl_connection_name= slave; +source include/rpl_connection.inc; \ No newline at end of file diff --git a/mysql-test/include/rpl_connection_slave1.inc b/mysql-test/include/rpl_connection_slave1.inc new file mode 100644 index 00000000000..8aee6defbdd --- /dev/null +++ b/mysql-test/include/rpl_connection_slave1.inc @@ -0,0 +1,2 @@ +let $rpl_connection_name= slave1; +source include/rpl_connection.inc; \ No newline at end of file diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result index 2e9522e8947..ff0061f264b 100644 --- a/mysql-test/suite/rpl/r/rpl_stop_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result @@ -128,5 +128,47 @@ START SLAVE SQL_THREAD; include/wait_for_slave_sql_to_start.inc # Test end SET GLOBAL debug= '$debug_save'; +include/restart_slave.inc +[connection master] DROP TABLE t1, t2; + +# Bug#58546 test rpl_packet timeout failure sporadically on PB +# ---------------------------------------------------------------------- +# STOP SLAVE stopped IO thread first and then stopped SQL thread. It was +# possible that IO thread stopped after replicating part of a transaction +# which SQL thread was executing. SQL thread would be hung if the +# transaction could not be rolled back safely. +# It caused some sporadic failures on PB2. +# +# This test verifies that when 'STOP SLAVE' is issued by a user, IO +# thread will continue to fetch the rest events of the transaction which +# is being executed by SQL thread and is not able to be rolled back safely. +CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB; +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES(1, 1); +SET GLOBAL debug= 'd,dump_thread_wait_before_send_xid'; +[connection slave] +include/restart_slave.inc +BEGIN; +UPDATE t1 SET c2 = 2 WHERE c1 = 1; +[connection master] +BEGIN; +INSERT INTO t1 VALUES(2, 2); +INSERT INTO t2 VALUES(1); +UPDATE t1 SET c2 = 3 WHERE c1 = 1; +COMMIT; +[connection slave1] +STOP SLAVE; +[connection slave] +ROLLBACK; +[connection master] +SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'RESET'; +[connection slave] +include/wait_for_slave_to_stop.inc +[connection slave1] +include/start_slave.inc +[connection master] +DROP TABLE t1, t2; +SET GLOBAL debug= $debug_save; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test index b11bd0a227e..3197b6160cd 100644 --- a/mysql-test/suite/rpl/t/rpl_packet.test +++ b/mysql-test/suite/rpl/t/rpl_packet.test @@ -26,8 +26,8 @@ let $old_net_buffer_length= `SELECT @@global.net_buffer_length`; SET @@global.max_allowed_packet=1024; SET @@global.net_buffer_length=1024; +sync_slave_with_master; # Restart slave for setting to take effect -connection slave; source include/stop_slave.inc; source include/start_slave.inc; diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test index e7c67448dbe..e44b2f15f25 100644 --- a/mysql-test/suite/rpl/t/rpl_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test @@ -54,7 +54,69 @@ source extra/rpl_tests/rpl_stop_slave.test; --echo # Test end SET GLOBAL debug= '$debug_save'; +source include/restart_slave_sql.inc; -connection master; +--source include/rpl_connection_master.inc DROP TABLE t1, t2; + +--echo +--echo # Bug#58546 test rpl_packet timeout failure sporadically on PB +--echo # ---------------------------------------------------------------------- +--echo # STOP SLAVE stopped IO thread first and then stopped SQL thread. It was +--echo # possible that IO thread stopped after replicating part of a transaction +--echo # which SQL thread was executing. SQL thread would be hung if the +--echo # transaction could not be rolled back safely. +--echo # It caused some sporadic failures on PB2. +--echo # +--echo # This test verifies that when 'STOP SLAVE' is issued by a user, IO +--echo # thread will continue to fetch the rest events of the transaction which +--echo # is being executed by SQL thread and is not able to be rolled back safely. + +CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB; +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES(1, 1); + +let $debug_save= `SELECT @@GLOBAL.debug`; +SET GLOBAL debug= 'd,dump_thread_wait_before_send_xid'; + +sync_slave_with_master; + +--source include/rpl_connection_slave.inc +source include/restart_slave_sql.inc; + +BEGIN; +UPDATE t1 SET c2 = 2 WHERE c1 = 1; + +--source include/rpl_connection_master.inc +BEGIN; +INSERT INTO t1 VALUES(2, 2); +INSERT INTO t2 VALUES(1); +UPDATE t1 SET c2 = 3 WHERE c1 = 1; +COMMIT; + +--source include/rpl_connection_slave1.inc +let $show_statement= SHOW PROCESSLIST; +let $field= Info; +let $condition= = 'UPDATE t1 SET c2 = 3 WHERE c1 = 1'; +source include/wait_show_condition.inc; + +send STOP SLAVE; + +--source include/rpl_connection_slave.inc +ROLLBACK; + +--source include/rpl_connection_master.inc +SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_connection_slave.inc +source include/wait_for_slave_to_stop.inc; + +--source include/rpl_connection_slave1.inc +reap; +source include/start_slave.inc; + +--source include/rpl_connection_master.inc +DROP TABLE t1, t2; +SET GLOBAL debug= $debug_save; --source include/rpl_end.inc diff --git a/sql/slave.cc b/sql/slave.cc index 96319de5427..0e74d0ce3c0 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -408,17 +408,6 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) int error,force_all = (thread_mask & SLAVE_FORCE_ALL); pthread_mutex_t *sql_lock = &mi->rli.run_lock, *io_lock = &mi->run_lock; - if (thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)) - { - DBUG_PRINT("info",("Terminating IO thread")); - mi->abort_slave=1; - if ((error=terminate_slave_thread(mi->io_thd, io_lock, - &mi->stop_cond, - &mi->slave_running, - skip_lock)) && - !force_all) - DBUG_RETURN(error); - } if (thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)) { DBUG_PRINT("info",("Terminating SQL thread")); @@ -430,6 +419,17 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) !force_all) DBUG_RETURN(error); } + if (thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)) + { + DBUG_PRINT("info",("Terminating IO thread")); + mi->abort_slave=1; + if ((error=terminate_slave_thread(mi->io_thd, io_lock, + &mi->stop_cond, + &mi->slave_running, + skip_lock)) && + !force_all) + DBUG_RETURN(error); + } DBUG_RETURN(0); } diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index cb5aac863c0..0ade0b759d5 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -21,6 +21,7 @@ #include "log_event.h" #include "rpl_filter.h" #include +#include "debug_sync.h" int max_binlog_dump_events = 0; // unlimited my_bool opt_sporadic_binlog_dump_fail = 0; @@ -556,6 +557,20 @@ impossible position"; } #endif + DBUG_EXECUTE_IF("dump_thread_wait_before_send_xid", + { + if ((*packet)[EVENT_TYPE_OFFSET+1] == XID_EVENT) + { + net_flush(net); + const char act[]= + "now " + "wait_for signal.continue"; + DBUG_ASSERT(opt_debug_sync_timeout > 0); + DBUG_ASSERT(!debug_sync_set_action(current_thd, + STRING_WITH_LEN(act))); + } + }); + if ((*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT) { binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+1] & @@ -572,6 +587,14 @@ impossible position"; goto err; } + DBUG_EXECUTE_IF("dump_thread_wait_before_send_xid", + { + if ((*packet)[EVENT_TYPE_OFFSET+1] == XID_EVENT) + { + net_flush(net); + } + }); + DBUG_PRINT("info", ("log event code %d", (*packet)[LOG_EVENT_OFFSET+1] )); if ((*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT) From a481d70a6ea201e0d2bf965a39d415d5de0230c8 Mon Sep 17 00:00:00 2001 From: Anitha Gopi Date: Tue, 18 Jan 2011 23:21:39 +0530 Subject: [PATCH 26/26] Bug#47449: This problem not seen in PB2. Remove from experimental group --- mysql-test/collections/default.experimental | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 298205e1b7d..7ffc88745ea 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -10,7 +10,6 @@ innodb.innodb_information_schema # Bug#48883 2010-05-11 alik Test "innod main.func_math @freebsd # Bug#43020 2010-05-04 alik main.func_math fails on FreeBSD in PB2 main.gis # Bug#52208 2010-11-24 alik gis fails on some platforms (Solaris, HP-UX, Linux) main.gis-rtree @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server -main.information_schema # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible) main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun