You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implementing partitioning natively in InnoDB, so it does not need
ha_partition generic partition engine for supporting partitioning.
ha_partition uses one ha_innobase handler for each partition which
does not share common data with each other resulting in high resource
usage which this WL fix.
It also makes it easier to support other InnoDB features that partitioning
currently does not support.
A new handler ha_innopart is added, inheriting both ha_innobase (for InnoDB
access) and Partition_helper (for partitioning support, see wl#4807).
And to avoid a proxy object for Partition_handler (see wl#4807) it is also
inherited.
Also ha_partition is changed to inherit Partition_handler directly.
As a result of this there is no longer any need for .par files
for partitioned InnoDB tables, since InnoDB can use its internal
data dictionary for finding partitions during rename and delete.
The optimizer estimate is also changed, especially for
records_in_range, where all used partitions are checked instead
of only the biggest ones.
rb#7636
Approved by Krunal and Annamalai
Copy file name to clipboardExpand all lines: mysql-test/r/partition_column.result
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -101,7 +101,7 @@ Table Op Msg_type Msg_text
101
101
test.t1 analyze status OK
102
102
explain partitions select hex(a) from t1 where a like 'A_';
103
103
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
104
-
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 50.00 Using where
104
+
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 1 100.00 Using where
105
105
Warnings:
106
106
Warning 1681 'PARTITIONS' is deprecated and will be removed in a future release.
107
107
Note 1003 /* select#1 */ select hex(`test`.`t1`.`a`) AS `hex(a)` from `test`.`t1` where (`test`.`t1`.`a` like 'A_')
@@ -513,7 +513,7 @@ Table Op Msg_type Msg_text
513
513
test.t1 analyze status OK
514
514
explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1;
515
515
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
516
-
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 12.50 Using where
516
+
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 1 100.00 Using where
517
517
Warnings:
518
518
Warning 1681 'PARTITIONS' is deprecated and will be removed in a future release.
519
519
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = 1) and (`test`.`t1`.`a` = 1) and (`test`.`t1`.`b` <= 'A'))
@@ -683,7 +683,7 @@ Table Op Msg_type Msg_text
683
683
test.t1 analyze status OK
684
684
explain partitions select * from t1 where b < 4;
685
685
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
686
-
1 SIMPLE t1 p0,p11,p12,p21 ALL NULL NULL NULL NULL 7 33.33 Using where
686
+
1 SIMPLE t1 p0,p11,p12,p21 ALL NULL NULL NULL NULL 6 33.33 Using where
687
687
Warnings:
688
688
Warning 1681 'PARTITIONS' is deprecated and will be removed in a future release.
689
689
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`b` < 4)
explain partitions select * from t1 where a = 'a' AND c = 'd';
9
+
explain select * from t1 where a = 'a' AND c = 'd';
10
10
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
11
-
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 25.00 Using where
11
+
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 1 100.00 Using where
12
12
Warnings:
13
-
Warning 1681 'PARTITIONS' is deprecated and will be removed in a future release.
14
13
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = 'd') and (`test`.`t1`.`a` = 'a'))
@@ -764,8 +764,8 @@ PARTITION BY RANGE(YEAR(purchased))
764
764
SUBPARTITION BY HASH(TO_DAYS(purchased)) SUBPARTITIONS 2
765
765
(PARTITION p0 VALUES LESS THAN MAXVALUE
766
766
(SUBPARTITION sp0
767
-
DATA DIRECTORY = '/tmp/not-existing'
768
-
INDEX DIRECTORY = '/tmp/not-existing',
767
+
DATA DIRECTORY = '/tmp/not-existing'
768
+
INDEX DIRECTORY = '/tmp/not-existing',
769
769
SUBPARTITION sp1));
770
770
Warnings:
771
771
Warning 1618 <DATA DIRECTORY> option ignored
@@ -785,8 +785,8 @@ DROP TABLE t1;
785
785
CREATE TABLE t1 (id INT, purchased DATE)
786
786
PARTITION BY RANGE(YEAR(purchased))
787
787
(PARTITION p0 VALUES LESS THAN MAXVALUE
788
-
DATA DIRECTORY = '/tmp/not-existing'
789
-
INDEX DIRECTORY = '/tmp/not-existing');
788
+
DATA DIRECTORY = '/tmp/not-existing'
789
+
INDEX DIRECTORY = '/tmp/not-existing');
790
790
Warnings:
791
791
Warning 1618 <DATA DIRECTORY> option ignored
792
792
Warning 1618 <INDEX DIRECTORY> option ignored
@@ -1173,7 +1173,7 @@ partitions 2
1173
1173
(partition x1 values less than (4) tablespace ts1,
1174
1174
partition x2 values less than (8) tablespace ts2);
1175
1175
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
1176
-
CREATE TABLE t1 (
1176
+
CREATE TABLE t1 (
1177
1177
a int not null,
1178
1178
b int not null,
1179
1179
c int not null,
@@ -1294,21 +1294,21 @@ a int not null,
1294
1294
b int not null,
1295
1295
c int not null,
1296
1296
primary key (a,b))
1297
-
partition by key (a)
1297
+
partition by key (a)
1298
1298
subpartition by list (a+b)
1299
1299
( partition x1
1300
1300
( subpartition x11,
1301
1301
subpartition x12),
1302
-
partition x2
1302
+
partition x2
1303
1303
( subpartition x21,
1304
1304
subpartition x22)
1305
1305
);
1306
1306
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'list (a+b)
1307
1307
( partition x1
1308
1308
( subpartition x11,
1309
1309
subpartition x12),
1310
-
partition x2
1311
-
(' at line 7
1310
+
partition x2
1311
+
(' at line 7
1312
1312
CREATE TABLE t1 (
1313
1313
a int not null,
1314
1314
b int not null,
@@ -1340,7 +1340,7 @@ b int not null,
1340
1340
c int not null,
1341
1341
primary key(a,b))
1342
1342
partition by list (3+4)
1343
-
partitions 2
1343
+
partitions 2
1344
1344
(partition x1 values in (4) tablespace ts1,
1345
1345
partition x2 values in (8) tablespace ts2);
1346
1346
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
@@ -1745,7 +1745,7 @@ ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitio
1745
1745
DROP TABLE old;
1746
1746
#
1747
1747
# Bug #56709: Memory leaks at running the 5.1 test suite
1748
-
#
1748
+
#
1749
1749
CREATE TABLE t1 (a TIMESTAMP NOT NULL PRIMARY KEY);
1750
1750
ALTER TABLE t1
1751
1751
PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
@@ -1851,3 +1851,39 @@ pMax pMaxsp0 This is a long comment (2050 ascii characters) 50 pMax partition
1851
1851
pMax pMaxsp1 This is a long comment (2050 ascii characters) 50 pMax partition comment .80-!
1852
1852
DROP TABLE t1;
1853
1853
SET sql_mode = default;
1854
+
#
1855
+
# Test for increased coverage of misplaced record handling.
1856
+
#
1857
+
CREATE TABLE t1 (a int)
1858
+
PARTITION BY LIST (a)
1859
+
(PARTITION p1 VALUES IN (1),
1860
+
PARTITION p3 VALUES IN (3,5),
1861
+
PARTITION p6 VALUES IN (6,7));
1862
+
# Intentionally insert illegal rows into p1.
1863
+
CREATE TABLE t2 LIKE t1;
1864
+
ALTER TABLE t2 REMOVE PARTITIONING;
1865
+
INSERT INTO t2 VALUES (2),(3),(4),(6);
1866
+
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2 WITHOUT VALIDATION;
1867
+
# These should fail gracefully (WHERE used to not trigger pruning!)
1868
+
CALL mtr.add_suppression(" corrupted: row in wrong partition: ");
1869
+
INSERT INTO t1 VALUES (2);
1870
+
ERROR HY000: Table has no partition for value 2
1871
+
INSERT INTO t1 PARTITION (p1) VALUES (3);
1872
+
ERROR HY000: Found a row not matching the given partition set
1873
+
UPDATE t1 SET a = 3 WHERE (a % 3) != 0;
1874
+
ERROR HY000: Table has no partition for value 2
1875
+
UPDATE t1 PARTITION (p1) SET a = 3 WHERE (a % 3) != 0;
1876
+
ERROR HY000: Table has no partition for value 2
1877
+
UPDATE t1 PARTITION (p1) SET a = 5 WHERE (a % 3) = 0;
1878
+
ERROR HY000: Found a row not matching the given partition set
1879
+
UPDATE t1 PARTITION (p1) SET a = 3 WHERE (a % 5) > 3;
1880
+
ERROR HY000: Table has no partition for value 4
1881
+
UPDATE t1 PARTITION (p1,p6) SET a = 7 WHERE (a % 7) > 5;
1882
+
ERROR HY000: Found a row in wrong partition 0. Correct is 2 a:6
1883
+
DELETE FROM t1 PARTITION (p1) WHERE (a % 7) > 2;
1884
+
ERROR HY000: Found a row not matching the given partition set
1885
+
DELETE FROM t1 PARTITION (p1,p6) WHERE (a % 7) > 5;
1886
+
ERROR HY000: Found a row in wrong partition 0. Correct is 2 a:6
0 commit comments