Skip to content

Commit

Permalink
MDEV-16319: Test for crash introduced by b4a2baf fixed by 4968049
Browse files Browse the repository at this point in the history
Add a Spider test to ensure that a bug similar to MDEV-11084 is not
re-introduced.  Spider would crash if the first partition was not used first.

Author:
  Eric Herman.

First Reviewer:
  Jacob Mathew.

Second Reviewer:
  Kentoku Shiba.
  • Loading branch information
Jacob Mathew committed Jun 18, 2018
1 parent 0121d5a commit b27ec70
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 0 deletions.
31 changes: 31 additions & 0 deletions storage/spider/mysql-test/spider/r/spider_fixes_part.result
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,37 @@ id
10000
connection master_1;

Crash from b4a2baffa82e5c07b96a1c752228560dcac1359b (MDEV-11084)
Fixed with 4968049799193394d442f26b4e3a8d95b185be72
Spider crashed if the first partition was not used first
connection master_1;
CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
Query a Spider table only using the second partition
SELECT a,b,c FROM ta_l2 PARTITION (pt2);
a b c
4 d 2003-11-30 05:01:03
5 c 2001-12-31 23:59:59
Query a Spider table only using the first partition
SELECT a,b,c FROM ta_l2 PARTITION (pt1);
a b c
1 a 2008-08-01 10:21:39
2 b 2000-01-01 00:00:00
3 e 2007-06-04 20:03:11
Query a Spider table by all paritions, then the second partition
SELECT min(a), max(a), min(b), max(b) FROM ta_l2;
min(a) max(a) min(b) max(b)
1 5 a e
SELECT a,b,c FROM ta_l2 PARTITION (pt2);
a b c
4 d 2003-11-30 05:01:03
5 c 2001-12-31 23:59:59

deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
Expand Down
109 changes: 109 additions & 0 deletions storage/spider/mysql-test/spider/t/spider_fixes_part.test
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,115 @@ if ($HAVE_PARTITION)
}
}

--echo
--echo Crash from b4a2baffa82e5c07b96a1c752228560dcac1359b (MDEV-11084)
--echo Fixed with 4968049799193394d442f26b4e3a8d95b185be72
--echo Spider crashed if the first partition was not used first
if ($HAVE_PARTITION)
{
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_2_DROP_TABLES;
echo CHILD2_2_CREATE_TABLES;
}
--disable_warnings
eval $CHILD2_2_DROP_TABLES;
--enable_warnings
eval $CHILD2_2_CREATE_TABLES;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES2;
echo CHILD2_1_CREATE_TABLES2;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES2;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES2;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_query_log
--disable_warnings
DROP TABLE IF EXISTS ta_l2;
--enable_warnings
echo CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
eval CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
--enable_query_log
INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
--echo Query a Spider table only using the second partition
SELECT a,b,c FROM ta_l2 PARTITION (pt2);
--echo Query a Spider table only using the first partition
SELECT a,b,c FROM ta_l2 PARTITION (pt1);
--echo Query a Spider table by all paritions, then the second partition
SELECT min(a), max(a), min(b), max(b) FROM ta_l2;
SELECT a,b,c FROM ta_l2 PARTITION (pt2);
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
}
eval $CHILD2_2_SELECT_TABLES;
--connection child2_1
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
}
eval $CHILD2_1_SELECT_TABLES2;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
}

--echo
--echo deinit
Expand Down

0 comments on commit b27ec70

Please sign in to comment.