mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Removed redundant partitioning check
This check was introduced in602a222
and then became redundant in ad1553e, where we attempt to open a table even for non-copy algorithms. Added missing test case from602a222
. Part of MDEV-17805 - Remove InnoDB cache for temporary tables.
This commit is contained in:
@ -580,6 +580,33 @@ DROP TABLE t1;
|
|||||||
# Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
|
# Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
|
||||||
# table unusable".
|
# table unusable".
|
||||||
#
|
#
|
||||||
|
CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a))
|
||||||
|
ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2;
|
||||||
|
INSERT INTO t1 values (0,1), (1,2);
|
||||||
|
# The below ALTER should fail. It should leave the
|
||||||
|
# table in its original, non-corrupted, usable state.
|
||||||
|
ALTER TABLE t1 ADD UNIQUE KEY (b);
|
||||||
|
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
|
||||||
|
# The below statements should succeed, as ALTER should
|
||||||
|
# have left table intact.
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` bigint(20) NOT NULL,
|
||||||
|
`b` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
|
PARTITION BY KEY (`a`)
|
||||||
|
PARTITIONS 2
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
1 2
|
||||||
|
0 1
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
|
||||||
|
# table unusable".
|
||||||
|
#
|
||||||
DROP TABLE IF EXISTS t1;
|
DROP TABLE IF EXISTS t1;
|
||||||
CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a))
|
CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a))
|
||||||
ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2;
|
ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2;
|
||||||
|
@ -665,6 +665,25 @@ OPTIMIZE TABLE t1;
|
|||||||
SET SESSION sql_mode = @old_mode;
|
SET SESSION sql_mode = @old_mode;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
|
||||||
|
--echo # table unusable".
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a))
|
||||||
|
ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2;
|
||||||
|
INSERT INTO t1 values (0,1), (1,2);
|
||||||
|
--echo # The below ALTER should fail. It should leave the
|
||||||
|
--echo # table in its original, non-corrupted, usable state.
|
||||||
|
--error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
|
||||||
|
ALTER TABLE t1 ADD UNIQUE KEY (b);
|
||||||
|
--echo # The below statements should succeed, as ALTER should
|
||||||
|
--echo # have left table intact.
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
|
--echo # Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
|
||||||
--echo # table unusable".
|
--echo # table unusable".
|
||||||
|
@ -20,7 +20,7 @@ alter table t1 partition by system_time (
|
|||||||
partition p0 history,
|
partition p0 history,
|
||||||
partition pn current
|
partition pn current
|
||||||
);
|
);
|
||||||
ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `#sql-temporary`
|
ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
|
||||||
create or replace table t (
|
create or replace table t (
|
||||||
a int primary key,
|
a int primary key,
|
||||||
row_start bigint unsigned as row start invisible,
|
row_start bigint unsigned as row start invisible,
|
||||||
|
@ -21,7 +21,6 @@ create or replace table t1(
|
|||||||
period for system_time(row_start, row_end)
|
period for system_time(row_start, row_end)
|
||||||
) engine=InnoDB with system versioning;
|
) engine=InnoDB with system versioning;
|
||||||
|
|
||||||
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
|
|
||||||
--error ER_VERS_FIELD_WRONG_TYPE
|
--error ER_VERS_FIELD_WRONG_TYPE
|
||||||
alter table t1 partition by system_time (
|
alter table t1 partition by system_time (
|
||||||
partition p0 history,
|
partition p0 history,
|
||||||
|
@ -5055,43 +5055,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db,
|
|||||||
thd->thread_specific_used= TRUE;
|
thd->thread_specific_used= TRUE;
|
||||||
create_info->table= table; // Store pointer to table
|
create_info->table= table; // Store pointer to table
|
||||||
}
|
}
|
||||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
|
||||||
else if (thd->work_part_info && frm_only)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
For partitioned tables we can't find some problems with table
|
|
||||||
until table is opened. Therefore in order to disallow creation
|
|
||||||
of corrupted tables we have to try to open table as the part
|
|
||||||
of its creation process.
|
|
||||||
In cases when both .FRM and SE part of table are created table
|
|
||||||
is implicitly open in ha_create_table() call.
|
|
||||||
In cases when we create .FRM without SE part we have to open
|
|
||||||
table explicitly.
|
|
||||||
*/
|
|
||||||
TABLE table;
|
|
||||||
TABLE_SHARE share;
|
|
||||||
|
|
||||||
init_tmp_table_share(thd, &share, db.str, 0, table_name.str, path);
|
|
||||||
|
|
||||||
bool result= (open_table_def(thd, &share, GTS_TABLE) ||
|
|
||||||
open_table_from_share(thd, &share, &empty_clex_str, 0,
|
|
||||||
(uint) READ_ALL, 0, &table, true));
|
|
||||||
if (!result)
|
|
||||||
(void) closefrm(&table);
|
|
||||||
|
|
||||||
free_table_share(&share);
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
char frm_name[FN_REFLEN];
|
|
||||||
strxnmov(frm_name, sizeof(frm_name), path, reg_ext, NullS);
|
|
||||||
(void) mysql_file_delete(key_file_frm, frm_name, MYF(0));
|
|
||||||
(void) file->ha_create_partitioning_metadata(path, NULL, CHF_DELETE_FLAG);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
error= 0;
|
error= 0;
|
||||||
err:
|
err:
|
||||||
THD_STAGE_INFO(thd, stage_after_create);
|
THD_STAGE_INFO(thd, stage_after_create);
|
||||||
|
Reference in New Issue
Block a user