mirror of
https://github.com/MariaDB/server.git
synced 2025-10-12 12:25:37 +03:00
Fix partitioning for trx_id-versioned tables. `partition by hash`, `range` and others now work. `partition by system_time` is forbidden. Currently we cannot use row_start and row_end in `partition by`, because insertion of versioned field is done by engine's handler, as well as row_start/row_end's value set up, which is a transaction id -- so it's also forbidden. The drawback is that it's now impossible to use `partition by key()` without parameters for such tables, because it references row_start and row_end implicitly. * add handler::vers_can_native() * drop Table_scope_and_contents_source_st::vers_native() * drop partition_element::find_engine_flag as unused * forbid versioning partitioning for trx_id as not supported * adopt vers tests for trx_id partitioning * forbid any row_end referencing in `partition by` clauses, including implicit `by key()`
81 lines
2.4 KiB
Plaintext
81 lines
2.4 KiB
Plaintext
--source include/have_innodb.inc
|
|
--source include/have_partition.inc
|
|
|
|
--echo # MDEV-15951 system versioning by trx id doesn't work with partitioning
|
|
--echo # currently trx_id does not support partitioning by system_time
|
|
--error ER_VERS_FIELD_WRONG_TYPE
|
|
create or replace table t1(
|
|
i int,
|
|
row_start bigint unsigned generated always as row start,
|
|
row_end bigint unsigned generated always as row end,
|
|
period for system_time(row_start, row_end)
|
|
) engine=InnoDB with system versioning partition by system_time (
|
|
partition p0 history,
|
|
partition pn current
|
|
);
|
|
|
|
create or replace table t1(
|
|
i int,
|
|
row_start bigint unsigned generated always as row start,
|
|
row_end bigint unsigned generated always as row end,
|
|
period for system_time(row_start, row_end)
|
|
) engine=InnoDB with system versioning;
|
|
|
|
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
|
|
--error ER_VERS_FIELD_WRONG_TYPE
|
|
alter table t1 partition by system_time (
|
|
partition p0 history,
|
|
partition pn current
|
|
);
|
|
|
|
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
|
create or replace table t (
|
|
a int primary key,
|
|
row_start bigint unsigned as row start invisible,
|
|
row_end bigint unsigned as row end invisible,
|
|
period for system_time(row_start, row_end)
|
|
) engine=innodb with system versioning
|
|
partition by key() (
|
|
partition p1,
|
|
partition p2
|
|
);
|
|
|
|
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
|
create or replace table t (
|
|
a int primary key,
|
|
row_start bigint unsigned as row start invisible,
|
|
row_end bigint unsigned as row end invisible,
|
|
period for system_time(row_start, row_end)
|
|
) engine=innodb with system versioning
|
|
partition by key(a, row_start) (
|
|
partition p1,
|
|
partition p2
|
|
);
|
|
|
|
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
|
create or replace table t (
|
|
a int primary key,
|
|
row_start bigint unsigned as row start invisible,
|
|
row_end bigint unsigned as row end invisible,
|
|
period for system_time(row_start, row_end)
|
|
) engine=innodb with system versioning
|
|
partition by hash(a + row_end * 2) (
|
|
partition p1,
|
|
partition p2
|
|
);
|
|
|
|
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
|
create or replace table t (
|
|
a int primary key,
|
|
row_start bigint unsigned as row start invisible,
|
|
row_end bigint unsigned as row end invisible,
|
|
period for system_time(row_start, row_end)
|
|
) engine=innodb with system versioning
|
|
partition by range columns (a, row_start) (
|
|
partition p1 values less than (100, 100)
|
|
);
|
|
|
|
--echo # Test cleanup
|
|
drop database test;
|
|
create database test;
|