From c3e4b61c4eb9e2bae1137ed4c503c6f8bb33dc5d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Jun 2007 12:45:56 -0400 Subject: [PATCH 1/2] Bug#27029 alter table ... enable keys crashes mysqld on large table - When creating an index for the sort, the number of rows plus 1 is used to allocate a buffer. In this test case, the number of rows 4294967295 is the max value of an unsigned integer, so when 1 was added to it, a buffer of size 0 was allocated causing the crash. - Create new test suite for this bug's test suite as per QA. myisam/sort.c: Bug#27029 alter table ... enable keys crashes mysqld on large table - Check to make sure the value of records is < UINT_MAX32 to avoid a false positive on the remaining condition. mysql-test/suite/large_tests/README.TXT: Bug#27029 alter table ... enable keys crashes mysqld on large table - New testsuite for large tests. - Added mtr hint for potential testers. mysql-test/suite/large_tests/r/alter_table.result: Bug#27029 alter table ... enable keys crashes mysqld on large table - New testsuite for large tests. - Added results for bug. mysql-test/suite/large_tests/t/alter_table.test: Bug#27029 alter table ... enable keys crashes mysqld on large table - New testsuite for large tests. - Added test for bug. --- myisam/sort.c | 5 +- mysql-test/suite/large_tests/README.TXT | 13 +++++ .../suite/large_tests/r/alter_table.result | 37 +++++++++++++++ .../suite/large_tests/t/alter_table.test | 47 +++++++++++++++++++ 4 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/large_tests/README.TXT create mode 100644 mysql-test/suite/large_tests/r/alter_table.result create mode 100644 mysql-test/suite/large_tests/t/alter_table.test diff --git a/myisam/sort.c b/myisam/sort.c index 3cb48b47b2c..ba3a6e20b30 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -138,8 +138,9 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, while (memavl >= MIN_SORT_MEMORY) { - if ((my_off_t) (records+1)*(sort_length+sizeof(char*)) <= - (my_off_t) memavl) + if ((records < UINT_MAX32) && + ((my_off_t) (records + 1) * + (sort_length + sizeof(char*)) <= (my_off_t) memavl)) keys= records+1; else do diff --git a/mysql-test/suite/large_tests/README.TXT b/mysql-test/suite/large_tests/README.TXT new file mode 100644 index 00000000000..51cd4e41a40 --- /dev/null +++ b/mysql-test/suite/large_tests/README.TXT @@ -0,0 +1,13 @@ +large_test suite +================ + +Iggy Galarza 07/20/07 +--------------------- + +This test suite should include any test that requires: +1. Longer than the default timeout to complete. +2. A considerable amount of disk space. + +These tests can be completed with the following command: + +mysql-test-run.pl --suite=large_tests --big-test --suite-timeout=6360 --testcase-timeout=795 diff --git a/mysql-test/suite/large_tests/r/alter_table.result b/mysql-test/suite/large_tests/r/alter_table.result new file mode 100644 index 00000000000..921711e9812 --- /dev/null +++ b/mysql-test/suite/large_tests/r/alter_table.result @@ -0,0 +1,37 @@ +drop table if exists t1; +create table `t1` (`c1` tinyint unsigned not null, key `c1` (`c1`)) +engine=myisam default charset=utf8; +alter table `t1` disable keys; +insert into t1 values (1),(2),(3),(4); +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1 limit 2147483647; +alter table t1 enable keys; +drop table t1; diff --git a/mysql-test/suite/large_tests/t/alter_table.test b/mysql-test/suite/large_tests/t/alter_table.test new file mode 100644 index 00000000000..61f0b34d904 --- /dev/null +++ b/mysql-test/suite/large_tests/t/alter_table.test @@ -0,0 +1,47 @@ +# The test for bug#27029 requires about 8 hours and 20 minutes on my +# fastest machine. This test requires at least 60 GB of disk space. +--source include/big_test.inc + +# +# Bug#27029 alter table ... enable keys crashes mysqld on large table +# +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table `t1` (`c1` tinyint unsigned not null, key `c1` (`c1`)) +engine=myisam default charset=utf8; +alter table `t1` disable keys; +insert into t1 values (1),(2),(3),(4); +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1 limit 2147483647; #Insert 4294967295 rows. +alter table t1 enable keys; +drop table t1; From 37344c68f5c006c582b3f9793d7eb15102a5e807 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Jun 2007 21:39:52 -0400 Subject: [PATCH 2/2] Bug #29138 'kill' fails in pushbuild The reason the "reap;" succeeds unexpectedly is because the query was completing(almost always) and the network buffer was big enough to store the query result (sometimes) on Windows, meaning the response was completely sent before the server thread could be killed. Therefore we use a much longer running query that doesn't have a chance to fully complete before the reap happens, testing the kill properly. mysql-test/r/kill.result: We use a much longer running query that doesn't have a chance to fully complete before the reap happens. mysql-test/t/kill.test: We use a much longer running query that doesn't have a chance to fully complete before the reap happens. --- mysql-test/r/kill.result | 2 +- mysql-test/t/kill.test | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result index a4966d9d5ec..7ddabe74c5f 100644 --- a/mysql-test/r/kill.result +++ b/mysql-test/r/kill.result @@ -22,7 +22,7 @@ create table t2 (id int unsigned not null); insert into t2 select id from t1; create table t3 (kill_id int); insert into t3 values(connection_id()); -select id from t1 where id in (select distinct id from t2); +select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20); select ((@id := kill_id) - kill_id) from t3; ((@id := kill_id) - kill_id) 0 diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 5f6bae00254..cedca9db3da 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -81,7 +81,9 @@ connection conn2; connection conn1; -- disable_result_log -send select id from t1 where id in (select distinct id from t2); +# This is a very long running query. If this test start failing, it may +# be necessary to change to an even longer query. +send select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20); -- enable_result_log connection conn2;