Skip to content

Commit

Permalink
wl#11571 : Deprecate Shared tablespaces in partitioned table
Browse files Browse the repository at this point in the history
- Added a deprecation warning to be thrown when a (sub)partition
  of a partitioned table is created in a shared tablespace.
- Added an internal error handler to make sure this warning is
  thrown only once if there are more then one (sub)partitions
  are being created in shared tablespaces.

RB : 19932
Reviewed by : Allen Lai <[email protected]>
              Kevin Lewis <[email protected]>
              Dyre Tjeldvoll <[email protected]>
  • Loading branch information
mayprasa committed Jul 12, 2018
1 parent eaf6b46 commit e08dee4
Show file tree
Hide file tree
Showing 19 changed files with 449 additions and 1 deletion.
8 changes: 8 additions & 0 deletions mysql-test/r/mdl_tablespace.result
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,8 @@ ENGINE=InnoDB
PARTITION BY RANGE (a)
PARTITIONS 1
(PARTITION P1 VALUES LESS THAN (2) TABLESPACE ts1);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
#############################################
# Case1: Checking TRUNCATE TABLE
# Sending 'TRUNCATE TABLE t1;'
Expand Down Expand Up @@ -900,6 +902,8 @@ CREATE TABLE t3 ( a INT NOT NULL, PRIMARY KEY (a)) ENGINE=InnoDB PARTITION BY RA
SET DEBUG_SYNC= 'now WAIT_FOR got_lock';
SET DEBUG_SYNC= 'now SIGNAL cont';
# Reaping 'CREATE TABLE'
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
#############################################
# Case5: Checking CREATE TABLE LIKE
SET DEBUG_SYNC= 'RESET';
Expand All @@ -911,6 +915,8 @@ CREATE TABLE t4 LIKE t3;;
SET DEBUG_SYNC= 'now WAIT_FOR got_lock';
SET DEBUG_SYNC= 'now SIGNAL cont';
# Reaping 'CREATE TABLE LIKE'
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
#############################################
# Case6: Checking ALTER TABLE ... PARTITION
CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.ibd';
Expand All @@ -923,6 +929,8 @@ ALTER TABLE t2 ADD PARTITION (partition p2 values less than (4) tablespace ts2);
SET DEBUG_SYNC= 'now WAIT_FOR got_lock';
SET DEBUG_SYNC= 'now SIGNAL cont';
# Reaping 'ALTER TABLE'
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
#############################################
# Case7: Checking LOCK TABLE t2 WRITE
SET DEBUG_SYNC= 'RESET';
Expand Down
10 changes: 10 additions & 0 deletions mysql-test/r/partition.result
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,11 @@ partitions 3
(partition x1 tablespace ts1,
partition x2 tablespace ts2,
partition x3 tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
CREATE TABLE t2 LIKE t1;
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
Expand Down Expand Up @@ -953,6 +957,8 @@ partitions 3
(partition x1 values in (1,2,9,4) tablespace ts1,
partition x2 values in (3, 11, 5, 7) tablespace ts2,
partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
Expand All @@ -976,6 +982,8 @@ partitions 3
(partition x1 values in (1,2,9,4) tablespace ts1,
partition x2 values in (3, 11, 5, 7) tablespace ts2,
partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
Expand All @@ -998,6 +1006,8 @@ partition by list (b*a)
(partition x1 values in (1) tablespace ts1,
partition x2 values in (3, 11, 5, 7) tablespace ts2,
partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/r/partition_hash.result
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ partitions 3
(partition x1 tablespace ts1,
partition x2 tablespace ts2,
partition x3 tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
insert into t1 values (1,1,1);
SHOW CREATE TABLE t1;
Table Create Table
Expand Down Expand Up @@ -255,6 +257,8 @@ partitions 3
(partition x1 tablespace ts1,
partition x2 tablespace ts2,
partition x3 tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
select * from t1;
a b c
SHOW CREATE TABLE t1;
Expand Down
6 changes: 6 additions & 0 deletions mysql-test/r/partition_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,8 @@ PRIMARY KEY (`f1`,`f4`)
PARTITION BY LIST (`f4`)
(PARTITION p0 VALUES IN (0) ENGINE = InnoDB,
PARTITION p1 VALUES IN (1) DATA DIRECTORY = 'MYSQL_TMP_DIR/temp_tblspc' ENGINE = InnoDB);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
Expand Down Expand Up @@ -1133,6 +1135,8 @@ PRIMARY KEY (`f1`,`f4`)
PARTITION BY LIST (`f4`)
(PARTITION p0 VALUES IN (0) TABLESPACE ts1 ENGINE = InnoDB,
PARTITION p1 VALUES IN (1) TABLESPACE ts2 ENGINE = InnoDB);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
Expand Down Expand Up @@ -1171,6 +1175,8 @@ PARTITION BY LIST (`f4`)
PARTITION p1 VALUES IN (1) TABLESPACE innodb_file_per_table DATA DIRECTORY='MYSQL_TMP_DIR/temp_dir' ENGINE = InnoDB,
PARTITION p2 VALUES IN (2) TABLESPACE innodb_file_per_table ENGINE = InnoDB,
PARTITION p3 VALUES IN (3) TABLESPACE innodb_system ENGINE = InnoDB);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/r/partition_innodb_tablespace.result
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ PARTITION p3 VALUES LESS THAN (300) TABLESPACE innodb_file_per_table
(SUBPARTITION sp9 TABLESPACE ts_part4,
SUBPARTITION sp10,
SUBPARTITION sp11));
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
Expand Down Expand Up @@ -444,6 +446,8 @@ PARTITION p3 VALUES LESS THAN (300) TABLESPACE innodb_file_per_table
(SUBPARTITION sp9 TABLESPACE ts_part4,
SUBPARTITION sp10,
SUBPARTITION sp11));
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/r/partition_list.result
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ c int not null,
primary key(a,b))
partition by list (a)
(partition x1 values in (1,2,9,4) tablespace ts1);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
Expand Down
14 changes: 14 additions & 0 deletions mysql-test/r/partition_range.result
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ partitions 3
(partition x1 values less than (5) tablespace ts1,
partition x2 values less than (10) tablespace ts2,
partition x3 values less than maxvalue tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
INSERT into t1 values (1, 1, 1);
INSERT into t1 values (6, 1, 1);
INSERT into t1 values (10, 1, 1);
Expand Down Expand Up @@ -374,6 +376,8 @@ partitions 3
(partition x1 values less than (5) tablespace ts1,
partition x2 values less than (10) tablespace ts2,
partition x3 values less than maxvalue tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
select * from t1;
a b c
1 1 1
Expand Down Expand Up @@ -402,6 +406,8 @@ partitions 3
(partition x1 values less than (5) tablespace ts1,
partition x2 values less than (10) tablespace ts2,
partition x3 values less than maxvalue tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
INSERT into t1 values (1, 1, 1);
INSERT into t1 values (6, 1, 1);
INSERT into t1 values (10, 1, 1);
Expand Down Expand Up @@ -429,6 +435,8 @@ partitions 3
(partition x1 values less than (5) tablespace ts1,
partition x2 values less than (10) tablespace ts2,
partition x3 values less than maxvalue tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
select * from t1;
a b c
1 1 1
Expand Down Expand Up @@ -457,6 +465,8 @@ partitions 3
(partition x1 values less than (5) tablespace ts1,
partition x2 values less than (10) tablespace ts2,
partition x3 values less than (15) tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
INSERT into t1 values (1, 1, 1);
INSERT into t1 values (6, 1, 1);
INSERT into t1 values (10, 1, 1);
Expand Down Expand Up @@ -485,6 +495,8 @@ partitions 3
(partition x1 values less than (5) tablespace ts1,
partition x2 values less than (10) tablespace ts2,
partition x3 values less than (15) tablespace ts3);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
select * from t1;
a b c
1 1 1
Expand Down Expand Up @@ -597,6 +609,8 @@ partition x2 values less than (5)
( subpartition x21 tablespace ts1 nodegroup 0,
subpartition x22 tablespace ts2 nodegroup 1)
);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SELECT * from t1;
a b c
SHOW CREATE TABLE t1;
Expand Down
20 changes: 20 additions & 0 deletions mysql-test/suite/innodb/r/create_tablespace_partition.result
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ SUBPARTITION subpart24),
PARTITION thousands VALUES LESS THAN (10000)
(SUBPARTITION subpart31,
SUBPARTITION subpart32));
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t2 (a INT, b INT)
ENGINE = InnoDB
Expand All @@ -35,11 +37,15 @@ SUBPARTITION subpart22 TABLESPACE=`s``1`),
PARTITION thousands VALUES LESS THAN (10000)
(SUBPARTITION subpart31 DATA DIRECTORY 'MYSQL_TMP_DIR',
SUBPARTITION subpart32 DATA DIRECTORY 'MYSQL_TMP_DIR' TABLESPACE `innodb_file_per_table`));
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
ALTER TABLE t1 ALGORITHM=COPY, ADD PARTITION
(PARTITION tenthousands VALUES LESS THAN (20000));
ERROR 0A000: ALGORITHM=COPY/INPLACE is not supported. Reason: Partition specific operations do not yet support LOCK/ALGORITHM. Try ALGORITHM=DEFAULT.
ALTER TABLE t1 ALGORITHM=DEFAULT, ADD PARTITION
(PARTITION tenthousands VALUES LESS THAN (20000));
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
# Only allow tablespace name as ident, not text. I.e. no 'single' quotes.
ALTER TABLE t1 ALGORITHM=COPY, ADD PARTITION
(PARTITION twentythousands VALUES LESS THAN (30000)
Expand All @@ -60,6 +66,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
ALTER TABLE t1 ALGORITHM=DEFAULT, ADD PARTITION
(PARTITION twentythousands VALUES LESS THAN (30000)
TABLESPACE = "innodb_system");
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
ALTER TABLE t1 ALGORITHM=DEFAULT, ADD PARTITION
(PARTITION thirtythousands VALUES LESS THAN (40000)
TABLESPACE = `innodb_file_per_table`);
Expand Down Expand Up @@ -99,9 +107,13 @@ SUBPARTITION p40k_2 TABLESPACE = innodb_file_per_table DATA DIRECTORY = 'MYSQL_T
SET GLOBAL innodb_file_per_table = OFF;
ALTER TABLE t1 ALGORITHM=DEFAULT, ADD PARTITION
(PARTITION fiftythousands VALUES LESS THAN (60000));
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
ALTER TABLE t1 ALGORITHM=DEFAULT, ADD PARTITION
(PARTITION sixtythousands VALUES LESS THAN (70000)
TABLESPACE = `innodb_system`);
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
ALTER TABLE t1 ALGORITHM=DEFAULT, ADD PARTITION
(PARTITION seventythousands VALUES LESS THAN (80000)
TABLESPACE = `innodb_file_per_table`);
Expand All @@ -121,6 +133,8 @@ ALTER TABLE t1 ALGORITHM=DEFAULT, ADD PARTITION
(PARTITION ninetythousands VALUES LESS THAN (100000)
(SUBPARTITION p90k_1 TABLESPACE = `innodb_file_per_table`,
SUBPARTITION p90k_2 TABLESPACE = `innodb_system`));
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
FLUSH TABLES;
=== information_schema.innodb_sys_tables and innodb_sys_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
Expand Down Expand Up @@ -388,6 +402,8 @@ SUBPARTITION seventythousandssp1 ENGINE = InnoDB),
PARTITION ninetythousands VALUES LESS THAN (100000)
(SUBPARTITION p90k_1 ENGINE = InnoDB,
SUBPARTITION p90k_2 TABLESPACE = innodb_system ENGINE = InnoDB)) */;
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
Expand All @@ -403,6 +419,8 @@ SUBPARTITION subpart22 TABLESPACE = `s``1` ENGINE = InnoDB),
PARTITION thousands VALUES LESS THAN (10000)
(SUBPARTITION subpart31 ENGINE = InnoDB,
SUBPARTITION subpart32 ENGINE = InnoDB)) */;
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
=== information_schema.innodb_sys_tables and innodb_sys_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
test/t1#p#fiftythousands#sp#fiftythousandssp0 s1 161 5 Dynamic 0 General
Expand Down Expand Up @@ -531,6 +549,8 @@ CREATE TABLE ti
ENGINE=INNODB
PARTITION BY HASH( MONTH(tr_date) )
PARTITIONS 6;
Warnings:
Warning 1681 'InnoDB : A table partition in a shared tablespace' is deprecated and will be removed in a future release.
DROP TABLE t1,ti;
DROP TABLESPACE ts1;
#
Expand Down
Loading

0 comments on commit e08dee4

Please sign in to comment.