1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
|
#Want to skip this test from daily Valgrind execution
--source include/no_valgrind_without_big.inc
--source include/not_group_replication_plugin.inc
# Adding big test option for this test.
--source include/big_test.inc
--source include/have_debug_sync.inc
################################################################################
# This test case checks if a set of properties related to the GTIDs hold
# after rotating the binary/relay logs and after crashes. The properties
# are as follows:
#
# 1. Guarantee that an event generated on the master appears everywhere.
#
# Property 1.1 The set of GTIDs generated on the master are unique and
# monotonically created.
#
# Property 1.2 The set of GTIDs generated on the master are preserved
# in the relay log after being fetched.
#
# Property 1.2 The set of GTIDs generated on the master are preserved
# in the slave's binary log after execution.
#
# 2. Guarantee that the Previous GTIDs events are correctly stored everywhere.
#
# Property 2.1 - The Previous GTIDs stored in a binary log must represent the
# set of transactions stored in the previous binary logs.
#
# Property 2.2 - The Previous GTIDs stored in a relay log must represent the
# set of complete transactions stored in the previous relay
# logs.
#
# 3. Guarantee that RESET SLAVE/RESET MASTER cleans the appropriate states.
#
# Property 3.1 - RESET SLAVE cleans the GTIDs and previous GTIDs' state
# stored in the relay log.
#
# Property 3.2 - RESET MASTER cleans the GTIDs and previous GTIDs' state
# stored in the binary log.
#
# 4. With CHANGE MASTER TO MASTER_AUTO_POSITION coordinates are not used.
#
# Property 4.1 - When MASTER_AUTO_POSITION is specified only missing data
# transactions on the slave are retrieved from the master.
#
# We check if the aforementioned properties hold after generating a set
# of transactions and rotating logs through different methods:
#
# 1. On both master and slave, rotate logs through FLUSH LOGS.
# 2. On the slave, generate spreaded events by rotating the relay log using
# FLUSH RELAY LOGS when the IO thread is in the middle of a transaction.
# On the master, rotate logs through FLUSH LOGS.
# 3. On the slave, rotate logs by restarting the server. On the master,
# rotate logs through FLUSH LOGS.
# 4. On the slave, rotate logs by start/stop. On the master, rotate logs by
# restarting the server.
# 5. RESET SLAVE must not affect its binary log. On the master, rotate logs
# by restarting the server.
# 6. On the slave, rotate logs by start/stop and calling CHANGE MASTER TO
# with MASTER_AUTO_POSITION enabled. On the master, rotate logs through
# FLUSH LOGS.
# 7. On the slave, rotate logs by start/stop and calling START SLAVE UNTIL
# GTID. On the master, rotate logs through FLUSH LOGS.
#
# We also check if the aforementioned properties hold after crashes:
#
# 8. Binary logs without Previous GTIDs are generated simulating a crash
# right after the file is created.
#
# 9. Binary logs with corrupted GTIDs are generated simulating a crash
# while writing such information into the binary log.
################################################################################
--source include/not_windows.inc
--source include/have_debug.inc
--source include/master-slave.inc
# this test case requires that certain events appear in a given
# order in the relay log. With compression, only GTID and a
# Transaction_payload event shall appear, which makes this test
# case invalid in that scenario.
--source include/not_binlog_transaction_compression_on.inc
--disable_warnings
call mtr.add_suppression("Recovery from source pos .*");
call mtr.add_suppression("Error in Log_event::read_log_event()");
call mtr.add_suppression("Failed to read information on Previous GTIDs.");
call mtr.add_suppression("Error reading GTIDs from binary log");
--enable_warnings
CREATE TABLE t1(id INTEGER) ENGINE= Innodb;
--let $master_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
--connection slave
--let $replica_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
#
# 1. This part of the test case:
#
# 1.1 - Generates a set of transactions on the master.
#
# 1.2 - Makes the slave to retrieve and apply these transactions.
#
# 1.3 - Rotates both the binary logs on the slave and master
# by calling FLUSH LOGS.
#
--echo ==== Part 1 ====
--disable_warnings
--source include/rpl_reset.inc
--enable_warnings
--let $i=1
while ($i != 5)
{
--echo ---- i=$i ----
# 1.1 - Generates a set of transactions on the master.
--connection master
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
# Check property 1.1 and 2.1.
--let $binlog= binlog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# 1.2 - Makes the slave to retrieve and apply these transactions.
--source include/sync_slave_sql_with_master.inc
--connection slave
# Check property 1.2 and 2.1.
--let $binlog= binlog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# Check property 1.3 and 2.2.
--let $binlog= relaylog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
# Check property 1.1 and 2.1.
--let $binlog= binlog
--let $server_uuid= $replica_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# 1.3 - Rotates both the binary logs on the slave and master.
FLUSH LOGS;
--connection master
FLUSH LOGS;
inc $i;
}
#
# 2. This part of the test case:
#
# 2.1 - Generates a set of transactions on the master.
#
# 2.2 - Makes the slave to retrieve these transactions and
# spread their events into two relay logs. Then apply
# the events.
#
# 2.3 - Rotates the binary log on the master
# by calling FLUSH LOGS.
#
--echo ==== Part 2 ====
# This test was designed to sync slave with the master using positions
# instead of GTIDs. However, if the test is ran with GTID_MODE=ON it
# uses GTIDs to sync the slave with the master.
# When MTS is enabled, the slave may have the GITDs of transactions
# in the GTID_EXECUTED before updating slave's applier position, and
# this situation may lead to fail in this part of the test.
# So, it is better to ignore GTIDs on sync.
--let $ignore_gtids_on_sync= 1
--disable_warnings
--source include/rpl_reset.inc
--enable_warnings
--connection slave
--source include/stop_slave.inc
--disable_warnings
--source include/start_slave.inc
--enable_warnings
--connection master
# This transaction will be the MASTER_UUID:1
BEGIN;
INSERT INTO t1 VALUES(0);
COMMIT;
--source include/sync_slave_sql_with_master.inc
--let $i=1
while ($i != 5)
{
--echo ---- i=$i ----
--source include/rpl_connection_slave.inc
--let $debug_point= pause_on_queuing_event
--source include/add_debug_point.inc
# 2.1 - Generates a set of transactions on the master.
# Each transaction will have more than three events
# depending on binlog format:
#
# GTID + QUERY(BEGIN) + QUERY(INSERT) + QUERY(INSERT) + XID
# or
# GTID + QUERY(BEGIN) + TABLE_MAP + ROWS + XID
#
# So, this part of the test will issue an "FLUSH LOCAL RELAY LOGS"
# on the slave right before queuing the fourth event of the
# transaction.
--source include/rpl_connection_master.inc
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
--let $event_counter= 3
--source include/rpl_connection_slave.inc
while ($event_counter > 0)
{
--echo Waiting for $event_counter more event(s) before flushing relaylog
# Wait for the IO thread to reach the beginning of queue_event.
SET DEBUG_SYNC='now WAIT_FOR reached_queuing_event';
# Let IO thread continue its work
SET DEBUG_SYNC= 'now SIGNAL continue_queuing_event';
--dec $event_counter
}
# Make the IO thread to create a new relaylog file while in the middle
# of a transaction.
FLUSH LOCAL RELAY LOGS;
# Wait for the IO thread to reach the beginning of queue_event.
SET DEBUG_SYNC='now WAIT_FOR reached_queuing_event';
# Make sure the test will not stop again in the beginning of queue_event.
--source include/remove_debug_point.inc
# Let IO thread continue its work
SET DEBUG_SYNC= 'now SIGNAL continue_queuing_event';
# 2.2 - Makes the slave to retrieve these transactions and
# spread their events into two relay logs. Then apply
# the events.
--source include/rpl_connection_master.inc
--source include/sync_slave_sql_with_master.inc
# Check property 2.2.
--let $binlog= relaylog
--let $server_uuid= $master_uuid
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i`
--let $gtid_ini=
--let $gtid_end=
--source extra/rpl_tests/rpl_check_gtid.inc
# 2.3 - Rotates the binary log on the master.
--connection master
FLUSH LOGS;
inc $i;
}
--let $ignore_gtids_on_sync= 0
#
# 3. This part of the test case:
#
# 3.1 - Generates a set of transactions on the master.
#
# 3.2 - Makes the slave to retrieve and apply these transactions
#
# 3.3 - Restarts the slave server to rotate binary and relay logs.
#
# 3.4 - Rotates both the binary logs on the slave and master
# by calling FLUSH LOGS.
#
--echo ==== Part 3 ====
--connection slave
--disable_warnings
--source include/rpl_reset.inc
--enable_warnings
--source include/stop_slave.inc
SET GLOBAL debug="";
--disable_warnings
--source include/start_slave.inc
--enable_warnings
--let $i=1
while ($i != 5)
{
--echo ---- i=$i ----
# 3.1 - Generates a set of transactions on the master.
--connection master
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
# 3.2 - Makes the slave to retrieve and apply these transactions.
--source include/sync_slave_sql_with_master.inc
# Check property 1.2 and 2.1.
--connection slave
--let $binlog= binlog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= 1
--let $gtid_end= 1
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# Check property 1.3 and 2.2.
--let $binlog= relaylog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= 1
--let $gtid_end= 1
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# 3.3 - Restarts the slave server to rotate binary and relay logs.
--source include/stop_slave.inc
--let $rpl_server_number= 2
--source include/rpl_restart_server.inc
--connection slave
--disable_warnings
--source include/start_slave.inc
--enable_warnings
# 3.4 - Rotates both the binary logs on the slave and master.
FLUSH LOGS;
--connection master
FLUSH LOGS;
inc $i;
}
#
# 4. This part of the test case:
#
# 4.1 - Generates a set of transactions on the master.
#
# 4.2 - Makes the slave to retrieve and apply these transactions
#
# 4.3 - Stops the slave, restart the master server and starts the
# slave to rotate both slave and master's binary and slave's
# relay logs.
#
# 4.4 - Rotates both the binary logs on the slave and master
# by calling FLUSH LOGS.
#
--echo ==== Part 4 ====
--disable_warnings
--source include/rpl_reset.inc
--enable_warnings
--let $i=1
while ($i != 5)
{
--echo ---- i=$i ----
# 4.1 - Generates a set of transactions on the master.
--connection master
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
# Check property 1.1 and 2.1.
--let $binlog= binlog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= 1
--let $gtid_end= 1
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# 4.2 - Makes the slave to retrieve and apply these transactions.
--source include/sync_slave_sql_with_master.inc
# Check property 1.2 and 2.1.
--connection slave
--let $binlog= binlog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= 1
--let $gtid_end= 1
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# Check property 1.3 and 2.2.
--let $binlog= relaylog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= 1
--let $gtid_end= 1
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# 4.3 - Stops the slave, restart the master server and starts the
# slave.
--source include/stop_slave.inc
--connection master
--let $rpl_server_number= 1
--source include/rpl_restart_server.inc
--connection slave
--disable_warnings
--source include/start_slave.inc
--enable_warnings
# 4.4 - Rotates both the binary logs on the slave and master.
FLUSH LOGS;
--connection master
FLUSH LOGS;
inc $i;
}
#
# 5. This part of the test case:
#
# 5.1 - Resets the IO Thread's state but not SQL Thread's state.
#
# 5.2 - Generates a set of transactions on the master.
#
# 5.3 - Stops the slave, restart the master server and starts the
# slave to rotate both slave and master's binary and slave's
# relay logs.
#
# 5.4 - Rotates both the binary logs on the slave and master
# by calling FLUSH LOGS.
#
--echo ==== Part 5 ====
--let $i=1
while ($i != 5)
{
--echo ---- i=$i ----
# 5.1 - Resets the IO Thread's state but not SQL Thread's state.
--connection slave
--source include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
--connection master
RESET MASTER;
--connection slave
--disable_warnings
--source include/start_slave.inc
--enable_warnings
# 5.2 - Generates a set of transactions on the master.
--connection master
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
# 5.3 - Makes the slave to retrieve and apply these transactions.
--source include/sync_slave_sql_with_master.inc
# Check property 1.2, 2.1, 3.1 and 3.2
--let $binlog= binlog
--let $server_uuid= $master_uuid
--let $gtid_set_ini=
--let $gtid_set_end=
--let $gtid_ini= 1
--let $gtid_end= 2
--source extra/rpl_tests/rpl_check_gtid.inc
# 5.4 - Rotates both the binary logs on the slave and master.
FLUSH LOGS;
--connection master
FLUSH LOGS;
inc $i;
}
#
# 6. This part of the test case:
#
# 6.1 - Generates a set of transactions on the master.
#
# 6.2 - Makes the slave to retrieve and apply these transactions through
# sync_slave_gtids_with_master
#
# 6.3 - Stop the slave, call CHANGE MASTER TO with MASTER_AUTO_POSITION and
# start the slave to rotate the relay log.
#
# 6.4 - Rotates the binary log on master by calling FLUSH LOGS.
#
--echo ==== Part 6 ====
--connection slave
--source include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
--connection master
RESET MASTER;
--connection slave
--let $slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
--error ER_BAD_REPLICA_AUTO_POSITION
CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION= 1, SOURCE_LOG_FILE= 'master-bin.000001', SOURCE_LOG_POS= 4;
--disable_warnings
--source include/start_slave.inc
--enable_warnings
--let $replica_uuid= `SELECT @@GLOBAL.SERVER_UUID`
--connection master
--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
--let $i=1
while ($i != 5)
{
--echo ---- i=$i ----
# 6.1 - Generates a set of transactions on the master.
--connection master
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
--let $wait_gtids_first= query_get_value(SHOW MASTER STATUS, Executed_Gtid_Set, 1)
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
--let $wait_gtids_second= query_get_value(SHOW MASTER STATUS, Executed_Gtid_Set, 1)
if (`SELECT ($i % 2) = 0`)
{
--connection slave
--replace_result $master_uuid MASTER_UUID $replica_uuid SLAVE_UUID
--disable_result_log
--eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$wait_gtids_first', 300)
--enable_result_log
--replace_result $master_uuid MASTER_UUID $replica_uuid SLAVE_UUID
--disable_result_log
--eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$wait_gtids_second', 300)
--enable_result_log
}
if (`SELECT ($i % 2) = 1`)
{
--connection slave
--replace_result $master_uuid MASTER_UUID $replica_uuid SLAVE_UUID
--disable_result_log
--eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$wait_gtids_first')
--enable_result_log
--replace_result $master_uuid MASTER_UUID $replica_uuid SLAVE_UUID
--disable_result_log
--eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$wait_gtids_second')
--enable_result_log
}
# Check property 4.1
--let $binlog= relaylog
--let $server_uuid= $master_uuid
--let $gtid_set_ini=
--let $gtid_set_end=
--let $gtid_ini= `SELECT ($i * 2) - 1`
--let $gtid_end= `SELECT $i * 2`
--source extra/rpl_tests/rpl_check_gtid.inc
# 6.3 - Stop and start the slave, call CHANGE MASTER TO with MASTER_AUTO_POSITION.
--source include/stop_slave.inc
--replace_result $slave_master_host SLAVE_MASTER_HOST
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST= '$slave_master_host', SOURCE_AUTO_POSITION= 1
--disable_warnings
--source include/start_slave.inc
--enable_warnings
# 6.4 - Rotates the binary log on master by calling FLUSH LOGS.
--connection master
FLUSH LOGS;
inc $i;
}
#
# 7. This part of the test case:
#
# 7.1 - Generates a set of transactions on the master.
#
# 7.2 - Makes the slave to retrieve and apply these transactions through
# START SLAVE UNTIL GTID.
#
# 7.3 - Rotates the binary log on master by calling FLUSH LOGS.
#
--echo ==== Part 7 ====
--connection slave
--source include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
--connection master
RESET MASTER;
--connection slave
--let $slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
--replace_result $slave_master_host SLAVE_MASTER_HOST
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST= '$slave_master_host', SOURCE_AUTO_POSITION= 1
--let $i=1
while ($i != 5)
{
--echo ---- i=$i ----
# 7.1 - Generates a set of transactions on the master.
--connection master
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
# 7.2 - Makes the slave to retrieve and apply these transactions.
--connection slave
--let $sequence= `SELECT ($i * 2)`
--replace_result $master_uuid MASTER_UUID
--disable_warnings
--eval START SLAVE UNTIL SQL_BEFORE_GTIDS= "$master_uuid:$sequence"
--enable_warnings
--source include/wait_for_slave_sql_to_stop.inc
--source include/stop_slave.inc
# Check property 1.2 and 4.1.
--let $binlog= binlog
--let $server_uuid= $master_uuid
--let $gtid_set_ini=
--let $gtid_set_end=
--let $gtid_ini= 1
--let $gtid_end= `SELECT ($i * 2) - 1`
--source extra/rpl_tests/rpl_check_gtid.inc
# 7.3 - Rotates the binary log on master by calling FLUSH LOGS.
--connection master
FLUSH LOGS;
inc $i;
}
#
# 8. This part of the test case:
#
# 8.1 - Generates a set of transactions on the master.
#
# 8.2 - Makes the slave to retrieve and apply these transactions
#
# 8.3 - Restarts the slave server to rotate binary and relay logs.
# However, binary logs without Previous Gtids are created.
#
# 8.4 - Rotates both the binary logs on the slave and master
# by calling FLUSH LOGS.
#
--echo ==== Part 8 ====
--connection slave
--source include/stop_slave.inc
RESET MASTER;
RESET SLAVE;
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST= '$slave_master_host', SOURCE_AUTO_POSITION= 0
--connection master
RESET MASTER;
--connection slave
--disable_warnings
--source include/start_slave.inc
--enable_warnings
--let $i=1
while ($i != 5)
{
--echo ---- i=$i ----
# 8.1 - Generates a set of transactions on the master.
--connection master
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
# 8.2 - Makes the slave to retrieve and apply these transactions.
--source include/sync_slave_sql_with_master.inc
# Check property 1.2 and 2.1.
--connection slave
--let $binlog= binlog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= 1
--let $gtid_end= 1
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# Check property 1.3 and 2.2.
--let $binlog= relaylog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= 1
--let $gtid_end= 1
}
# Post relay log recovery the previous GTIDs set should
# be empty.
if ($i != 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# 8.3 - Restarts the slave server to rotate binary and relay logs.
--source include/stop_slave.inc
--let $rpl_server_number= 2
--let $rpl_server_parameters= --relay-log-recovery=1 --debug=d,skip_writing_previous_gtids_log_event
--source include/rpl_restart_server.inc
--let $rpl_server_number= 2
--let $rpl_server_parameters= --relay-log-recovery=1
--source include/rpl_restart_server.inc
--connection slave
--disable_warnings
--source include/start_slave.inc
--enable_warnings
# 8.4 - Rotates both the binary logs on the slave and master.
FLUSH LOGS;
--connection master
FLUSH LOGS;
inc $i;
}
#
# 9. This part of the test case:
#
# 9.1 - Generates a set of transactions on the master.
#
# 9.2 - Makes the slave to retrieve and apply these transactions
#
# 9.3 - Restarts the slave server to rotate binary and relay logs.
# However, binary logs with corrupted Previous Gtids are created.
#
# 9.4 - Rotates both the binary logs on the slave and master
# by calling FLUSH LOGS.
#
--echo ==== Part 9 ====
--disable_warnings
--source include/rpl_reset.inc
--enable_warnings
--let $i=1
while ($i != 5)
{
--echo ---- i=$i ----
# 9.1 - Generates a set of transactions on the master.
--connection master
BEGIN;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
COMMIT;
# 9.2 - Makes the slave to retrieve and apply these transactions.
--source include/sync_slave_sql_with_master.inc
# Check property 1.2 and 2.1.
--connection slave
--let $binlog= binlog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= 1
--let $gtid_end= 1
}
if ($i != 1)
{
--let $gtid_set_ini= 1
--let $gtid_set_end= `SELECT $i - 1`
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# Check property 1.3 and 2.2.
--let $binlog= relaylog
--let $server_uuid= $master_uuid
if ($i == 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= 1
--let $gtid_end= 1
}
# Post relay log recovery the previous GTIDs set should
# be empty.
if ($i != 1)
{
--let $gtid_set_ini= 0
--let $gtid_set_end= 0
--let $gtid_ini= `SELECT $i`
--let $gtid_end= `SELECT $i`
}
--source extra/rpl_tests/rpl_check_gtid.inc
# 9.3 - Restarts the slave server to rotate binary and relay logs.
--source include/stop_slave.inc
--let $rpl_server_number= 2
--let $rpl_server_parameters= --relay-log-recovery=1 --debug=d,write_partial_previous_gtids_log_event
--source include/rpl_restart_server.inc
--let $rpl_server_number= 2
--let $rpl_server_parameters= --relay-log-recovery=1
--source include/rpl_restart_server.inc
--connection slave
--disable_warnings
--source include/start_slave.inc
--enable_warnings
# 9.4 - Rotates both the binary logs on the slave and master.
FLUSH LOGS;
--connection master
FLUSH LOGS;
inc $i;
}
--disable_warnings
--source include/rpl_reset.inc
--enable_warnings
--connection master
DROP TABLE t1;
--echo # Failure on creating compression thread
--source include/sync_slave_sql_with_master.inc
--source include/stop_slave.inc
call mtr.add_suppression("Can not create thread to compress gtid_executed table .*");
--let $rpl_server_number= 2
--let $rpl_server_parameters= --debug=d,simulate_create_compress_thread_failure
--source include/rpl_restart_server.inc
--let $assert_text= compression thread is destroied;
--let $assert_cond= COUNT(*) = 0 FROM performance_schema.threads WHERE NAME LIKE "%compress_gtid_table"
--source include/assert.inc
call mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
call mtr.add_suppression("Plugin 'InnoDB' has ref_count=.* after shutdown");
--let $rpl_server_parameters=
# Restart slave server without setting simulate_create_compress_thread_failure
--source include/rpl_restart_server.inc
--source include/start_slave.inc
--source include/rpl_end.inc
|