Commit 98adcffe authored by Sergei Golubchik's avatar Sergei Golubchik

Revert "MDEV-17554 Auto-create new partition for system versioned tables with...

Revert "MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT"

This reverts commit 9894751a.
This reverts commit f707c83f.
parent 9894751a
......@@ -154,15 +154,3 @@ select * from t1;
a
1
drop table t1;
#
# MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT
#
# Don't auto-create new partition on DELETE HISTORY:
create or replace table t (a int)
with system versioning
partition by system_time limit 1000;
delete history from t;
select count(*) - 1 as hist_partitions from information_schema.partitions where table_name = 't' and table_schema = 'test';
hist_partitions
1
drop table t;
call mtr.add_suppression("need more HISTORY partitions");
call mtr.add_suppression("Duplicate partition name");
call mtr.add_suppression("Wrong partitioning type");
call mtr.add_suppression("Table 'test.t1' doesn't exist");
set system_versioning_alter_history=keep;
# Check conventional partitioning on temporal tables
create or replace table t1 (
......@@ -240,9 +237,7 @@ select @ts0 = @ts1;
select @ts2 = @ts3;
@ts2 = @ts3
1
#
# Rotation by LIMIT
#
## rotation by LIMIT
create or replace table t1 (x int)
with system versioning
partition by system_time limit 0 partitions 3;
......@@ -294,37 +289,7 @@ x
6
7
8
# Auto-create history partitions
create or replace table t1 (x int) with system versioning
partition by system_time limit 1000 auto_increment;
lock tables t1 write;
insert into t1 values (1);
update t1 set x= x + 1;
select state, info from information_schema.processlist where info like 'ALTER TABLE %';
state info
Waiting for table metadata lock ALTER TABLE `test`.`t1` ADD PARTITION (PARTITION `p1` HISTORY)
unlock tables;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME LIMIT 1000 AUTO_INCREMENT
(PARTITION `p0` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
### Test ALTER failure
set @lock_wait_timeout0= @@global.lock_wait_timeout;
set global lock_wait_timeout= 1;
create or replace table t1 (x int) with system versioning partition by system_time limit 1000;
lock tables t1 write;
insert t1 values (1);
insert t1 values (1);
unlock tables;
set global lock_wait_timeout= @lock_wait_timeout0;
#
# Rotation by INTERVAL
#
## rotation by INTERVAL
create or replace table t1 (x int)
with system versioning
partition by system_time interval 0 second partitions 3;
......@@ -337,7 +302,7 @@ partition by system_time interval 10 year partitions 3;
ERROR 22003: TIMESTAMP value is out of range in 'INTERVAL'
# INTERVAL and ALTER TABLE
create or replace table t1 (i int) with system versioning
partition by system_time interval 59 minute;
partition by system_time interval 1 hour;
set @ts=(select partition_description from information_schema.partitions
where table_schema='test' and table_name='t1' and partition_name='p0');
alter table t1 add column b int;
......@@ -351,16 +316,16 @@ alter table t1 add partition (partition p1 history, partition p2 history);
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
partition_name partition_ordinal_position partition_method timediff(partition_description, @ts)
p0 1 SYSTEM_TIME 00:00:00.000000
p1 2 SYSTEM_TIME 00:59:00.000000
p2 3 SYSTEM_TIME 01:58:00.000000
p1 2 SYSTEM_TIME 01:00:00.000000
p2 3 SYSTEM_TIME 02:00:00.000000
pn 4 SYSTEM_TIME NULL
Warnings:
Warning 1292 Incorrect time value: 'CURRENT'
alter table t1 drop partition p0;
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
partition_name partition_ordinal_position partition_method timediff(partition_description, @ts)
p1 1 SYSTEM_TIME 00:59:00.000000
p2 2 SYSTEM_TIME 01:58:00.000000
p1 1 SYSTEM_TIME 01:00:00.000000
p2 2 SYSTEM_TIME 02:00:00.000000
pn 3 SYSTEM_TIME NULL
Warnings:
Warning 1292 Incorrect time value: 'CURRENT'
......@@ -368,8 +333,8 @@ alter table t1 drop partition p2;
ERROR HY000: Can only drop oldest partitions when rotating by INTERVAL
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
partition_name partition_ordinal_position partition_method timediff(partition_description, @ts)
p1 1 SYSTEM_TIME 00:59:00.000000
p2 2 SYSTEM_TIME 01:58:00.000000
p1 1 SYSTEM_TIME 01:00:00.000000
p2 2 SYSTEM_TIME 02:00:00.000000
pn 3 SYSTEM_TIME NULL
Warnings:
Warning 1292 Incorrect time value: 'CURRENT'
......@@ -378,7 +343,6 @@ create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day
subpartition by key (i) subpartitions 2
(partition p1 history, partition pn current);
lock tables t1 write;
set timestamp=unix_timestamp('2001-02-03 10:20:40');
insert t1 values (1);
delete from t1;
......@@ -389,51 +353,28 @@ Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out o
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
select subpartition_name, partition_description from information_schema.partitions where table_schema='test' and table_name='t1';
subpartition_name partition_description
p1sp0 2001-02-04 00:00:00
p1sp1 2001-02-04 00:00:00
pnsp0 CURRENT
pnsp1 CURRENT
select * from t1 partition (p1);
i
1
2
select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
subpartition_name partition_description table_rows
p1sp0 2001-02-04 00:00:00 1
p1sp1 2001-02-04 00:00:00 1
pnsp0 CURRENT 0
pnsp1 CURRENT 0
set timestamp=unix_timestamp('2001-02-04 10:20:55');
alter table t1 add partition (partition p0 history, partition p2 history);
set timestamp=unix_timestamp('2001-02-04 10:30:00');
insert t1 values (4),(5);
set timestamp=unix_timestamp('2001-02-04 10:30:10');
update t1 set i=6 where i=5;
select subpartition_name, partition_description from information_schema.partitions where table_schema='test' and table_name='t1';
subpartition_name partition_description
p1sp0 2001-02-04 00:00:00
p1sp1 2001-02-04 00:00:00
p0sp0 2001-02-05 00:00:00
p0sp1 2001-02-05 00:00:00
p2sp0 2001-02-06 00:00:00
p2sp1 2001-02-06 00:00:00
pnsp0 CURRENT
pnsp1 CURRENT
select * from t1 partition (p1);
i
1
2
select * from t1 partition (p0);
i
5
select * from t1 partition (p2);
i
alter table t1 rebuild partition p0, p1, p2;
select * from t1 partition (p1);
i
1
select * from t1 partition (p0);
i
5
2
select * from t1 partition (p2);
i
select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
subpartition_name partition_description table_rows
p1sp0 2001-02-04 00:00:00 1
p1sp1 2001-02-04 00:00:00 0
p0sp0 2001-02-05 00:00:00 1
p0sp1 2001-02-05 00:00:00 1
p2sp0 2001-02-06 00:00:00 0
p2sp1 2001-02-06 00:00:00 0
pnsp0 CURRENT 0
pnsp1 CURRENT 2
## pruning check
set @ts=(select partition_description from information_schema.partitions
where table_schema='test' and table_name='t1' and partition_name='p0' limit 1);
......@@ -454,7 +395,6 @@ i
explain partitions select * from t1 for system_time all where row_end = @ts;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1_p1sp0,p1_p1sp1 # NULL NULL NULL NULL # #
unlock tables;
## INTERVAL ... STARTS
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day starts 'a';
......@@ -602,9 +542,6 @@ set timestamp= unix_timestamp('2001-01-01 00:00:00');
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day starts '2000-01-01 00:00:00'
partitions 3;
lock tables t1 write;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
# we are warned when we push to present:
insert into t1 values (0);
Warnings:
......@@ -647,13 +584,11 @@ i row_end
select *, row_end from t1 partition (p1);
i row_end
3 2000-01-04 00:00:01.000000
unlock tables;
# and this is how it usually goes:
set timestamp= unix_timestamp('2000-01-01 00:00:00');
# and this is how it usually goes:
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day
partitions 3;
lock tables t1 write;
insert into t1 values (0);
set timestamp= unix_timestamp('2000-01-01 00:00:01');
update t1 set i= i + 1;
......@@ -674,26 +609,12 @@ i row_end
select *, row_end from t1 partition (p1);
i row_end
1 2000-01-02 00:00:01.000000
2 2000-01-03 00:00:01.000000
3 2000-01-04 00:00:01.000000
select *, row_end from t1 partition (p2);
i row_end
select *, row_end from t1 partition (p3);
i row_end
alter table t1 rebuild partition p0, p1, p2, p3;
select *, row_end from t1 partition (p0);
i row_end
0 2000-01-01 00:00:01.000000
select *, row_end from t1 partition (p1);
i row_end
1 2000-01-02 00:00:01.000000
select *, row_end from t1 partition (p2);
i row_end
2 2000-01-03 00:00:01.000000
select *, row_end from t1 partition (p3);
i row_end
3 2000-01-04 00:00:01.000000
unlock tables;
drop tables t1, t2;
## Subpartitions
create or replace table t1 (x int)
......@@ -711,9 +632,9 @@ select * from t1 partition (pnsp1);
x
2
4
### warn about full partition
delete from t1 where x < 3;
delete from t1;
### warn about full partition
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of LIMIT, need more HISTORY partitions
......@@ -924,7 +845,7 @@ ERROR HY000: Can not DROP SYSTEM VERSIONING for table `t` partitioned BY SYSTEM_
create or replace table t1 (i int) with system versioning;
insert into t1 values (1), (2);
update t1 set i= 3;
alter table t1 partition by system_time interval 59 minute (partition p1 history, partition pn current);
alter table t1 partition by system_time interval 1 month (partition p1 history, partition pn current);
lock table t1 write;
alter table t1 add partition (partition p2 history);
insert into t1 values (4);
......
......@@ -164,23 +164,4 @@ update t1 set i = 0;
connection slave;
connection master;
drop table t1;
#
# MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT
#
create or replace table t1 (x int) with system versioning
partition by system_time limit 1000 auto_increment;
lock tables t1 write;
insert t1 values ();
delete from t1;
unlock tables;
select count(*) - 1 as hist_partitions from information_schema.partitions where table_name = 't1' and table_schema = 'test';
hist_partitions
2
connection slave;
select count(*) - 1 as hist_partitions from information_schema.partitions where table_name = 't1' and table_schema = 'test';
hist_partitions
2
connection master;
drop database test;
create database test;
include/rpl_end.inc
......@@ -169,15 +169,4 @@ insert into t1 values (1);
select * from t1;
drop table t1;
--echo #
--echo # MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT
--echo #
--echo # Don't auto-create new partition on DELETE HISTORY:
create or replace table t (a int)
with system versioning
partition by system_time limit 1000;
delete history from t;
select count(*) - 1 as hist_partitions from information_schema.partitions where table_name = 't' and table_schema = 'test';
drop table t;
--source suite/versioning/common_finish.inc
......@@ -3,11 +3,6 @@
-- source suite/versioning/engines.inc
call mtr.add_suppression("need more HISTORY partitions");
call mtr.add_suppression("Duplicate partition name");
call mtr.add_suppression("Wrong partitioning type");
call mtr.add_suppression("Table 'test.t1' doesn't exist");
let $wait_no_alter= select count(*) = 0 from information_schema.processlist where info like 'ALTER TABLE %';
let $wait_alter= select count(*) > 0 from information_schema.processlist where info like 'ALTER TABLE %';
set system_versioning_alter_history=keep;
--echo # Check conventional partitioning on temporal tables
......@@ -218,9 +213,7 @@ prepare stmt from @str; execute stmt; drop prepare stmt;
select @ts0 = @ts1;
select @ts2 = @ts3;
--echo #
--echo # Rotation by LIMIT
--echo #
--echo ## rotation by LIMIT
--error ER_PART_WRONG_VALUE
create or replace table t1 (x int)
with system versioning
......@@ -248,37 +241,8 @@ insert into t1 values (7), (8);
delete from t1;
select * from t1 partition (p1) order by x;
--echo # Auto-create history partitions
create or replace table t1 (x int) with system versioning
partition by system_time limit 1000 auto_increment;
lock tables t1 write;
insert into t1 values (1);
update t1 set x= x + 1;
--let $wait_condition= $wait_alter
--source include/wait_condition.inc
select state, info from information_schema.processlist where info like 'ALTER TABLE %';
unlock tables;
--let $wait_condition= $wait_no_alter
--source include/wait_condition.inc
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
--echo ### Test ALTER failure
set @lock_wait_timeout0= @@global.lock_wait_timeout;
set global lock_wait_timeout= 1;
create or replace table t1 (x int) with system versioning partition by system_time limit 1000;
lock tables t1 write;
insert t1 values (1);
--real_sleep 1
--let $wait_condition= $wait_no_alter
--source include/wait_condition.inc
insert t1 values (1);
unlock tables;
set global lock_wait_timeout= @lock_wait_timeout0;
--echo #
--echo # Rotation by INTERVAL
--echo #
--echo ## rotation by INTERVAL
--error ER_PART_WRONG_VALUE
create or replace table t1 (x int)
with system versioning
......@@ -294,7 +258,7 @@ partition by system_time interval 10 year partitions 3;
--echo # INTERVAL and ALTER TABLE
create or replace table t1 (i int) with system versioning
partition by system_time interval 59 minute;
partition by system_time interval 1 hour;
set @ts=(select partition_description from information_schema.partitions
where table_schema='test' and table_name='t1' and partition_name='p0');
......@@ -317,15 +281,12 @@ create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day
subpartition by key (i) subpartitions 2
(partition p1 history, partition pn current);
lock tables t1 write; # prevent partition auto-creation
set timestamp=unix_timestamp('2001-02-03 10:20:40');
insert t1 values (1); delete from t1;
set timestamp=unix_timestamp('2001-02-04 10:20:50');
insert t1 values (2); delete from t1;
select subpartition_name, partition_description from information_schema.partitions where table_schema='test' and table_name='t1';
select * from t1 partition (p1);
select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
set timestamp=unix_timestamp('2001-02-04 10:20:55');
alter table t1 add partition (partition p0 history, partition p2 history);
......@@ -334,15 +295,7 @@ insert t1 values (4),(5);
set timestamp=unix_timestamp('2001-02-04 10:30:10');
update t1 set i=6 where i=5;
select subpartition_name, partition_description from information_schema.partitions where table_schema='test' and table_name='t1';
select * from t1 partition (p1);
select * from t1 partition (p0);
select * from t1 partition (p2);
alter table t1 rebuild partition p0, p1, p2;
select * from t1 partition (p1);
select * from t1 partition (p0);
select * from t1 partition (p2);
select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
--echo ## pruning check
set @ts=(select partition_description from information_schema.partitions
......@@ -357,9 +310,6 @@ set @ts=(select row_end from t1 for system_time all where i=1);
select * from t1 for system_time all where row_end = @ts;
--replace_column 5 # 10 # 11 #
explain partitions select * from t1 for system_time all where row_end = @ts;
unlock tables;
--let $wait_condition= $wait_no_alter
--source include/wait_condition.inc
--echo ## INTERVAL ... STARTS
--error ER_PART_WRONG_VALUE
......@@ -456,7 +406,6 @@ set timestamp= unix_timestamp('2001-01-01 00:00:00');
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day starts '2000-01-01 00:00:00'
partitions 3;
lock tables t1 write; # prevent partition auto-creation
--echo # we are warned when we push to present:
insert into t1 values (0);
......@@ -487,16 +436,11 @@ update t1 set i= i + 1;
select *, row_end from t1 partition (p0);
select *, row_end from t1 partition (p1);
unlock tables;
--let $wait_condition= $wait_no_alter
--source include/wait_condition.inc
--echo # and this is how it usually goes:
set timestamp= unix_timestamp('2000-01-01 00:00:00');
--echo # and this is how it usually goes:
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day
partitions 3;
lock tables t1 write; # prevent partition auto-creation
insert into t1 values (0);
set timestamp= unix_timestamp('2000-01-01 00:00:01');
......@@ -509,20 +453,12 @@ set timestamp= unix_timestamp('2000-01-04 00:00:01');
update t1 set i= i + 1;
alter table t1 add partition (partition p2 history, partition p3 history);
select *, row_end from t1 partition (p0);
select *, row_end from t1 partition (p1);
select *, row_end from t1 partition (p2);
select *, row_end from t1 partition (p3);
alter table t1 rebuild partition p0, p1, p2, p3;
select *, row_end from t1 partition (p0);
select *, row_end from t1 partition (p1);
select *, row_end from t1 partition (p2);
select *, row_end from t1 partition (p3);
unlock tables;
--let $wait_condition= $wait_no_alter
--source include/wait_condition.inc
drop tables t1, t2;
--echo ## Subpartitions
......@@ -536,9 +472,9 @@ insert into t1 (x) values (1), (2), (3), (4), (5);
select * from t1 partition (pnsp0);
select * from t1 partition (pnsp1);
--echo ### warn about full partition
delete from t1 where x < 3;
delete from t1;
--echo ### warn about full partition
delete from t1;
select * from t1 partition (p0sp0);
select * from t1 partition (p0sp1);
......@@ -691,8 +627,6 @@ alter table t1 partition by system_time interval 1 week (
partition p1 history,
partition pn current);
unlock tables;
--let $wait_condition= $wait_no_alter
--source include/wait_condition.inc
--echo #
--echo # MDEV-14748 Assertion in ha_myisammrg::attach_children()
......@@ -729,8 +663,6 @@ lock table t1 write;
alter table t1 add partition (partition p0 history);
insert into t1 values (1);
unlock tables;
--let $wait_condition= $wait_no_alter
--source include/wait_condition.inc
--echo #
--echo # MDEV-15103 Assertion in ha_partition::part_records() for updating VIEW
......@@ -755,13 +687,11 @@ alter table t drop system versioning;
create or replace table t1 (i int) with system versioning;
insert into t1 values (1), (2);
update t1 set i= 3;
alter table t1 partition by system_time interval 59 minute (partition p1 history, partition pn current);
alter table t1 partition by system_time interval 1 month (partition p1 history, partition pn current);
lock table t1 write;
alter table t1 add partition (partition p2 history);
insert into t1 values (4);
unlock tables;
--let $wait_condition= $wait_no_alter
--source include/wait_condition.inc
--echo #
--echo # MDEV-15036 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' in Diagnostics_area::set_ok_status or unexpected ER_RANGE_NOT_INCREASING_ERROR
......
......@@ -133,28 +133,4 @@ sync_slave_with_master;
connection master;
drop table t1;
--echo #
--echo # MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT
--echo #
let $wait_no_alter= select count(*) = 0 from information_schema.processlist where info like 'ALTER TABLE %';
let $wait_alter= select count(*) > 0 from information_schema.processlist where info like 'ALTER TABLE %';
create or replace table t1 (x int) with system versioning
partition by system_time limit 1000 auto_increment;
lock tables t1 write;
insert t1 values ();
delete from t1;
--let $wait_condition= $wait_alter
--source include/wait_condition.inc
unlock tables;
--let $wait_condition= $wait_no_alter
--source include/wait_condition.inc
select count(*) - 1 as hist_partitions from information_schema.partitions where table_name = 't1' and table_schema = 'test';
--sync_slave_with_master
select count(*) - 1 as hist_partitions from information_schema.partitions where table_name = 't1' and table_schema = 'test';
--connection master
drop database test;
create database test;
--source include/rpl_end.inc
......@@ -1090,7 +1090,7 @@ static PSI_cond_info all_server_conds[]=
PSI_thread_key key_thread_delayed_insert,
key_thread_handle_manager, key_thread_main,
key_thread_one_connection, key_thread_signal_hand,
key_thread_slave_background, key_rpl_parallel_thread, key_thread_query;
key_thread_slave_background, key_rpl_parallel_thread;
PSI_thread_key key_thread_ack_receiver;
static PSI_thread_info all_server_threads[]=
......@@ -1102,8 +1102,7 @@ static PSI_thread_info all_server_threads[]=
{ &key_thread_signal_hand, "signal_handler", PSI_FLAG_GLOBAL},
{ &key_thread_slave_background, "slave_background", PSI_FLAG_GLOBAL},
{ &key_thread_ack_receiver, "Ack_receiver", PSI_FLAG_GLOBAL},
{ &key_rpl_parallel_thread, "rpl_parallel_thread", 0},
{ &key_thread_query, "vers_add_hist_part_thread", 0}
{ &key_rpl_parallel_thread, "rpl_parallel_thread", 0}
};
#ifdef HAVE_MMAP
......
......@@ -388,7 +388,7 @@ extern PSI_cond_key key_TABLE_SHARE_COND_rotation;
extern PSI_thread_key key_thread_delayed_insert,
key_thread_handle_manager, key_thread_kill_server, key_thread_main,
key_thread_one_connection, key_thread_signal_hand,
key_thread_slave_background, key_rpl_parallel_thread, key_thread_query;
key_thread_slave_background, key_rpl_parallel_thread;
extern PSI_file_key key_file_binlog, key_file_binlog_index, key_file_casetest,
key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file,
......
This diff is collapsed.
......@@ -38,7 +38,6 @@ struct Vers_part_info : public Sql_alloc
{
Vers_part_info() :
limit(0),
auto_inc(false),
now_part(NULL),
hist_part(NULL)
{
......@@ -47,7 +46,6 @@ struct Vers_part_info : public Sql_alloc
Vers_part_info(Vers_part_info &src) :
interval(src.interval),
limit(src.limit),
auto_inc(src.auto_inc),
now_part(NULL),
hist_part(NULL)
{
......@@ -71,30 +69,9 @@ struct Vers_part_info : public Sql_alloc
my_time_t start;
INTERVAL step;
enum interval_type type;
bool is_set() const { return type < INTERVAL_LAST; }
bool lt(size_t seconds) const
{
if (step.second)
return step.second < seconds;
if (step.minute)
return step.minute * 60 < seconds;
if (step.hour)
return step.hour * 3600 < seconds;
if (step.day)
return step.day * 3600 * 24 < seconds;
// comparison is used in rough estimates, it doesn't need to be calendar-correct
if (step.month)
return step.month * 3600 * 24 * 30 < seconds;
DBUG_ASSERT(step.year);
return step.year * 86400 * 30 * 365 < seconds;
}
bool ge(size_t seconds) const
{
return !(this->lt(seconds));
}
bool is_set() { return type < INTERVAL_LAST; }
} interval;
ulonglong limit;
bool auto_inc;
partition_element *now_part;
partition_element *hist_part;
};
......@@ -417,16 +394,14 @@ class partition_info : public Sql_alloc
bool vers_init_info(THD *thd);
bool vers_set_interval(THD *thd, Item *interval,
interval_type int_type, Item *starts,
bool auto_inc, const char *table_name);
bool vers_set_limit(ulonglong limit, bool auto_inc)
const char *table_name);
bool vers_set_limit(ulonglong limit)
{
DBUG_ASSERT(part_type == VERSIONING_PARTITION);
vers_info->limit= limit;
vers_info->auto_inc= auto_inc;
return !limit;
}
void vers_set_hist_part(THD *thd);
void vers_add_hist_part(THD *thd);
bool vers_fix_field_list(THD *thd);
void vers_update_el_ids();
partition_element *get_partition(uint part_id)
......@@ -525,14 +500,4 @@ void partition_info::vers_update_el_ids()
}
}
#define MAX_PART_NAME_SIZE 8
inline
bool make_partition_name(char *move_ptr, uint i)
{
int res= snprintf(move_ptr, MAX_PART_NAME_SIZE + 1, "p%u", i);
return res < 0 || res > MAX_PART_NAME_SIZE;
}
#endif /* PARTITION_INFO_INCLUDED */
......@@ -7944,8 +7944,4 @@ ER_WARN_HISTORY_ROW_START_TIME
ER_PART_STARTS_BEYOND_INTERVAL
eng "%`s: STARTS is later than query time, first history partition may exceed INTERVAL value"
ER_GALERA_REPLICATION_NOT_SUPPORTED
eng "DDL-statement is forbidden as table storage engine does not support Galera replication"
ER_VERS_MODIFY_HISTORY
eng "Modifying history is prohibited, set `secure_timestamp` to NO or SUPER"
WARN_VERS_HIST_PART_ERROR
eng "Versioned table %`s.%`s: adding HISTORY partition failed with error %u, see error log for details"
eng "DDL-statement is forbidden as table storage engine does not support Galera replication"
\ No newline at end of file
......@@ -2584,15 +2584,11 @@ char *generate_partition_syntax(THD *thd, partition_info *part_info,
err+= str.append(ctime, ctime_len);
err+= str.append('\'');
}
if (vers_info->auto_inc)
err+= str.append(STRING_WITH_LEN(" AUTO_INCREMENT"));
}
else if (vers_info->limit)
if (vers_info->limit)
{
err+= str.append(STRING_WITH_LEN("LIMIT "));
err+= str.append_ulonglong(vers_info->limit);
if (vers_info->auto_inc)
err+= str.append(STRING_WITH_LEN(" AUTO_INCREMENT"));
}
}
else if (part_info->part_expr)
......@@ -5317,6 +5313,12 @@ that are reorganised.
now_part= el;
}
}
if (*fast_alter_table && tab_part_info->vers_info->interval.is_set())
{
partition_element *hist_part= tab_part_info->vers_info->hist_part;
if (hist_part->range_value <= thd->query_start())
hist_part->part_state= PART_CHANGED;
}
}
List_iterator<partition_element> alt_it(alt_part_info->partitions);
uint part_count= 0;
......@@ -7216,8 +7218,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
}
else if ((alter_info->partition_flags & ALTER_PARTITION_ADD) &&
(part_info->part_type == RANGE_PARTITION ||
part_info->part_type == LIST_PARTITION ||
part_info->part_type == VERSIONING_PARTITION))
part_info->part_type == LIST_PARTITION))
{
/*
ADD RANGE/LIST PARTITIONS
......
......@@ -1464,8 +1464,6 @@ End SQL_MODE_ORACLE_SPECIFIC */
condition_number
opt_versioning_interval_start
%type <num> opt_vers_auto_inc
%type <item_param> param_marker
%type <item_num>
......@@ -5308,24 +5306,24 @@ opt_part_option:
opt_versioning_rotation:
/* empty */ {}
| INTERVAL_SYM expr interval opt_versioning_interval_start opt_vers_auto_inc
| INTERVAL_SYM expr interval opt_versioning_interval_start
{
partition_info *part_info= Lex->part_info;
const char *table_name= Lex->create_last_non_select_table->table_name.str;
if (unlikely(part_info->vers_set_interval(thd, $2, $3, $4, $5, table_name)))
if (unlikely(part_info->vers_set_interval(thd, $2, $3, $4, table_name)))
MYSQL_YYABORT;
}
| LIMIT ulonglong_num opt_vers_auto_inc
| LIMIT ulonglong_num
{
partition_info *part_info= Lex->part_info;
if (unlikely(part_info->vers_set_limit($2)))
{
partition_info *part_info= Lex->part_info;
if (unlikely(part_info->vers_set_limit($2, $3)))
{
my_error(ER_PART_WRONG_VALUE, MYF(0),
Lex->create_last_non_select_table->table_name.str,
"LIMIT");
MYSQL_YYABORT;
}
my_error(ER_PART_WRONG_VALUE, MYF(0),
Lex->create_last_non_select_table->table_name.str,
"LIMIT");
MYSQL_YYABORT;
}
}
;
......@@ -5340,20 +5338,6 @@ opt_versioning_interval_start:
}
;
opt_vers_auto_inc:
/* empty */
{
$$= 0;
}
| AUTO_INC
{
$$= 1;
}
| AUTO_SYM
{
$$= 1;
}
;
/*
End of partition parser part
*/
......
......@@ -800,9 +800,6 @@ struct TABLE_SHARE
uint partition_info_str_len;
uint partition_info_buffer_size;
plugin_ref default_part_plugin;
bool vers_altering;
time_t vers_hist_part_timeout;
uint vers_hist_part_error;
#endif
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment