-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3143 from satya-bodapati/PS-5.7-3410
PS-3410 : LP #1570114: Long running ALTER TABLE ADD INDEX causes sema…
- Loading branch information
Showing
8 changed files
with
188 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
SET GLOBAL innodb_fill_factor = 10; | ||
SET GLOBAL innodb_semaphore_wait_timeout_debug = 120; | ||
SET GLOBAL DEBUG = '+d, innodb_bulk_load_compress_sleep'; | ||
CREATE TABLE t1( | ||
class INT, | ||
id INT, | ||
title VARCHAR(100), | ||
title2 VARCHAR(100) | ||
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; | ||
CREATE PROCEDURE populate_t1() | ||
BEGIN | ||
DECLARE i int DEFAULT 1; | ||
START TRANSACTION; | ||
WHILE (i <= 30000) DO | ||
INSERT INTO t1 VALUES (i, i, uuid(), uuid()); | ||
SET i = i + 1; | ||
END WHILE; | ||
COMMIT; | ||
END| | ||
SET DEBUG_SYNC = 'bulk_load_insert SIGNAL alter_started WAIT_FOR resume_alter'; | ||
CREATE INDEX idx_title ON t1(title, title2);; | ||
SET DEBUG_SYNC = 'now WAIT_FOR alter_started'; | ||
SET DEBUG_SYNC = 'row_ins_sec_index_enter SIGNAL resume_alter'; | ||
INSERT INTO t1 VALUES (32000, 32000, uuid(), uuid());; | ||
DROP TABLE t1; | ||
SET DEBUG_SYNC = 'RESET'; | ||
SET GLOBAL innodb_fill_factor = 100; | ||
SET GLOBAL DEBUG = '-d, innodb_bulk_load_compress_sleep'; | ||
SET GLOBAL innodb_semaphore_wait_timeout_debug = 600; | ||
DROP PROCEDURE populate_t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--source include/have_debug.inc | ||
--source include/have_debug_sync.inc | ||
--source include/have_innodb.inc | ||
|
||
--let $orig_fill_factor = `SELECT @@innodb_fill_factor` | ||
SET GLOBAL innodb_fill_factor = 10; | ||
|
||
--let $orig_sem_timeout = `SELECT @@innodb_semaphore_wait_timeout_debug` | ||
SET GLOBAL innodb_semaphore_wait_timeout_debug = 120; | ||
|
||
# This statement helps to run ALTER for long time without actually | ||
# creating a very big table | ||
SET GLOBAL DEBUG = '+d, innodb_bulk_load_compress_sleep'; | ||
|
||
--source include/count_sessions.inc | ||
|
||
connect (con1,localhost,root,,); | ||
|
||
CREATE TABLE t1( | ||
class INT, | ||
id INT, | ||
title VARCHAR(100), | ||
title2 VARCHAR(100) | ||
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; | ||
|
||
DELIMITER |; | ||
CREATE PROCEDURE populate_t1() | ||
BEGIN | ||
DECLARE i int DEFAULT 1; | ||
|
||
START TRANSACTION; | ||
WHILE (i <= 30000) DO | ||
INSERT INTO t1 VALUES (i, i, uuid(), uuid()); | ||
SET i = i + 1; | ||
END WHILE; | ||
COMMIT; | ||
END| | ||
DELIMITER ;| | ||
|
||
--disable_query_log | ||
CALL populate_t1(); | ||
--enable_query_log | ||
|
||
--connection con1 | ||
SET DEBUG_SYNC = 'bulk_load_insert SIGNAL alter_started WAIT_FOR resume_alter'; | ||
--send CREATE INDEX idx_title ON t1(title, title2); | ||
|
||
--connection default | ||
SET DEBUG_SYNC = 'now WAIT_FOR alter_started'; | ||
SET DEBUG_SYNC = 'row_ins_sec_index_enter SIGNAL resume_alter'; | ||
--send INSERT INTO t1 VALUES (32000, 32000, uuid(), uuid()); | ||
|
||
--connection con1 | ||
--reap | ||
|
||
--connection default | ||
--reap | ||
|
||
--disconnect con1 | ||
|
||
DROP TABLE t1; | ||
|
||
SET DEBUG_SYNC = 'RESET'; | ||
|
||
eval SET GLOBAL innodb_fill_factor = $orig_fill_factor; | ||
SET GLOBAL DEBUG = '-d, innodb_bulk_load_compress_sleep'; | ||
eval SET GLOBAL innodb_semaphore_wait_timeout_debug = $orig_sem_timeout; | ||
DROP PROCEDURE populate_t1; | ||
--source include/wait_until_count_sessions.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
mysql-test/suite/sys_vars/r/innodb_semaphore_wait_timeout_debug_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# Basic test for innodb_semaphore_wait_timeout_debug | ||
# | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
@@global.innodb_semaphore_wait_timeout_debug | ||
600 | ||
set global innodb_semaphore_wait_timeout_debug = 10; | ||
Warnings: | ||
Warning 1292 Truncated incorrect innodb_semaphore_wait_timeout_de value: '10' | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
@@global.innodb_semaphore_wait_timeout_debug | ||
100 | ||
SET GLOBAL innodb_semaphore_wait_timeout_debug = 200; | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
@@global.innodb_semaphore_wait_timeout_debug | ||
200 | ||
SET GLOBAL innodb_semaphore_wait_timeout_debug = dummy; | ||
ERROR 42000: Incorrect argument type to variable 'innodb_semaphore_wait_timeout_debug' | ||
SET innodb_semaphore_wait_timeout_debug = 100; | ||
ERROR HY000: Variable 'innodb_semaphore_wait_timeout_debug' is a GLOBAL variable and should be set with SET GLOBAL | ||
SET GLOBAL innodb_semaphore_wait_timeout_debug = 6000; | ||
Warnings: | ||
Warning 1292 Truncated incorrect innodb_semaphore_wait_timeout_de value: '6000' | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
@@global.innodb_semaphore_wait_timeout_debug | ||
600 | ||
SET GLOBAL innodb_semaphore_wait_timeout_debug = -1; | ||
Warnings: | ||
Warning 1292 Truncated incorrect innodb_semaphore_wait_timeout_de value: '-1' | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
@@global.innodb_semaphore_wait_timeout_debug | ||
100 | ||
SET GLOBAL innodb_semaphore_wait_timeout_debug = default; | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
@@global.innodb_semaphore_wait_timeout_debug | ||
600 |
30 changes: 30 additions & 0 deletions
30
mysql-test/suite/sys_vars/t/innodb_semaphore_wait_timeout_debug_basic.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--echo # | ||
--echo # Basic test for innodb_semaphore_wait_timeout_debug | ||
--echo # | ||
|
||
--source include/have_innodb.inc | ||
# The config variable is a debug variable | ||
--source include/have_debug.inc | ||
|
||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
|
||
set global innodb_semaphore_wait_timeout_debug = 10; | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
|
||
SET GLOBAL innodb_semaphore_wait_timeout_debug = 200; | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
|
||
--error ER_WRONG_TYPE_FOR_VAR | ||
SET GLOBAL innodb_semaphore_wait_timeout_debug = dummy; | ||
|
||
--error ER_GLOBAL_VARIABLE | ||
SET innodb_semaphore_wait_timeout_debug = 100; | ||
|
||
SET GLOBAL innodb_semaphore_wait_timeout_debug = 6000; | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
|
||
SET GLOBAL innodb_semaphore_wait_timeout_debug = -1; | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; | ||
|
||
SET GLOBAL innodb_semaphore_wait_timeout_debug = default; | ||
SELECT @@global.innodb_semaphore_wait_timeout_debug; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters