You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
4.6 KiB

  1. #
  2. # Test a case where a joiner encounters an error during IST
  3. # Instead of voting it should assume error and bail out.
  4. #
  5. --source include/galera_cluster.inc
  6. --source include/big_test.inc
  7. --source include/have_debug.inc
  8. --source include/have_debug_sync.inc
  9. # Make sure that the test is operating on the right version of galera library.
  10. --let $galera_version=26.4.19
  11. source ../wsrep/include/check_galera_version.inc;
  12. --let $node_1=node_1
  13. --let $node_2=node_2
  14. --let $node_3=node_3
  15. --let $node_4=node_4
  16. --source ../include/auto_increment_offset_save.inc
  17. # create table t1 and procedure p1 to generate wirtesets
  18. --connection node_1
  19. CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
  20. DELIMITER |;
  21. CREATE PROCEDURE p1(IN max INT)
  22. BEGIN
  23. DECLARE i INT;
  24. DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
  25. SET i = 0;
  26. WHILE i < max DO
  27. INSERT IGNORE INTO t1 VALUES (DEFAULT);
  28. SET i = i + 1;
  29. END WHILE;
  30. END|
  31. DELIMITER ;|
  32. CALL p1(130);
  33. --connection node_4
  34. --echo Shutting down server 4...
  35. --let $node_4_server_id= `SELECT @@server_id`
  36. --let $node_4_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_4_server_id.expect
  37. --let $node_4_pid_file= `SELECT @@pid_file`
  38. --source include/shutdown_mysqld.inc
  39. # Wait for node #4 to leave cluster
  40. --let $members = 3
  41. --connection node_1
  42. --source include/wsrep_wait_membership.inc
  43. --connection node_2
  44. --source include/wsrep_wait_membership.inc
  45. --connection node_3
  46. --source include/wsrep_wait_membership.inc
  47. --echo Server 4 left the cluster
  48. # Create some writesets for IST
  49. --connection node_1
  50. CALL p1(130);
  51. # Create a writeset that node 4 won't be able to apply by creating a table
  52. # that won't be present in the replication stream
  53. --connection node_1
  54. SET SESSION wsrep_on = OFF;
  55. CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
  56. SET SESSION wsrep_on = ON;
  57. --connection node_2
  58. SET SESSION wsrep_on = OFF;
  59. CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
  60. SET SESSION wsrep_on = ON;
  61. --connection node_3
  62. SET SESSION wsrep_on = OFF;
  63. CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
  64. SET SESSION wsrep_on = ON;
  65. # This should cause error during IST
  66. INSERT INTO t2 VALUES (DEFAULT);
  67. # make sure nodes 1,2,3 progress far enough for commit cut update
  68. CALL p1(130);
  69. --connection node_1
  70. # prepare to stop SST donor thread when it receives a request from starting node #4
  71. SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation";
  72. --echo Restarting server 4
  73. # Need to use this form instead of start_mysqld.inc because the latter is blocking
  74. --exec echo "restart:$start_mysqld_params" > $node_4_expect_file_name
  75. --echo Wait for server 1 to become a donor
  76. SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached";
  77. --echo Server 1 got SST request from server 4
  78. SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_continue";
  79. SET GLOBAL debug = "";
  80. SET DEBUG_SYNC='RESET';
  81. #
  82. # After this point node #4 shall proceed to IST and bail out
  83. #
  84. --echo Waiting for server 4 to leave the cluster
  85. --let $members = 3
  86. --source include/wsrep_wait_membership.inc
  87. --connection node_2
  88. --source include/wsrep_wait_membership.inc
  89. --connection node_3
  90. --source include/wsrep_wait_membership.inc
  91. --connection node_4
  92. --echo Server 4 left the cluster, killing it...
  93. # Kill the connected server
  94. --exec echo "wait" > $node_4_expect_file_name
  95. --let KILL_NODE_PIDFILE = $node_4_pid_file
  96. --perl
  97. my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
  98. my $mysqld_pid = `cat $pid_filename`;
  99. chomp($mysqld_pid);
  100. system("kill -9 $mysqld_pid");
  101. exit(0);
  102. EOF
  103. --echo Killed server 4...
  104. --source include/wait_until_disconnected.inc
  105. --echo Restarting server 4...
  106. --source include/start_mysqld.inc
  107. --source include/galera_wait_ready.inc
  108. # Confirm node #4 has rejoined
  109. --connection node_1
  110. --let $members = 4
  111. --source include/wsrep_wait_membership.inc
  112. # Confirm that all is good and all nodes have identical data
  113. --connection node_1
  114. SELECT count(*) AS expect1_390 FROM t1;
  115. SELECT count(*) AS expect1_1 FROM t2;
  116. --connection node_2
  117. SELECT count(*) AS expect2_390 FROM t1;
  118. SELECT count(*) AS expect2_1 FROM t2;
  119. --connection node_3
  120. SELECT count(*) AS expect3_390 FROM t1;
  121. SELECT count(*) AS expect3_1 FROM t2;
  122. --connection node_4
  123. SELECT count(*) AS expect4_390 FROM t1;
  124. SELECT count(*) AS expect4_1 FROM t2;
  125. DROP TABLE t1;
  126. DROP TABLE t2;
  127. DROP PROCEDURE p1;
  128. CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
  129. CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
  130. CALL mtr.add_suppression("Inconsistency detected: Failed on preordered");
  131. CALL mtr.add_suppression("Failed to apply write set");
  132. --source ../include/auto_increment_offset_restore.inc