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.

129 lines
4.4 KiB

Fix for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global 'opening tables' lock." Execution of ALTER TABLE ... ENABLE KEYS on a table (which can take rather long time) prevented concurrent execution of all statements using tables. The problem was caused by the fact that we were holding LOCK_open mutex during whole duration of this statement and particularly during call to handler::enable_indexes(). This behavior was introduced as part of the fix for bug 14262 "SP: DROP PROCEDURE|VIEW (maybe more) write to binlog too late (race cond)" The patch simply restores old behavior. Note that we can safely do this as this operation takes exclusive lock (similar to name-lock) which blocks both DML and DDL on the table being altered. It also introduces mysql-test/include/wait_show_pattern.inc helper script which is used to make test-case for this bug robust enough. mysql-test/include/wait_slave_status.inc: Now wait_slave_status.inc reuses more generic wait_output_matches.inc script. sql/sql_table.cc: mysql_alter_table(): Changed ALTER TABLE ... ENABLE/DISABLE KEYS not to hold LOCK_open mutex during call to handler::enable_indexes() as the latter can take rather long time and therefore such ALTER would block execution of all other statements that use tables. We can safely do this as this operation takes exclusive lock (similar to name-lock) on the table which is altered. mysql-test/include/wait_show_pattern.inc: New BitKeeper file ``mysql-test/include/wait_show_pattern.inc'' mysql-test/r/alter_table-big.result: New BitKeeper file ``mysql-test/r/alter_table-big.result'' mysql-test/t/alter_table-big.test: New BitKeeper file ``mysql-test/t/alter_table-big.test''
19 years ago
Fix for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global 'opening tables' lock." Execution of ALTER TABLE ... ENABLE KEYS on a table (which can take rather long time) prevented concurrent execution of all statements using tables. The problem was caused by the fact that we were holding LOCK_open mutex during whole duration of this statement and particularly during call to handler::enable_indexes(). This behavior was introduced as part of the fix for bug 14262 "SP: DROP PROCEDURE|VIEW (maybe more) write to binlog too late (race cond)" The patch simply restores old behavior. Note that we can safely do this as this operation takes exclusive lock (similar to name-lock) which blocks both DML and DDL on the table being altered. It also introduces mysql-test/include/wait_show_pattern.inc helper script which is used to make test-case for this bug robust enough. mysql-test/include/wait_slave_status.inc: Now wait_slave_status.inc reuses more generic wait_output_matches.inc script. sql/sql_table.cc: mysql_alter_table(): Changed ALTER TABLE ... ENABLE/DISABLE KEYS not to hold LOCK_open mutex during call to handler::enable_indexes() as the latter can take rather long time and therefore such ALTER would block execution of all other statements that use tables. We can safely do this as this operation takes exclusive lock (similar to name-lock) on the table which is altered. mysql-test/include/wait_show_pattern.inc: New BitKeeper file ``mysql-test/include/wait_show_pattern.inc'' mysql-test/r/alter_table-big.result: New BitKeeper file ``mysql-test/r/alter_table-big.result'' mysql-test/t/alter_table-big.test: New BitKeeper file ``mysql-test/t/alter_table-big.test''
19 years ago
Fix for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global 'opening tables' lock." Execution of ALTER TABLE ... ENABLE KEYS on a table (which can take rather long time) prevented concurrent execution of all statements using tables. The problem was caused by the fact that we were holding LOCK_open mutex during whole duration of this statement and particularly during call to handler::enable_indexes(). This behavior was introduced as part of the fix for bug 14262 "SP: DROP PROCEDURE|VIEW (maybe more) write to binlog too late (race cond)" The patch simply restores old behavior. Note that we can safely do this as this operation takes exclusive lock (similar to name-lock) which blocks both DML and DDL on the table being altered. It also introduces mysql-test/include/wait_show_pattern.inc helper script which is used to make test-case for this bug robust enough. mysql-test/include/wait_slave_status.inc: Now wait_slave_status.inc reuses more generic wait_output_matches.inc script. sql/sql_table.cc: mysql_alter_table(): Changed ALTER TABLE ... ENABLE/DISABLE KEYS not to hold LOCK_open mutex during call to handler::enable_indexes() as the latter can take rather long time and therefore such ALTER would block execution of all other statements that use tables. We can safely do this as this operation takes exclusive lock (similar to name-lock) on the table which is altered. mysql-test/include/wait_show_pattern.inc: New BitKeeper file ``mysql-test/include/wait_show_pattern.inc'' mysql-test/r/alter_table-big.result: New BitKeeper file ``mysql-test/r/alter_table-big.result'' mysql-test/t/alter_table-big.test: New BitKeeper file ``mysql-test/t/alter_table-big.test''
19 years ago
Fix for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global 'opening tables' lock." Execution of ALTER TABLE ... ENABLE KEYS on a table (which can take rather long time) prevented concurrent execution of all statements using tables. The problem was caused by the fact that we were holding LOCK_open mutex during whole duration of this statement and particularly during call to handler::enable_indexes(). This behavior was introduced as part of the fix for bug 14262 "SP: DROP PROCEDURE|VIEW (maybe more) write to binlog too late (race cond)" The patch simply restores old behavior. Note that we can safely do this as this operation takes exclusive lock (similar to name-lock) which blocks both DML and DDL on the table being altered. It also introduces mysql-test/include/wait_show_pattern.inc helper script which is used to make test-case for this bug robust enough. mysql-test/include/wait_slave_status.inc: Now wait_slave_status.inc reuses more generic wait_output_matches.inc script. sql/sql_table.cc: mysql_alter_table(): Changed ALTER TABLE ... ENABLE/DISABLE KEYS not to hold LOCK_open mutex during call to handler::enable_indexes() as the latter can take rather long time and therefore such ALTER would block execution of all other statements that use tables. We can safely do this as this operation takes exclusive lock (similar to name-lock) on the table which is altered. mysql-test/include/wait_show_pattern.inc: New BitKeeper file ``mysql-test/include/wait_show_pattern.inc'' mysql-test/r/alter_table-big.result: New BitKeeper file ``mysql-test/r/alter_table-big.result'' mysql-test/t/alter_table-big.test: New BitKeeper file ``mysql-test/t/alter_table-big.test''
19 years ago
Fix for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global 'opening tables' lock." Execution of ALTER TABLE ... ENABLE KEYS on a table (which can take rather long time) prevented concurrent execution of all statements using tables. The problem was caused by the fact that we were holding LOCK_open mutex during whole duration of this statement and particularly during call to handler::enable_indexes(). This behavior was introduced as part of the fix for bug 14262 "SP: DROP PROCEDURE|VIEW (maybe more) write to binlog too late (race cond)" The patch simply restores old behavior. Note that we can safely do this as this operation takes exclusive lock (similar to name-lock) which blocks both DML and DDL on the table being altered. It also introduces mysql-test/include/wait_show_pattern.inc helper script which is used to make test-case for this bug robust enough. mysql-test/include/wait_slave_status.inc: Now wait_slave_status.inc reuses more generic wait_output_matches.inc script. sql/sql_table.cc: mysql_alter_table(): Changed ALTER TABLE ... ENABLE/DISABLE KEYS not to hold LOCK_open mutex during call to handler::enable_indexes() as the latter can take rather long time and therefore such ALTER would block execution of all other statements that use tables. We can safely do this as this operation takes exclusive lock (similar to name-lock) on the table which is altered. mysql-test/include/wait_show_pattern.inc: New BitKeeper file ``mysql-test/include/wait_show_pattern.inc'' mysql-test/r/alter_table-big.result: New BitKeeper file ``mysql-test/r/alter_table-big.result'' mysql-test/t/alter_table-big.test: New BitKeeper file ``mysql-test/t/alter_table-big.test''
19 years ago
  1. # include/wait_slave_status.inc
  2. #
  3. # Created by Matthias Leich
  4. #
  5. # SUMMARY
  6. #
  7. # Waits until slave has reached certain state or maximum time reached.
  8. #
  9. # (This script will not work, when the SHOW command delivers more than one
  10. # result record, because only the first record will be caught.)
  11. #
  12. # USAGE
  13. #
  14. # Set $result_pattern in test file and source this file:
  15. #
  16. # let $result_pattern= <pattern used for LIKE on the result of
  17. # SHOW STATUS SLAVE>
  18. # --include wait_slave_status.inc
  19. #
  20. # EXAMPLE
  21. #
  22. # The script rpl_until.test:
  23. # ...
  24. # --replace_result $MASTER_MYPORT MASTER_MYPORT
  25. # --replace_column 1 # 9 # 23 # 33 #
  26. # --vertical_results show slave status;
  27. #
  28. # outputs
  29. # show slave status;
  30. # Slave_IO_State #
  31. # Master_Host 127.0.0.1
  32. # Master_User root
  33. # Master_Port MASTER_MYPORT
  34. # Connect_Retry 1
  35. # Master_Log_File master-bin.000001
  36. # Read_Master_Log_Pos 776
  37. # Relay_Log_File slave-relay-bin.000004
  38. # Relay_Log_Pos #
  39. # Relay_Master_Log_File master-bin.000001
  40. # Slave_IO_Running Yes
  41. # Slave_SQL_Running No
  42. # Replicate_Do_DB
  43. # Replicate_Ignore_DB
  44. # Replicate_Do_Table
  45. # Replicate_Ignore_Table
  46. # Replicate_Wild_Do_Table
  47. # Replicate_Wild_Ignore_Table
  48. # Last_Errno 0
  49. # Last_Error
  50. # Skip_Counter 0
  51. # Exec_Master_Log_Pos 319
  52. # Relay_Log_Space #
  53. # Until_Condition Master
  54. # Until_Log_File master-bin.000001
  55. # Until_Log_Pos 319
  56. # Master_SSL_Allowed No
  57. # Master_SSL_CA_File
  58. # Master_SSL_CA_Path
  59. # Master_SSL_Cert
  60. # Master_SSL_Cipher
  61. # Master_SSL_Key
  62. # Seconds_Behind_Master #
  63. #
  64. # The main problem with the "show slave status;" in rpl_until is, that
  65. # depending on the total test engine power and the current load caused by
  66. # other processes, the expected slave status might be not reached though
  67. # it will happen in maybe some seconds.
  68. #
  69. # The typical problem with rpl_until is that Slave_IO_Running is "No"
  70. # instead of "Yes".
  71. #
  72. # The expected result follows the LIKE pattern:
  73. #
  74. # let $result_pattern= '%127.0.0.1%root%1%master-bin.000001%776%slave-relay-bin.000004%master-bin.000001%Yes%No%0%0%319%Master%master-bin.000001%319%No%';
  75. #
  76. # The Slave_IO_Running value is the "Yes" just after the "master-bin.000001".
  77. #
  78. # How to get this pattern ?
  79. #
  80. # Any lines "--replace_result ..." and "--replace_colum ..." just before
  81. # the SHOW TABLE STATUS and of course the expected result itself
  82. # show us columns where the content must be unified, because it is non
  83. # deterministic or it depends on the current test environment.
  84. #
  85. # Unfortunately "--replace_result ..." and "--replace_colum ..." do not
  86. # affect the result of our assignment let $my_val= `SHOW SLAVE STATUS`;
  87. # Therefore such content must be covered by '%'.
  88. #
  89. # Please be careful. A more simple pattern might be dangerous, because we
  90. # might get "wrong" matches. Example: There might be several "Yes" and "No"
  91. # within one result row.
  92. #
  93. ###############################################################################
  94. # We do not want to print the auxiliary commands, because they are not of
  95. # interest and their amount will vary depending how fast we get the
  96. # desired state.
  97. --disable_query_log
  98. # The protocol should show
  99. # - the setting of $result_pattern and
  100. # - that this file is sourced ,
  101. # because this increases the chance to use the protocol as replay script.
  102. eval SELECT "let \$result_pattern= $result_pattern ;" AS "";
  103. SELECT '--source include/wait_slave_status.inc' AS "";
  104. let $show_type= SLAVE STATUS;
  105. let $show_pattern= $result_pattern;
  106. --enable_query_log
  107. --source include/wait_show_pattern.inc
  108. if (!$success)
  109. {
  110. let $message= ! Attention: Timeout in wait_slave_status.inc.
  111. | Possible reasons with decreasing probability:
  112. | - The LIKE pattern is wrong, because the
  113. | testcase was altered or the layout of the
  114. | SHOW SLAVE STATUS result set changed.
  115. | - There is a new bug within the replication.
  116. | - We met an extreme testing environment and timeout is
  117. | too small.;
  118. --source include/show_msg80.inc
  119. --echo DEBUG INFO START (wait_slave_status.inc):
  120. --echo $result_pattern
  121. --vertical_results
  122. show slave status;
  123. --echo DEBUG INFO END
  124. }