Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7297ec56
Commit
7297ec56
authored
Mar 16, 2010
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
cc223d38
e62c30b5
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
455 additions
and
17 deletions
+455
-17
mysql-test/r/partition_error.result
mysql-test/r/partition_error.result
+42
-0
mysql-test/r/partition_innodb.result
mysql-test/r/partition_innodb.result
+70
-1
mysql-test/r/partition_pruning.result
mysql-test/r/partition_pruning.result
+95
-11
mysql-test/r/partition_range.result
mysql-test/r/partition_range.result
+14
-0
mysql-test/suite/parts/inc/partition_auto_increment.inc
mysql-test/suite/parts/inc/partition_auto_increment.inc
+18
-0
mysql-test/suite/parts/r/partition_auto_increment_archive.result
...est/suite/parts/r/partition_auto_increment_archive.result
+9
-0
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result
...t/suite/parts/r/partition_auto_increment_blackhole.result
+10
-0
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
...test/suite/parts/r/partition_auto_increment_innodb.result
+9
-1
mysql-test/suite/parts/r/partition_auto_increment_memory.result
...test/suite/parts/r/partition_auto_increment_memory.result
+10
-0
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
...test/suite/parts/r/partition_auto_increment_myisam.result
+10
-0
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
+8
-0
mysql-test/t/partition_error.test
mysql-test/t/partition_error.test
+24
-0
mysql-test/t/partition_innodb.test
mysql-test/t/partition_innodb.test
+60
-1
mysql-test/t/partition_pruning.test
mysql-test/t/partition_pruning.test
+28
-0
mysql-test/t/partition_range.test
mysql-test/t/partition_range.test
+18
-0
sql/ha_partition.cc
sql/ha_partition.cc
+15
-1
sql/sql_partition.cc
sql/sql_partition.cc
+15
-2
No files found.
mysql-test/r/partition_error.result
View file @
7297ec56
drop table if exists t1;
drop table if exists t1;
#
# Bug#50392: insert_id is not reset for partitioned tables
# auto_increment on duplicate entry
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
SET INSERT_ID= 13;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID= 12;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
a
12
13
14
DROP TABLE t1;
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY(a);
SET INSERT_ID= 13;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID= 12;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
a
12
13
14
DROP TABLE t1;
CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
INSERT INTO t1 VALUES (1),(1);
INSERT INTO t1 VALUES (1),(1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
...
...
mysql-test/r/partition_innodb.result
View file @
7297ec56
drop table if exists t1;
drop table if exists t1, t2;
#
# Bug#51830: Incorrect partition pruning on range partition (regression)
#
CREATE TABLE t1 (a INT NOT NULL)
ENGINE = InnoDB
PARTITION BY RANGE(a)
(PARTITION p10 VALUES LESS THAN (10),
PARTITION p30 VALUES LESS THAN (30),
PARTITION p50 VALUES LESS THAN (50),
PARTITION p70 VALUES LESS THAN (70),
PARTITION p90 VALUES LESS THAN (90));
INSERT INTO t1 VALUES (10),(30),(50);
INSERT INTO t1 VALUES (70);
INSERT INTO t1 VALUES (80);
INSERT INTO t1 VALUES (89);
INSERT INTO t1 VALUES (90);
ERROR HY000: Table has no partition for value 90
INSERT INTO t1 VALUES (100);
ERROR HY000: Table has no partition for value 100
insert INTO t1 VALUES (110);
ERROR HY000: Table has no partition for value 110
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
DROP TABLE t1;
#
# Bug#50104: Partitioned table with just 1 partion works with fk
#
CREATE TABLE t2 (
id INT,
PRIMARY KEY (id)
) ENGINE=InnoDB ;
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT,
parent_id INT DEFAULT NULL,
PRIMARY KEY (id),
KEY parent_id (parent_id)
) ENGINE=InnoDB;
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 1;
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2;
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
DROP TABLE t1, t2;
create table t1 (a int not null,
create table t1 (a int not null,
b datetime not null,
b datetime not null,
primary key (a,b))
primary key (a,b))
...
...
mysql-test/r/partition_pruning.result
View file @
7297ec56
This diff is collapsed.
Click to expand it.
mysql-test/r/partition_range.result
View file @
7297ec56
drop table if exists t1, t2;
drop table if exists t1, t2;
#
# Bug#48229: group by performance issue of partitioned table
#
CREATE TABLE t1 (
a INT,
b INT,
KEY a (a,b)
)
PARTITION BY HASH (a) PARTITIONS 1;
INSERT INTO t1 VALUES (0, 580092), (3, 894076), (4, 805483), (4, 913540), (6, 611137), (8, 171602), (9, 599495), (9, 746305), (10, 272829), (10, 847519), (12, 258869), (12, 929028), (13, 288970), (15, 20971), (15, 105839), (16, 788272), (17, 76914), (18, 827274), (19, 802258), (20, 123677), (20, 587729), (22, 701449), (25, 31565), (25, 230782), (25, 442887), (25, 733139), (25, 851020);
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
DROP TABLE t1;
create table t1 (a int)
create table t1 (a int)
partition by range (a)
partition by range (a)
( partition p0 values less than (maxvalue));
( partition p0 values less than (maxvalue));
...
...
mysql-test/suite/parts/inc/partition_auto_increment.inc
View file @
7297ec56
...
@@ -42,6 +42,15 @@ if ($mysql_errno)
...
@@ -42,6 +42,15 @@ if ($mysql_errno)
INSERT
INTO
t1
VALUES
(
NULL
);
INSERT
INTO
t1
VALUES
(
NULL
);
SET
INSERT_ID
=
30
;
SET
INSERT_ID
=
30
;
INSERT
INTO
t1
VALUES
(
NULL
);
INSERT
INTO
t1
VALUES
(
NULL
);
SET
INSERT_ID
=
29
;
--
error
0
,
ER_DUP_ENTRY
,
ER_DUP_KEY
INSERT
INTO
t1
VALUES
(
NULL
),
(
NULL
),
(
NULL
);
if
(
!
$mysql_errno
)
{
echo
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
echo
# mysql_errno: $mysql_errno;
}
INSERT
INTO
t1
VALUES
(
NULL
);
if
(
!
$skip_update
)
if
(
!
$skip_update
)
{
{
# InnoDB Does not handle this correctly, see bug#14793, bug#21641
# InnoDB Does not handle this correctly, see bug#14793, bug#21641
...
@@ -601,6 +610,15 @@ SET INSERT_ID = 23;
...
@@ -601,6 +610,15 @@ SET INSERT_ID = 23;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
(
c1
)
VALUES
(
NULL
);
INSERT
INTO
t1
(
c1
)
VALUES
(
NULL
);
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
SET
INSERT_ID
=
22
;
--
error
0
,
ER_DUP_ENTRY
,
ER_DUP_KEY
INSERT
INTO
t1
VALUES
(
NULL
),
(
NULL
),
(
NULL
);
if
(
!
$mysql_errno
)
{
echo
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
echo
# mysql_errno: $mysql_errno;
}
INSERT
INTO
t1
VALUES
(
NULL
);
SELECT
*
FROM
t1
ORDER
BY
c1
;
SELECT
*
FROM
t1
ORDER
BY
c1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
...
...
mysql-test/suite/parts/r/partition_auto_increment_archive.result
View file @
7297ec56
...
@@ -34,6 +34,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
...
@@ -34,6 +34,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
SELECT * FROM t1 ORDER BY c1;
c1
c1
2
2
...
@@ -46,6 +49,7 @@ c1
...
@@ -46,6 +49,7 @@ c1
21
21
22
22
30
30
31
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
c1 INT NOT NULL AUTO_INCREMENT,
...
@@ -751,10 +755,15 @@ t1 CREATE TABLE `t1` (
...
@@ -751,10 +755,15 @@ t1 CREATE TABLE `t1` (
) ENGINE=ARCHIVE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
) ENGINE=ARCHIVE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
SELECT * FROM t1 ORDER BY c1;
c1
c1
1
1
22
23
23
24
DROP TABLE t1;
DROP TABLE t1;
# Testing with FLUSH TABLE
# Testing with FLUSH TABLE
CREATE TABLE t1 (
CREATE TABLE t1 (
...
...
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result
View file @
7297ec56
...
@@ -35,6 +35,11 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
...
@@ -35,6 +35,11 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
# mysql_errno: 0
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
FLUSH TABLES;
...
@@ -597,6 +602,11 @@ t1 CREATE TABLE `t1` (
...
@@ -597,6 +602,11 @@ t1 CREATE TABLE `t1` (
) ENGINE=BLACKHOLE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
) ENGINE=BLACKHOLE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
# mysql_errno: 0
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
SELECT * FROM t1 ORDER BY c1;
c1
c1
DROP TABLE t1;
DROP TABLE t1;
...
...
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
View file @
7297ec56
...
@@ -33,6 +33,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
...
@@ -33,6 +33,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
FLUSH TABLES;
...
@@ -40,7 +43,7 @@ UPDATE t1 SET c1 = 40 WHERE c1 = 50;
...
@@ -40,7 +43,7 @@ UPDATE t1 SET c1 = 40 WHERE c1 = 50;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AND TABLE_NAME='t1';
AUTO_INCREMENT
AUTO_INCREMENT
3
1
3
2
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
Warnings:
Warnings:
Warning 1048 Column 'c1' cannot be null
Warning 1048 Column 'c1' cannot be null
...
@@ -60,6 +63,7 @@ c1
...
@@ -60,6 +63,7 @@ c1
30
30
31
31
32
32
33
40
40
51
51
DROP TABLE t1;
DROP TABLE t1;
...
@@ -771,10 +775,14 @@ t1 CREATE TABLE `t1` (
...
@@ -771,10 +775,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
SELECT * FROM t1 ORDER BY c1;
c1
c1
1
1
23
23
24
DROP TABLE t1;
DROP TABLE t1;
# Testing with FLUSH TABLE
# Testing with FLUSH TABLE
CREATE TABLE t1 (
CREATE TABLE t1 (
...
...
mysql-test/suite/parts/r/partition_auto_increment_memory.result
View file @
7297ec56
...
@@ -33,6 +33,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
...
@@ -33,6 +33,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
FLUSH TABLES;
...
@@ -57,7 +60,9 @@ c1
...
@@ -57,7 +60,9 @@ c1
21
21
22
22
23
23
29
30
30
31
40
40
51
51
52
52
...
@@ -797,10 +802,15 @@ t1 CREATE TABLE `t1` (
...
@@ -797,10 +802,15 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
) ENGINE=MEMORY AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
SELECT * FROM t1 ORDER BY c1;
c1
c1
1
1
22
23
23
24
DROP TABLE t1;
DROP TABLE t1;
# Testing with FLUSH TABLE
# Testing with FLUSH TABLE
CREATE TABLE t1 (
CREATE TABLE t1 (
...
...
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
View file @
7297ec56
...
@@ -33,6 +33,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
...
@@ -33,6 +33,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
FLUSH TABLES;
...
@@ -57,7 +60,9 @@ c1
...
@@ -57,7 +60,9 @@ c1
21
21
22
22
23
23
29
30
30
31
40
40
51
51
52
52
...
@@ -816,10 +821,15 @@ t1 CREATE TABLE `t1` (
...
@@ -816,10 +821,15 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
) ENGINE=MyISAM AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
SELECT * FROM t1 ORDER BY c1;
c1
c1
1
1
22
23
23
24
DROP TABLE t1;
DROP TABLE t1;
# Testing with FLUSH TABLE
# Testing with FLUSH TABLE
CREATE TABLE t1 (
CREATE TABLE t1 (
...
...
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
View file @
7297ec56
...
@@ -34,6 +34,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
...
@@ -34,6 +34,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
FLUSH TABLES;
...
@@ -58,6 +61,7 @@ c1
...
@@ -58,6 +61,7 @@ c1
21
21
22
22
23
23
24
30
30
40
40
51
51
...
@@ -792,9 +796,13 @@ t1 CREATE TABLE `t1` (
...
@@ -792,9 +796,13 @@ t1 CREATE TABLE `t1` (
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
SELECT * FROM t1 ORDER BY c1;
c1
c1
1
1
2
23
23
DROP TABLE t1;
DROP TABLE t1;
# Testing with FLUSH TABLE
# Testing with FLUSH TABLE
...
...
mysql-test/t/partition_error.test
View file @
7297ec56
...
@@ -8,6 +8,30 @@
...
@@ -8,6 +8,30 @@
drop
table
if
exists
t1
;
drop
table
if
exists
t1
;
--
enable_warnings
--
enable_warnings
--
echo
#
--
echo
# Bug#50392: insert_id is not reset for partitioned tables
--
echo
# auto_increment on duplicate entry
CREATE
TABLE
t1
(
a
INT
AUTO_INCREMENT
PRIMARY
KEY
);
SET
INSERT_ID
=
13
;
INSERT
INTO
t1
VALUES
(
NULL
);
SET
INSERT_ID
=
12
;
--
error
ER_DUP_ENTRY
INSERT
INTO
t1
VALUES
(
NULL
),
(
NULL
),
(
NULL
);
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
NULL
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
INT
AUTO_INCREMENT
PRIMARY
KEY
)
PARTITION
BY
KEY
(
a
);
SET
INSERT_ID
=
13
;
INSERT
INTO
t1
VALUES
(
NULL
);
SET
INSERT_ID
=
12
;
--
error
ER_DUP_ENTRY
INSERT
INTO
t1
VALUES
(
NULL
),
(
NULL
),
(
NULL
);
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
NULL
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
#
#
# Bug#38719: Partitioning returns a different error code for a
# Bug#38719: Partitioning returns a different error code for a
# duplicate key error
# duplicate key error
...
...
mysql-test/t/partition_innodb.test
View file @
7297ec56
...
@@ -2,11 +2,70 @@
...
@@ -2,11 +2,70 @@
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
;
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
--
enable_warnings
let
$MYSQLD_DATADIR
=
`SELECT @@datadir`
;
let
$MYSQLD_DATADIR
=
`SELECT @@datadir`
;
--
echo
#
--
echo
# Bug#51830: Incorrect partition pruning on range partition (regression)
--
echo
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
)
ENGINE
=
InnoDB
PARTITION
BY
RANGE
(
a
)
(
PARTITION
p10
VALUES
LESS
THAN
(
10
),
PARTITION
p30
VALUES
LESS
THAN
(
30
),
PARTITION
p50
VALUES
LESS
THAN
(
50
),
PARTITION
p70
VALUES
LESS
THAN
(
70
),
PARTITION
p90
VALUES
LESS
THAN
(
90
));
INSERT
INTO
t1
VALUES
(
10
),(
30
),(
50
);
INSERT
INTO
t1
VALUES
(
70
);
INSERT
INTO
t1
VALUES
(
80
);
INSERT
INTO
t1
VALUES
(
89
);
--
error
ER_NO_PARTITION_FOR_GIVEN_VALUE
INSERT
INTO
t1
VALUES
(
90
);
--
error
ER_NO_PARTITION_FOR_GIVEN_VALUE
INSERT
INTO
t1
VALUES
(
100
);
--
error
ER_NO_PARTITION_FOR_GIVEN_VALUE
insert
INTO
t1
VALUES
(
110
);
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>
90
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>=
90
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
=
90
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
=
89
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>=
89
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>
89
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
=
100
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>=
100
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>
100
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#50104: Partitioned table with just 1 partion works with fk
--
echo
#
CREATE
TABLE
t2
(
id
INT
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t1
(
id
INT
NOT
NULL
AUTO_INCREMENT
,
parent_id
INT
DEFAULT
NULL
,
PRIMARY
KEY
(
id
),
KEY
parent_id
(
parent_id
)
)
ENGINE
=
InnoDB
;
ALTER
TABLE
t1
PARTITION
BY
HASH
(
id
)
PARTITIONS
1
;
--
error
ER_FOREIGN_KEY_ON_PARTITIONED
ALTER
TABLE
t1
ADD
CONSTRAINT
test_ibfk_1
FOREIGN
KEY
(
parent_id
)
REFERENCES
t2
(
id
);
ALTER
TABLE
t1
PARTITION
BY
HASH
(
id
)
PARTITIONS
2
;
--
error
ER_FOREIGN_KEY_ON_PARTITIONED
ALTER
TABLE
t1
ADD
CONSTRAINT
test_ibfk_1
FOREIGN
KEY
(
parent_id
)
REFERENCES
t2
(
id
);
DROP
TABLE
t1
,
t2
;
#
#
# Bug#47029: Crash when reorganize partition with subpartition
# Bug#47029: Crash when reorganize partition with subpartition
#
#
...
...
mysql-test/t/partition_pruning.test
View file @
7297ec56
...
@@ -702,15 +702,29 @@ insert into t7 values (10),(30),(50);
...
@@ -702,15 +702,29 @@ insert into t7 values (10),(30),(50);
# leftmost intervals
# leftmost intervals
explain
partitions
select
*
from
t7
where
a
<
5
;
explain
partitions
select
*
from
t7
where
a
<
5
;
explain
partitions
select
*
from
t7
where
a
<
9
;
explain
partitions
select
*
from
t7
where
a
<=
9
;
explain
partitions
select
*
from
t7
where
a
=
9
;
explain
partitions
select
*
from
t7
where
a
>=
9
;
explain
partitions
select
*
from
t7
where
a
>
9
;
explain
partitions
select
*
from
t7
where
a
<
10
;
explain
partitions
select
*
from
t7
where
a
<
10
;
explain
partitions
select
*
from
t7
where
a
<=
10
;
explain
partitions
select
*
from
t7
where
a
<=
10
;
explain
partitions
select
*
from
t7
where
a
=
10
;
explain
partitions
select
*
from
t7
where
a
=
10
;
explain
partitions
select
*
from
t7
where
a
>=
10
;
explain
partitions
select
*
from
t7
where
a
>
10
;
#rightmost intervals
#rightmost intervals
explain
partitions
select
*
from
t7
where
a
<
89
;
explain
partitions
select
*
from
t7
where
a
<=
89
;
explain
partitions
select
*
from
t7
where
a
=
89
;
explain
partitions
select
*
from
t7
where
a
>
89
;
explain
partitions
select
*
from
t7
where
a
>=
89
;
explain
partitions
select
*
from
t7
where
a
<
90
;
explain
partitions
select
*
from
t7
where
a
<
90
;
explain
partitions
select
*
from
t7
where
a
<=
90
;
explain
partitions
select
*
from
t7
where
a
=
90
;
explain
partitions
select
*
from
t7
where
a
=
90
;
explain
partitions
select
*
from
t7
where
a
>
90
;
explain
partitions
select
*
from
t7
where
a
>
90
;
explain
partitions
select
*
from
t7
where
a
>=
90
;
explain
partitions
select
*
from
t7
where
a
>=
90
;
explain
partitions
select
*
from
t7
where
a
>
91
;
# misc intervals
# misc intervals
explain
partitions
select
*
from
t7
where
a
>
11
and
a
<
29
;
explain
partitions
select
*
from
t7
where
a
>
11
and
a
<
29
;
...
@@ -728,15 +742,29 @@ insert into t7 values (10),(30),(50);
...
@@ -728,15 +742,29 @@ insert into t7 values (10),(30),(50);
# leftmost intervals
# leftmost intervals
explain
partitions
select
*
from
t7
where
a
<
5
;
explain
partitions
select
*
from
t7
where
a
<
5
;
explain
partitions
select
*
from
t7
where
a
<
9
;
explain
partitions
select
*
from
t7
where
a
<=
9
;
explain
partitions
select
*
from
t7
where
a
=
9
;
explain
partitions
select
*
from
t7
where
a
>=
9
;
explain
partitions
select
*
from
t7
where
a
>
9
;
explain
partitions
select
*
from
t7
where
a
<
10
;
explain
partitions
select
*
from
t7
where
a
<
10
;
explain
partitions
select
*
from
t7
where
a
<=
10
;
explain
partitions
select
*
from
t7
where
a
<=
10
;
explain
partitions
select
*
from
t7
where
a
=
10
;
explain
partitions
select
*
from
t7
where
a
=
10
;
explain
partitions
select
*
from
t7
where
a
>=
10
;
explain
partitions
select
*
from
t7
where
a
>
10
;
#rightmost intervals
#rightmost intervals
explain
partitions
select
*
from
t7
where
a
<
89
;
explain
partitions
select
*
from
t7
where
a
<=
89
;
explain
partitions
select
*
from
t7
where
a
=
89
;
explain
partitions
select
*
from
t7
where
a
>
89
;
explain
partitions
select
*
from
t7
where
a
>=
89
;
explain
partitions
select
*
from
t7
where
a
<
90
;
explain
partitions
select
*
from
t7
where
a
<
90
;
explain
partitions
select
*
from
t7
where
a
<=
90
;
explain
partitions
select
*
from
t7
where
a
=
90
;
explain
partitions
select
*
from
t7
where
a
=
90
;
explain
partitions
select
*
from
t7
where
a
>
90
;
explain
partitions
select
*
from
t7
where
a
>
90
;
explain
partitions
select
*
from
t7
where
a
>=
90
;
explain
partitions
select
*
from
t7
where
a
>=
90
;
explain
partitions
select
*
from
t7
where
a
>
91
;
# misc intervals
# misc intervals
explain
partitions
select
*
from
t7
where
a
>
11
and
a
<
29
;
explain
partitions
select
*
from
t7
where
a
>
11
and
a
<
29
;
...
...
mysql-test/t/partition_range.test
View file @
7297ec56
...
@@ -9,6 +9,24 @@
...
@@ -9,6 +9,24 @@
drop
table
if
exists
t1
,
t2
;
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
--
enable_warnings
--
echo
#
--
echo
# Bug#48229: group by performance issue of partitioned table
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
KEY
a
(
a
,
b
)
)
PARTITION
BY
HASH
(
a
)
PARTITIONS
1
;
# insert some rows (i.e. so that rows/blocks > 1)
INSERT
INTO
t1
VALUES
(
0
,
580092
),
(
3
,
894076
),
(
4
,
805483
),
(
4
,
913540
),
(
6
,
611137
),
(
8
,
171602
),
(
9
,
599495
),
(
9
,
746305
),
(
10
,
272829
),
(
10
,
847519
),
(
12
,
258869
),
(
12
,
929028
),
(
13
,
288970
),
(
15
,
20971
),
(
15
,
105839
),
(
16
,
788272
),
(
17
,
76914
),
(
18
,
827274
),
(
19
,
802258
),
(
20
,
123677
),
(
20
,
587729
),
(
22
,
701449
),
(
25
,
31565
),
(
25
,
230782
),
(
25
,
442887
),
(
25
,
733139
),
(
25
,
851020
);
# Before the fix the 'Extra' column showed 'Using index for group-by'
EXPLAIN
SELECT
a
,
MAX
(
b
)
FROM
t1
WHERE
a
IN
(
10
,
100
,
3
)
GROUP
BY
a
;
DROP
TABLE
t1
;
#
#
# BUG 33429: Succeeds in adding partition when maxvalue on last partition
# BUG 33429: Succeeds in adding partition when maxvalue on last partition
#
#
...
...
sql/ha_partition.cc
View file @
7297ec56
...
@@ -5090,6 +5090,7 @@ int ha_partition::info(uint flag)
...
@@ -5090,6 +5090,7 @@ int ha_partition::info(uint flag)
file
=
m_file
[
handler_instance
];
file
=
m_file
[
handler_instance
];
file
->
info
(
HA_STATUS_CONST
);
file
->
info
(
HA_STATUS_CONST
);
stats
.
block_size
=
file
->
stats
.
block_size
;
stats
.
create_time
=
file
->
stats
.
create_time
;
stats
.
create_time
=
file
->
stats
.
create_time
;
ref_length
=
m_ref_length
;
ref_length
=
m_ref_length
;
}
}
...
@@ -6454,9 +6455,22 @@ void ha_partition::release_auto_increment()
...
@@ -6454,9 +6455,22 @@ void ha_partition::release_auto_increment()
ulonglong
next_auto_inc_val
;
ulonglong
next_auto_inc_val
;
lock_auto_increment
();
lock_auto_increment
();
next_auto_inc_val
=
ha_data
->
next_auto_inc_val
;
next_auto_inc_val
=
ha_data
->
next_auto_inc_val
;
/*
If the current auto_increment values is lower than the reserved
value, and the reserved value was reserved by this thread,
we can lower the reserved value.
*/
if
(
next_insert_id
<
next_auto_inc_val
&&
if
(
next_insert_id
<
next_auto_inc_val
&&
auto_inc_interval_for_cur_row
.
maximum
()
>=
next_auto_inc_val
)
auto_inc_interval_for_cur_row
.
maximum
()
>=
next_auto_inc_val
)
ha_data
->
next_auto_inc_val
=
next_insert_id
;
{
THD
*
thd
=
ha_thd
();
/*
Check that we do not lower the value because of a failed insert
with SET INSERT_ID, i.e. forced/non generated values.
*/
if
(
thd
->
auto_inc_intervals_forced
.
maximum
()
<
next_insert_id
)
ha_data
->
next_auto_inc_val
=
next_insert_id
;
}
DBUG_PRINT
(
"info"
,
(
"ha_data->next_auto_inc_val: %lu"
,
DBUG_PRINT
(
"info"
,
(
"ha_data->next_auto_inc_val: %lu"
,
(
ulong
)
ha_data
->
next_auto_inc_val
));
(
ulong
)
ha_data
->
next_auto_inc_val
));
...
...
sql/sql_partition.cc
View file @
7297ec56
...
@@ -2876,6 +2876,7 @@ int get_partition_id_range(partition_info *part_info,
...
@@ -2876,6 +2876,7 @@ int get_partition_id_range(partition_info *part_info,
*
func_value
=
part_func_value
;
*
func_value
=
part_func_value
;
if
(
unsigned_flag
)
if
(
unsigned_flag
)
part_func_value
-=
0x8000000000000000ULL
;
part_func_value
-=
0x8000000000000000ULL
;
/* Search for the partition containing part_func_value */
while
(
max_part_id
>
min_part_id
)
while
(
max_part_id
>
min_part_id
)
{
{
loc_part_id
=
(
max_part_id
+
min_part_id
)
/
2
;
loc_part_id
=
(
max_part_id
+
min_part_id
)
/
2
;
...
@@ -3015,11 +3016,17 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
...
@@ -3015,11 +3016,17 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
part_end_val
=
range_array
[
loc_part_id
];
part_end_val
=
range_array
[
loc_part_id
];
if
(
left_endpoint
)
if
(
left_endpoint
)
{
{
DBUG_ASSERT
(
part_func_value
>
part_end_val
?
(
loc_part_id
==
max_partition
&&
!
part_info
->
defined_max_value
)
:
1
);
/*
/*
In case of PARTITION p VALUES LESS THAN MAXVALUE
In case of PARTITION p VALUES LESS THAN MAXVALUE
the maximum value is in the current partition.
the maximum value is in the current (last) partition.
If value is equal or greater than the endpoint,
the range starts from the next partition.
*/
*/
if
(
part_func_value
=
=
part_end_val
&&
if
(
part_func_value
>
=
part_end_val
&&
(
loc_part_id
<
max_partition
||
!
part_info
->
defined_max_value
))
(
loc_part_id
<
max_partition
||
!
part_info
->
defined_max_value
))
loc_part_id
++
;
loc_part_id
++
;
}
}
...
@@ -4273,6 +4280,12 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
...
@@ -4273,6 +4280,12 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
{
{
DBUG_ENTER
(
"prep_alter_part_table"
);
DBUG_ENTER
(
"prep_alter_part_table"
);
/* Foreign keys on partitioned tables are not supported, waits for WL#148 */
if
(
table
->
part_info
&&
(
alter_info
->
flags
&
ALTER_FOREIGN_KEY
))
{
my_error
(
ER_FOREIGN_KEY_ON_PARTITIONED
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
}
/*
/*
We are going to manipulate the partition info on the table object
We are going to manipulate the partition info on the table object
so we need to ensure that the data structure of the table object
so we need to ensure that the data structure of the table object
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment