summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSven Sandberg <sven@mysql.com>2008-11-13 20:19:00 +0100
committerSven Sandberg <sven@mysql.com>2008-11-13 20:19:00 +0100
commitca59e88ce37b259fe236e6a727e13b5e9dfff7e5 (patch)
treed881394b59ab8bbf9dcac97d407836c0d13335c4 /mysql-test
parentca2d1846950b07115a001a37d84ce63ab2acdc6c (diff)
downloadmariadb-git-ca59e88ce37b259fe236e6a727e13b5e9dfff7e5.tar.gz
BUG#38350: Many tests don't clean up after themselves on exit.
Problem: Many test cases don't clean up after themselves (fail to drop tables or fail to reset variables). This implies that: (1) check-testcase in the new mtr that currently lives in 5.1-rpl failed. (2) it may cause unexpected results in subsequent tests. Fix: make all tests clean up. Also: cleaned away unnecessary output in rpl_packet.result Also: fixed bug where rpl_log called RESET MASTER with a running slave. This is not supposed to work. Also: removed unnecessary code from rpl_stm_EE_err2 and made it verify that an error occurred. Also: removed unnecessary code from rpl_ndb_ctype_ucs2_def. mysql-test/extra/rpl_tests/rpl_loaddata.test: Made test clean up after itself. mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test: Made test clean up after itself. Also removed unnecessary save_master_pos. Also made test verify that an error occurred. mysql-test/extra/rpl_tests/rpl_truncate_helper.test: Made test clean up after itself. mysql-test/include/query_cache.inc: Made test clean up after itself. mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test: Made test clean up after itself. mysql-test/suite/rpl/t/rpl_alter_db.test: Made test clean up after itself. Easiest to refactor the test a little, to use an auxiliary database instead of mysql: Then we don't need to read the collation at the start of the test and reset it at the end of the test. We can just drop the database. mysql-test/suite/rpl/t/rpl_drop_db.test: Made test clean up after itself. mysql-test/suite/rpl/t/rpl_drop_view.test: Made test clean up after itself. mysql-test/suite/rpl/t/rpl_events.test: Made test clean up after itself. mysql-test/suite/rpl/t/rpl_idempotency.test: Made test clean up after itself. mysql-test/suite/rpl/t/rpl_ignore_table.test: Made test clean up after itself. The existing cleanup code didn't work, because the --replicate-* options prevented the "drop table" from being replicated. Moved "drop table t4" to a statement of its own. mysql-test/suite/rpl/t/rpl_packet.test: Made test clean up after itself. Also replaced SHOW SLAVE STATUS by query_get_value(SHOW SLAVE STATUS...), since only one column of the result was interesting. mysql-test/suite/rpl/t/rpl_row_max_relay_size.test: Made test clean up after itself. Instead of setting binlog format at the beginning of the test, we just do 'source include/have_binlog_format_row.inc' like all other tests. mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test: Made test clean up after itself. mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test: Made test clean up after itself. Also removed unnecessary 'create table; drop table' Also removed unnecessary use of --command mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test: Made test clean up after itself. mysql-test/t/innodb-autoinc-optimize.test: Made test clean up after itself. mysql-test/t/innodb.test: Made test clean up after itself. mysql-test/t/log_tables.test: Made test clean up after itself. mysql-test/t/mysql_client_test.test: Made test clean up after itself. mysql-test/t/partition.test: Made test clean up after itself. mysql-test/t/status.test: Made test clean up after itself.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/extra/rpl_tests/rpl_loaddata.test7
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test9
-rw-r--r--mysql-test/extra/rpl_tests/rpl_truncate_helper.test5
-rw-r--r--mysql-test/include/query_cache.inc1
-rw-r--r--mysql-test/r/cache_innodb.result1
-rw-r--r--mysql-test/r/innodb-autoinc-optimize.result2
-rw-r--r--mysql-test/r/innodb.result2
-rw-r--r--mysql-test/r/log_tables.result25
-rw-r--r--mysql-test/r/mysql_client_test.result2
-rw-r--r--mysql-test/r/partition.result2
-rw-r--r--mysql-test/r/status.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result2
-rw-r--r--mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test6
-rw-r--r--mysql-test/suite/rpl/r/rpl_alter_db.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_drop_db.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_drop_view.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_events.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_idempotency.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_table.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_packet.result45
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_max_relay_size.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_EE_err2.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_truncate_2myisam.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_truncate_3innodb.result24
-rw-r--r--mysql-test/suite/rpl/t/rpl_alter_db.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_db.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_view.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_events.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_idempotency.test13
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet.test20
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_max_relay_size.test7
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result4
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result2
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test2
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test11
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test5
-rw-r--r--mysql-test/t/innodb-autoinc-optimize.test3
-rw-r--r--mysql-test/t/innodb.test2
-rw-r--r--mysql-test/t/log_tables.test28
-rw-r--r--mysql-test/t/mysql_client_test.test3
-rw-r--r--mysql-test/t/partition.test5
-rw-r--r--mysql-test/t/status.test7
45 files changed, 223 insertions, 124 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test
index 040d8a7aa7c..26916642cae 100644
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test
@@ -146,10 +146,9 @@ terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
-drop table t2;
+drop table t1, t2;
connection master;
-drop table t2;
-drop table t1;
+drop table t1, t2;
# BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
@@ -157,8 +156,6 @@ CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
--error ER_DUP_ENTRY
LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
---disable_warnings
DROP TABLE IF EXISTS t1;
---enable_warnings
# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
index 3304a0ff46d..2c396c9a209 100644
--- a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
+++ b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
@@ -18,13 +18,18 @@ eval create table t1 (a int, unique(a)) engine=$engine_type;
set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
-save_master_pos;
+
--error ER_DUP_ENTRY
insert into t1 values(1),(2);
drop table t1;
-save_master_pos;
+
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
+let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
+let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
+--echo Error: "$error" (expected different error codes on master and slave)
+--echo Errno: "$errno" (expected 0)
+drop table t1;
# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
index 76db74acfa1..eb0729e4921 100644
--- a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
+++ b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
@@ -14,6 +14,9 @@ START SLAVE;
--echo **** On Master ****
connection master;
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
+
eval SET SESSION BINLOG_FORMAT=$format;
eval SET GLOBAL BINLOG_FORMAT=$format;
@@ -40,3 +43,5 @@ source include/show_binlog_events.inc;
connection master;
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc
index fdd6bc50eae..77ea0021a5d 100644
--- a/mysql-test/include/query_cache.inc
+++ b/mysql-test/include/query_cache.inc
@@ -176,6 +176,7 @@ show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
# Final cleanup
+eval set GLOBAL query_cache_size=$save_query_cache_size;
connection default;
drop table t2;
disconnect connection1;
diff --git a/mysql-test/r/cache_innodb.result b/mysql-test/r/cache_innodb.result
index 17cfcd69ec3..f2067e967f2 100644
--- a/mysql-test/r/cache_innodb.result
+++ b/mysql-test/r/cache_innodb.result
@@ -218,4 +218,5 @@ Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 2
+set GLOBAL query_cache_size=1048576;
drop table t2;
diff --git a/mysql-test/r/innodb-autoinc-optimize.result b/mysql-test/r/innodb-autoinc-optimize.result
index 2896411a42f..c6da43555b2 100644
--- a/mysql-test/r/innodb-autoinc-optimize.result
+++ b/mysql-test/r/innodb-autoinc-optimize.result
@@ -5,3 +5,5 @@ optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
+==== clean up ====
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 5f8c59b9a0c..27a79a18493 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1781,6 +1781,7 @@ set global innodb_sync_spin_loops=20;
show variables like "innodb_sync_spin_loops";
Variable_name Value
innodb_sync_spin_loops 20
+SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 8
@@ -1798,6 +1799,7 @@ set global innodb_thread_concurrency=16;
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 16
+SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency;
show variables like "innodb_concurrency_tickets";
Variable_name Value
innodb_concurrency_tickets 500
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index 28b245a0263..376120abcda 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -1,3 +1,8 @@
+SET @old_general_log_state = @@global.general_log;
+SET @old_log_output= @@global.log_output;
+SET @old_slow_query_log= @@global.slow_query_log;
+SET @old_general_log= @@global.general_log;
+SET @old_long_query_time= @@session.long_query_time;
use mysql;
SET @saved_long_query_time = @@long_query_time;
SET @saved_log_output = @@log_output;
@@ -365,7 +370,6 @@ slow_log
slow_log_new
drop table slow_log_new, general_log_new;
use test;
-SET @saved_log_output= @@global.log_output;
SET GLOBAL LOG_OUTPUT = 'TABLE';
SET GLOBAL general_log = 0;
FLUSH LOGS;
@@ -433,8 +437,8 @@ SET SESSION long_query_time =@saved_long_query_time;
FLUSH LOGS;
ALTER TABLE mysql.slow_log DROP COLUMN seq;
ALTER TABLE mysql.slow_log ENGINE = CSV;
-SET GLOBAL general_log = @saved_general_log;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
+SET GLOBAL general_log = @old_general_log;
+SET GLOBAL slow_query_log = @old_slow_query_log;
drop procedure if exists proc25422_truncate_slow;
drop procedure if exists proc25422_truncate_general;
drop procedure if exists proc25422_alter_slow;
@@ -625,8 +629,8 @@ DROP TABLE `db_17876.general_log_data`;
DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
DROP DATABASE IF EXISTS `db_17876`;
-SET GLOBAL general_log = @saved_general_log;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
+SET GLOBAL general_log = @old_general_log;
+SET GLOBAL slow_query_log = @old_slow_query_log;
select CONNECTION_ID() into @thread_id;
truncate table mysql.general_log;
set global general_log = on;
@@ -842,7 +846,7 @@ Query execute long_query using @lparam
Execute select '000 001 002 003 004 005 006 007 008 009010 011 012 013 014 015 016 017 018 019020 021 022 023 024 025 026 027 028 029030 031 032 033 034 035 036 037 038 039040 041 042 043 044 045 046 047 048 049050 051 052 053 054 055 056 057 058 059060 061 062 063 064 065 066 067 068 069070 071 072 073 074 075 076 077 078 079080 081 082 083 084 085 086 087 088 089090 091 092 093 094 095 096 097 098 099100 101 102 103 104 105 106 107 108 109110 111 112 113 114 115 116 117 118 119120 121 122 123 124 125 126 127 128 129130 131 132 133 134 135 136 137 138 139140 141 142 143 144 145 146 147 148 149150 151 152 153 154 155 156 157 158 159160 161 162 163 164 165 166 167 168 169170 171 172 173 174 175 176 177 178 179180 181 182 183 184 185 186 187 188 189190 191 192 193 194 195 196 197 198 199200 201 202 203 204 205 206 207 208 209210 211 212 213 214 215 216 217 218 219220 221 222 223 224 225 226 227 228 229230 231 232 233 234 235 236 237 238 239240 241 242 243 244 245 246 247 248 249250 251 252 253 254 255 256 257 258 259260 261 262 263 264 265 266 267 268 269270 271 272 273 274 275 276 277 278 279280 281 282 283 284 285 286 287 288 289290 291 292 293 294 295 296 297 298 299300 301 302 303 304 305 306 307 308 309310 311 312 313 314 315 316 317 318 319320 321 322 323 324 325 326 327 328 329330 331 332 333 334 335 336 337 338 339340 341 342 343 344 345 346 347 348 349350 351 352 353 354 355 356 357 358 359360 361 362 363 364 365 366 367 368 369370 371 372 373 374 375 376 377 378 379380 381 382 383 384 385 386 387 388 389390 391 392 393 394 395 396 397 398 399400 401 402 403 404 405 406 407 408 409410 411 412 413 414 415 416 417 418 419420 421 422 423 424 425 426 427 428 429430 431 432 433 434 435 436 437 438 439440 441 442 443 444 445 446 447 448 449450 451 452 453 454 455 456 457 458 459460 461 462 463 464 465 466 467 468 469470 471 472 473 474 475 476 477 478 479480 481 482 483 484 485 486 487 488 489490 491 492 493 494 495 496 497 498 499500 501 502 503 504 505 506 507 508 509510 511 512 513 514 515 516 517 518 519520 521 522 523 524 525 526 527 528 529530 531 532 533 534 535 536 537 538 539540 541 542 543 544 545 546 547 548 549550 551 552 553 554 555 556 557 558 559560 561 562 563 564 565 566 567 568 569570 571 572 573 574 575 576 577 578 579580 581 582 583 584 585 586 587 588 589590 591 592 593 594 595 596 597 598 599600 601 602 603 604 605 606 607 608 609610 611 612 613 614 615 616 617 618 619620 621 622 623 624 625 626 627 628 629630 631 632 633 634 635 636 637 638 639640 641 642 643 644 645 646 647 648 649650 651 652 653 654 655 656 657 658 659660 661 662 663 664 665 666 667 668 669670 671 672 673 674 675 676 677 678 679680 681 682 683 684 685 686 687 688 689690 691 692 693 694 695 696 697 698 699700 701 702 703 704 705 706 707 708 709710 711 712 713 714 715 716 717 718 719720 721 722 723 724 725 726 727 728 729730 731 732 733 734 735 736 737 738 739740 741 742 743 744 745 746 747 748 749750 751 752 753 754 755 756 757 758 759760 761 762 763 764 765 766 767 768 769770 771 772 773 774 775 776 777 778 779780 781 782 783 784 785 786 787 788 789790 791 792 793 794 795 796 797 798 799800 801 802 803 804 805 806 807 808 809810 811 812 813 814 815 816 817 818 819820 821 822 823 824 825 826 827 828 829830 831 832 833 834 835 836 837 838 839840 841 842 843 844 845 846 847 848 849850 851 852 853 854 855 856 857 858 859860 861 862 863 864 865 866 867 868 869870 871 872 873 874 875 876 877 878 879880 881 882 883 884 885 886 887 888 889890 891 892 893 894 895 896 897 898 899900 901 902 903 904 905 906 907 908 909910 911 912 913 914 915 916 917 918 919920 921 922 923 924 925 926 927 928 929930 931 932 933 934 935 936 937 938 939940 941 942 943 944 945 946 947 948 949950 951 952 953 954 955 956 957 958 959960 961 962 963 964 965 966 967 968 969970 971 972 973 974 975 976 977 978 979980 981 982 983 984 985 986 987 988 989990 991 992 993 994 995 996 997 998 999' as long_query
Query set global general_log = off
deallocate prepare long_query;
-set global general_log = @saved_general_log;
+set global general_log = @old_general_log;
DROP TABLE IF EXISTS log_count;
DROP TABLE IF EXISTS slow_log_copy;
DROP TABLE IF EXISTS general_log_copy;
@@ -895,8 +899,7 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
-SET GLOBAL log_output= @saved_log_output;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
-SET GLOBAL general_log=@saved_general_log;
-SET SESSION long_query_time =@saved_long_query_time;
-SET GLOBAL LOG_OUTPUT = @saved_log_output;
+SET @@session.long_query_time= @old_long_query_time;
+SET @@global.log_output= @old_log_output;
+SET @@global.slow_query_log= @old_slow_query_log;
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/r/mysql_client_test.result b/mysql-test/r/mysql_client_test.result
index 9766475a418..08d982c85e3 100644
--- a/mysql-test/r/mysql_client_test.result
+++ b/mysql-test/r/mysql_client_test.result
@@ -1 +1,3 @@
+SET @old_general_log= @@global.general_log;
ok
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index adb055dd5e5..7a62001987f 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1,3 +1,4 @@
+SET @old_general_log= @@global.general_log;
drop table if exists t1, t2;
CREATE TABLE t1 (a INT NOT NULL, KEY(a))
PARTITION BY RANGE(a)
@@ -1895,3 +1896,4 @@ count(*)
288
drop table t1;
End of 5.1 tests
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result
index 1e758ce68c7..b6ac5f34f00 100644
--- a/mysql-test/r/status.result
+++ b/mysql-test/r/status.result
@@ -209,4 +209,6 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table '
drop database db37908;
drop procedure proc37908;
drop function func37908;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+DROP USER mysqltest_1@localhost;
set @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result
index 68f1f0b2566..8df0568a755 100644
--- a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result
+++ b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result
@@ -1,3 +1,4 @@
+SET @old_relay_log_purge= @@global.relay_log_purge;
change master to
MASTER_HOST='dummy.localdomain',
RELAY_LOG_FILE='slave-relay-bin.000001',
@@ -37,3 +38,4 @@ DROP PROCEDURE IF EXISTS p2;
DROP FUNCTION IF EXISTS f1;
DROP TRIGGER IF EXISTS tr1;
stop slave sql_thread;
+SET @@global.relay_log_purge= @old_relay_log_purge;
diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test
index a74de7ad3c6..f20cc33f820 100644
--- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test
+++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test
@@ -17,6 +17,10 @@
source include/have_log_bin.inc;
+# Need to restore this at the end; CHANGE MASTER modifies it (see the
+# manual for CHANGE MASTER).
+SET @old_relay_log_purge= @@global.relay_log_purge;
+
let $MYSQLD_DATADIR= `select @@datadir`;
copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLD_DATADIR/slave-relay-bin.000001;
@@ -51,6 +55,6 @@ enable_warnings;
remove_file $MYSQLD_DATADIR/slave-relay-bin.000001;
remove_file $MYSQLD_DATADIR/slave-relay-bin.index;
stop slave sql_thread;
-let $slave_keep_connection=1;
source include/wait_for_slave_sql_to_stop.inc;
+SET @@global.relay_log_purge= @old_relay_log_purge;
diff --git a/mysql-test/suite/rpl/r/rpl_alter_db.result b/mysql-test/suite/rpl/r/rpl_alter_db.result
index 6edbe5d427f..60c07d0dede 100644
--- a/mysql-test/suite/rpl/r/rpl_alter_db.result
+++ b/mysql-test/suite/rpl/r/rpl_alter_db.result
@@ -4,5 +4,9 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-use mysql;
+==== Verify that alter database does not stop replication ====
+create database temp_db;
+use temp_db;
alter database collate latin1_bin;
+==== Clean up ====
+drop database temp_db;
diff --git a/mysql-test/suite/rpl/r/rpl_drop_db.result b/mysql-test/suite/rpl/r/rpl_drop_db.result
index c0efdf5290d..8825797f80d 100644
--- a/mysql-test/suite/rpl/r/rpl_drop_db.result
+++ b/mysql-test/suite/rpl/r/rpl_drop_db.result
@@ -31,8 +31,7 @@ use test;
select * from t1;
n
1234
-stop slave;
-drop database mysqltest1;
-drop database mysqltest1;
use test;
drop table t1;
+drop database mysqltest1;
+include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_drop_view.result b/mysql-test/suite/rpl/r/rpl_drop_view.result
index ef625464881..c359011612a 100644
--- a/mysql-test/suite/rpl/r/rpl_drop_view.result
+++ b/mysql-test/suite/rpl/r/rpl_drop_view.result
@@ -25,3 +25,5 @@ select * from v2;
ERROR 42S02: Table 'test.v2' doesn't exist
select * from v3;
ERROR 42S02: Table 'test.v3' doesn't exist
+==== clean up ====
+drop table t1, t2, t3;
diff --git a/mysql-test/suite/rpl/r/rpl_events.result b/mysql-test/suite/rpl/r/rpl_events.result
index 03d9ca75a77..b797183f9d2 100644
--- a/mysql-test/suite/rpl/r/rpl_events.result
+++ b/mysql-test/suite/rpl/r/rpl_events.result
@@ -1,10 +1,11 @@
-set global event_scheduler=1;
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;
+SET @old_event_scheduler = @@global.event_scheduler;
+set global event_scheduler=1;
set binlog_format=row;
DROP EVENT IF EXISTS test.justonce;
drop table if exists t1,t2;
@@ -190,4 +191,5 @@ select * from t28953;
END;|
ALTER EVENT event1 RENAME TO event2;
DROP EVENT event2;
+SET @@global.event_scheduler= @old_event_scheduler;
DROP TABLE t28953;
diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result
index 0930904626b..f39d0f1f37f 100644
--- a/mysql-test/suite/rpl/r/rpl_idempotency.result
+++ b/mysql-test/suite/rpl/r/rpl_idempotency.result
@@ -6,6 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032");
call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452");
+SET @old_slave_exec_mode= @@global.slave_exec_mode;
CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT);
INSERT INTO t1 VALUES (-1),(-2),(-3);
@@ -222,7 +223,7 @@ Last_SQL_Error
0
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
-set global slave_exec_mode='STRICT';
+SET @@global.slave_exec_mode= @old_slave_exec_mode;
set @@session.binlog_format= @save_binlog_format;
drop table t1,t2,ti2,ti1;
*** end of tests
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result
index cdc3f5e9579..e77be425270 100644
--- a/mysql-test/suite/rpl/r/rpl_ignore_table.result
+++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result
@@ -116,7 +116,8 @@ show grants for mysqltest4@localhost;
Grants for mysqltest4@localhost
GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
set global slave_exec_mode='IDEMPOTENT';
-drop table t1, t4, mysqltest2.t2;
+drop table t1, mysqltest2.t2;
+drop table t4;
drop database mysqltest2;
delete from mysql.user where user like "mysqltest%";
delete from mysql.db where user like "mysqltest%";
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result
index 1a34638ca5c..d7a02bc84a5 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata.result
@@ -80,9 +80,8 @@ load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
-drop table t2;
-drop table t2;
-drop table t1;
+drop table t1, t2;
+drop table t1, t2;
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY'
diff --git a/mysql-test/suite/rpl/r/rpl_packet.result b/mysql-test/suite/rpl/r/rpl_packet.result
index 68173b0730c..816e0f3df62 100644
--- a/mysql-test/suite/rpl/r/rpl_packet.result
+++ b/mysql-test/suite/rpl/r/rpl_packet.result
@@ -31,42 +31,9 @@ include/stop_slave.inc
include/start_slave.inc
CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running No
-Slave_SQL_Running #
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
+Slave_IO_Running = No (expect No)
+==== clean up ====
+DROP TABLE t1;
+SET @@global.max_allowed_packet= 1024;
+SET @@global.net_buffer_length= 1024;
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
index 392f5904233..2215b34814e 100644
--- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
+++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
@@ -1,5 +1,3 @@
-SET SESSION BINLOG_FORMAT=ROW;
-SET GLOBAL BINLOG_FORMAT=ROW;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
index 13aa45d8ced..e69952787fb 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
@@ -11,3 +11,6 @@ set sql_log_bin=1;
insert into t1 values(1),(2);
ERROR 23000: Duplicate entry '2' for key 'a'
drop table t1;
+Error: "Query caused different errors on master and slave. Error on master: 'Duplicate entry '%-.192s' for key %d' (1062), Error on slave: 'no error' (0). Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave)
+Errno: "0" (expected 0)
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result
index 1ae98706975..92e13064856 100644
--- a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result
@@ -10,6 +10,8 @@ DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET GLOBAL BINLOG_FORMAT=STATEMENT;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -42,12 +44,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -80,12 +86,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -121,12 +131,16 @@ master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET GLOBAL BINLOG_FORMAT=STATEMENT;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -159,12 +173,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
master-bin.000001 # Query # # use `test`; DELETE FROM t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -197,12 +215,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
master-bin.000001 # Query # # use `test`; DELETE FROM t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -242,3 +264,5 @@ master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
diff --git a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result
index 728b8450314..94461c33c46 100644
--- a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result
@@ -10,6 +10,8 @@ DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET GLOBAL BINLOG_FORMAT=STATEMENT;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -46,12 +48,16 @@ master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -88,12 +94,16 @@ master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -131,12 +141,16 @@ master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET GLOBAL BINLOG_FORMAT=STATEMENT;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -173,12 +187,16 @@ master-bin.000001 # Query # # use `test`; DELETE FROM t1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -215,12 +233,16 @@ master-bin.000001 # Query # # use `test`; DELETE FROM t1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -260,3 +282,5 @@ master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
diff --git a/mysql-test/suite/rpl/t/rpl_alter_db.test b/mysql-test/suite/rpl/t/rpl_alter_db.test
index 5ac8a2f4018..341496350d7 100644
--- a/mysql-test/suite/rpl/t/rpl_alter_db.test
+++ b/mysql-test/suite/rpl/t/rpl_alter_db.test
@@ -1,10 +1,14 @@
source include/master-slave.inc;
-connection master;
-use mysql; # to be different from initial `test' db of mysqltest client
-alter database collate latin1_bin;
-save_master_pos;
-connection slave;
-sync_with_master;
+--echo ==== Verify that alter database does not stop replication ====
+create database temp_db;
+use temp_db; # to be different from initial `test' db of mysqltest client
+alter database collate latin1_bin;
+sync_slave_with_master;
+
+--echo ==== Clean up ====
+connection master;
+drop database temp_db;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test
index 6aab1aec188..11e93e7307a 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_db.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_db.test
@@ -47,16 +47,15 @@ use test;
select * from t1;
#cleanup
-connection slave;
-stop slave;
-drop database mysqltest1;
-
connection master;
+
# Remove the "extra" file created above
let $MYSQLD_DATADIR= `select @@datadir`;
---remove_file $MYSQLD_DATADIR/mysqltest1/f1.txt
-drop database mysqltest1;
+remove_file $MYSQLD_DATADIR/mysqltest1/f1.txt;
use test;
drop table t1;
+drop database mysqltest1;
+sync_slave_with_master;
+source include/stop_slave.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_drop_view.test b/mysql-test/suite/rpl/t/rpl_drop_view.test
index 8d826b8214d..11633a0a7e8 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_view.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_view.test
@@ -29,3 +29,8 @@ select * from v1;
select * from v2;
--error 1146
select * from v3;
+
+--echo ==== clean up ====
+connection master;
+drop table t1, t2, t3;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test
index 2a9cf86fe55..d06a3118389 100644
--- a/mysql-test/suite/rpl/t/rpl_events.test
+++ b/mysql-test/suite/rpl/t/rpl_events.test
@@ -5,11 +5,12 @@
# in both row based and statement based format #
##################################################################
-set global event_scheduler=1;
-
--source include/not_embedded.inc
--source include/master-slave.inc
+SET @old_event_scheduler = @@global.event_scheduler;
+set global event_scheduler=1;
+
let $engine_type= MyISAM;
set binlog_format=row;
@@ -51,5 +52,6 @@ sync_slave_with_master;
# that there is no bad timing cauing it to try to access the table.
connection master;
+SET @@global.event_scheduler= @old_event_scheduler;
DROP TABLE t28953;
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test
index 8c571fa1a5b..1946aa100ab 100644
--- a/mysql-test/suite/rpl/t/rpl_idempotency.test
+++ b/mysql-test/suite/rpl/t/rpl_idempotency.test
@@ -11,6 +11,8 @@ source include/have_innodb.inc;
call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032");
call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452");
+SET @old_slave_exec_mode= @@global.slave_exec_mode;
+
connection master;
CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT);
@@ -388,7 +390,7 @@ start slave sql_thread;
connection master;
sync_slave_with_master;
#connection slave;
-set global slave_exec_mode='STRICT';
+SET @@global.slave_exec_mode= @old_slave_exec_mode;
# cleanup for bug#31609 tests
@@ -399,12 +401,3 @@ drop table t1,t2,ti2,ti1;
--source include/master-slave-end.inc
--echo *** end of tests
-
-
-
-
-
-
-
-
-
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test
index 7f13b16b0de..66f96e8f4e8 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_table.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test
@@ -127,7 +127,8 @@ show grants for mysqltest4@localhost;
set global slave_exec_mode='IDEMPOTENT';
connection master;
-drop table t1, t4, mysqltest2.t2;
+drop table t1, mysqltest2.t2;
+drop table t4;
drop database mysqltest2;
delete from mysql.user where user like "mysqltest%";
delete from mysql.db where user like "mysqltest%";
diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test
index 95293b1e7ac..aefae7563d4 100644
--- a/mysql-test/suite/rpl/t/rpl_packet.test
+++ b/mysql-test/suite/rpl/t/rpl_packet.test
@@ -13,6 +13,8 @@ enable_warnings;
eval create database $db;
connection master;
+let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`;
+let $old_net_buffer_length= `SELECT @@global.net_buffer_length`;
SET @@global.max_allowed_packet=1024;
SET @@global.net_buffer_length=1024;
@@ -77,10 +79,18 @@ INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# The slave I/O thread must stop after trying to read the above event
connection slave;
---source include/wait_for_slave_io_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_MYPORT
-# import is only the 11th column Slave_IO_Running
---replace_column 1 # 7 # 8 # 9 # 12 # 22 # 23 # 33 #
-query_vertical show slave status;
+--source include/wait_for_slave_io_to_stop.inc
+let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1);
+--echo Slave_IO_Running = $slave_io_running (expect No)
+
+
+--echo ==== clean up ====
+connection master;
+DROP TABLE t1;
+eval SET @@global.max_allowed_packet= $old_max_allowed_packet;
+eval SET @@global.net_buffer_length= $old_net_buffer_length;
+# slave is stopped
+connection slave;
+DROP TABLE t1;
# End of tests
diff --git a/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test b/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test
index a0be59e44a7..ea4b958ae4c 100644
--- a/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test
+++ b/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test
@@ -4,8 +4,7 @@
# Test of manual relay log rotation with FLUSH LOGS.
# Requires statement logging
--- source include/not_ndb_default.inc
-SET SESSION BINLOG_FORMAT=ROW;
-SET GLOBAL BINLOG_FORMAT=ROW;
--- source extra/rpl_tests/rpl_max_relay_size.test
+source include/not_ndb_default.inc;
+source include/have_binlog_format_row.inc;
+source extra/rpl_tests/rpl_max_relay_size.test;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result
index 84b60b599d8..28ca1ac43b9 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result
@@ -8,6 +8,7 @@ SET storage_engine=ndb;
=== NDB -> MYISAM ===
+set @old_slave_exec_mode= @@global.slave_exec_mode;
set @@global.slave_exec_mode= 'IDEMPOTENT';
CREATE TABLE mysql.ndb_apply_status
( server_id INT UNSIGNED NOT NULL,
@@ -803,3 +804,4 @@ TRUNCATE TABLE t1;
--- Do Cleanup --
DROP TABLE IF EXISTS t1;
drop table mysql.ndb_apply_status;
+set @@global.slave_exec_mode= @old_slave_exec_mode;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result
index 75151f45419..a6e2144f532 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result
@@ -11,8 +11,6 @@ show variables like "%character_set_ser%";
Variable_name Value
character_set_server ucs2
DROP TABLE IF EXISTS t1;
-create table t1 (a int) ENGINE=NDB;
-drop table t1;
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
`nom` char(4) default NULL,
`prenom` char(4) default NULL,
@@ -25,3 +23,5 @@ nid nom prenom
select * from t1 order by nid;
nid nom prenom
1 XYZ1 ABC1
+==== clean up ====
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
index 2e267bf77c1..f8eb5ebdd89 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
@@ -52,4 +52,6 @@ c1 c2 c3
row3 C 3
row4 D 4
row5 E 5
+==== clean up ====
+DROP TABLE t1;
STOP SLAVE;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test
index 99eb5d50364..41f91d62dec 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test
@@ -25,6 +25,7 @@ remove_file $datadir/mysql/ndb_apply_status.frm;
--error 0,1
remove_file $datadir/mysql/ndb_apply_status.ndb;
+set @old_slave_exec_mode= @@global.slave_exec_mode;
set @@global.slave_exec_mode= 'IDEMPOTENT';
CREATE TABLE mysql.ndb_apply_status
( server_id INT UNSIGNED NOT NULL,
@@ -46,3 +47,4 @@ SET storage_engine=innodb;
connection slave;
drop table mysql.ndb_apply_status;
+set @@global.slave_exec_mode= @old_slave_exec_mode;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test
index be7fd1acd2e..8d5ad334766 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test
@@ -22,10 +22,7 @@ show variables like "%character_set_ser%";
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
-create table t1 (a int) ENGINE=NDB;
-drop table t1;
---connection master
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
`nom` char(4) default NULL,
`prenom` char(4) default NULL,
@@ -35,8 +32,12 @@ CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
select * from t1 order by nid;
---sync_slave_with_master
+sync_slave_with_master;
# connect to slave and ensure data it there.
---connection slave
+connection slave;
select * from t1 order by nid;
+--echo ==== clean up ====
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
index 1ee9aaf5372..eb128cfa2ce 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
@@ -64,4 +64,9 @@ sync_slave_with_master;
connection slave;
SELECT * FROM t1 ORDER BY c3;
+--echo ==== clean up ====
+connection server2;
+DROP TABLE t1;
+sync_slave_with_master;
+
STOP SLAVE;
diff --git a/mysql-test/t/innodb-autoinc-optimize.test b/mysql-test/t/innodb-autoinc-optimize.test
index c7e22a8ff40..0f0cb57f92f 100644
--- a/mysql-test/t/innodb-autoinc-optimize.test
+++ b/mysql-test/t/innodb-autoinc-optimize.test
@@ -14,3 +14,6 @@ insert into t1 set a = -1;
# NOTE: The database needs to be shutdown and restarted (here) for
# the test to work. It's included for reference only.
optimize table t1;
+
+--echo ==== clean up ====
+DROP TABLE t1;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 3c2aae3cfb0..53a210e9972 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1317,6 +1317,7 @@ set global innodb_sync_spin_loops=20;
show variables like "innodb_sync_spin_loops";
# Test for innodb_thread_concurrency variable
+SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency";
@@ -1324,6 +1325,7 @@ set global innodb_thread_concurrency=0;
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=16;
show variables like "innodb_thread_concurrency";
+SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency;
# Test for innodb_concurrency_tickets variable
show variables like "innodb_concurrency_tickets";
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index 15bbab8fa4d..326914f09d9 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -7,6 +7,12 @@
# check that CSV engine was compiled in
--source include/have_csv.inc
+SET @old_general_log_state = @@global.general_log;
+SET @old_log_output= @@global.log_output;
+SET @old_slow_query_log= @@global.slow_query_log;
+SET @old_general_log= @@global.general_log;
+SET @old_long_query_time= @@session.long_query_time;
+
--disable_ps_protocol
use mysql;
@@ -462,7 +468,6 @@ use test;
# AUTO_INCREMENT numbers)
#
-SET @saved_log_output= @@global.log_output;
SET GLOBAL LOG_OUTPUT = 'TABLE';
## test the general log
@@ -526,8 +531,8 @@ FLUSH LOGS;
ALTER TABLE mysql.slow_log DROP COLUMN seq;
ALTER TABLE mysql.slow_log ENGINE = CSV;
-SET GLOBAL general_log = @saved_general_log;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
+SET GLOBAL general_log = @old_general_log;
+SET GLOBAL slow_query_log = @old_slow_query_log;
#
# Bug#25422 (Hang with log tables)
@@ -831,8 +836,8 @@ DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
DROP DATABASE IF EXISTS `db_17876`;
-SET GLOBAL general_log = @saved_general_log;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
+SET GLOBAL general_log = @old_general_log;
+SET GLOBAL slow_query_log = @old_slow_query_log;
#
# Bug#21557 entries in the general query log truncated at 1000 characters.
@@ -950,7 +955,7 @@ execute long_query using @lparam;
set global general_log = off;
select command_type, argument from mysql.general_log where thread_id = @thread_id;
deallocate prepare long_query;
-set global general_log = @saved_general_log;
+set global general_log = @old_general_log;
#
# Bug#34306: Can't make copy of log tables when server binary log is enabled
@@ -1022,9 +1027,8 @@ DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
-# RESET altered system variables before exiting the test
-SET GLOBAL log_output= @saved_log_output;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
-SET GLOBAL general_log=@saved_general_log;
-SET SESSION long_query_time =@saved_long_query_time;
-SET GLOBAL LOG_OUTPUT = @saved_log_output;
+SET @@session.long_query_time= @old_long_query_time;
+
+SET @@global.log_output= @old_log_output;
+SET @@global.slow_query_log= @old_slow_query_log;
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test
index 7667522feaf..15c0cd4ac84 100644
--- a/mysql-test/t/mysql_client_test.test
+++ b/mysql-test/t/mysql_client_test.test
@@ -1,6 +1,8 @@
# This test should work in embedded server after we fix mysqltest
-- source include/not_embedded.inc
+SET @old_general_log= @@global.general_log;
+
# We run with different binaries for normal and --embedded-server
#
# If this test fails with "command "$MYSQL_CLIENT_TEST" failed",
@@ -14,3 +16,4 @@
# End of 4.1 tests
echo ok;
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index e8df2b01a94..efa7c5f4263 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -10,6 +10,8 @@
#
--source include/have_partition.inc
+SET @old_general_log= @@global.general_log;
+
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
@@ -1898,3 +1900,6 @@ select count(*) from t1;
drop table t1;
--echo End of 5.1 tests
+
+
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index bc241423417..1d1531f8076 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -287,10 +287,15 @@ show procedure status where name ='proc37908' and 1 in (select f1 from db37908.t
--error 1142
show function status where name ='func37908' and 1 in (select func37908());
-connection root;
+connection default;
+disconnect con1;
+disconnect user1;
+disconnect root;
drop database db37908;
drop procedure proc37908;
drop function func37908;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+DROP USER mysqltest_1@localhost;
# End of 5.1 tests
# Restore global concurrent_insert value. Keep in the end of the test file.