mark some file to been opensource for ce-farm
This commit is contained in:
167
tools/deploy/mysql_test/test_suite/table_api/t/ttl_ddl.test
Normal file
167
tools/deploy/mysql_test/test_suite/table_api/t/ttl_ddl.test
Normal file
@ -0,0 +1,167 @@
|
||||
#owner: shenyunlong.syl
|
||||
#owner group: shenzhen
|
||||
|
||||
connect (conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
connection default;
|
||||
|
||||
### test kv_attributes syntax
|
||||
--disable_warnings
|
||||
drop table if exists test_kv_attr;
|
||||
--error 1235
|
||||
CREATE TABLE test_kv_attr(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"HColumnDescriptor": {"TimeToLive": 5, "MaxVersions": 2}}' partition by key(K) partitions 3;
|
||||
|
||||
--error 1210
|
||||
CREATE TABLE test_kv_attr(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{}' partition by key(K) partitions 3;
|
||||
|
||||
--error 1235
|
||||
CREATE TABLE test_kv_attr(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"Hbase": {"MaxVersion": 2}}' partition by key(K) partitions 3;
|
||||
|
||||
--error 1235
|
||||
CREATE TABLE test_kv_attr(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"Hbase": {"TimeToLive": 5, "MaxVersions": 2, "MinVersions": 1}}' partition by key(K) partitions 3;
|
||||
|
||||
--error 1210
|
||||
CREATE TABLE test_kv_attr(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"Hbase": {"TimeToLive": 1, "MaxVersions": 0}}' partition by key(K) partitions 3;
|
||||
|
||||
--error 1210
|
||||
CREATE TABLE test_kv_attr(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"Hbase": {"TimeToLive": 0, "MaxVersions": 1}}' partition by key(K) partitions 3;
|
||||
|
||||
--error 1235
|
||||
CREATE TABLE test_kv_attr(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"TimeSeries": {}}' partition by key(K) partitions 3;
|
||||
|
||||
--error 1210
|
||||
CREATE TABLE test_kv_attr(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"Hbase": {"TimeToLive": 0}, "Hbase": {"MaxVersions": 1}}' partition by key(K) partitions 3;
|
||||
|
||||
CREATE TABLE test_kv_attr(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"Hbase": {"TimeToLive": 10, "MaxVersions": 2}}' partition by key(K) partitions 3;
|
||||
|
||||
--error 1235
|
||||
alter table test_kv_attr kv_attributes '{"HColumnDescriptor": {"TimeToLive": 5, "MaxVersions": 2}}';
|
||||
--error 1210
|
||||
alter table test_kv_attr kv_attributes '{}';
|
||||
--error 1235
|
||||
alter table test_kv_attr kv_attributes ='{"Hbase": {"TimeToLive": 5, "MaxVersions": 2, "MinVersions": 1}}';
|
||||
--error 1235
|
||||
alter table test_kv_attr kv_attributes = '{"Hbase": {"MaxVersion": 2}}';
|
||||
--error 1210
|
||||
alter table test_kv_attr kv_attributes = '{"Hbase": {"TimeToLive": 1, "MaxVersions": 0}}';
|
||||
--error 1210
|
||||
alter table test_kv_attr kv_attributes ='{"Hbase": {"TimeToLive": 0, "MaxVersions": 1}}';
|
||||
|
||||
alter table test_kv_attr kv_attributes ='{"Hbase": {"MaxVersions": 4}}';
|
||||
alter table test_kv_attr kv_attributes ='{"Hbase": {"TimeToLive": 10000000}}';
|
||||
alter table test_kv_attr kv_attributes ='{"Hbase": {"MaxVersions": 4, "TimeToLive": 10000000}}';
|
||||
alter table test_kv_attr kv_attributes ='{"Hbase": {}}';
|
||||
|
||||
|
||||
### test ttl syntax
|
||||
--disable_warnings
|
||||
drop table if exists test_ttl;
|
||||
create table test_ttl(a int primary key, b varchar(1024), c timestamp) TTL(c + INTERVAL 1 hour);
|
||||
show create table test_ttl;
|
||||
drop table test_ttl;
|
||||
create table test_ttl(a int primary key, b varchar(1024), c datetime) TTL(c + INTERVAL 1 hour);
|
||||
show create table test_ttl;
|
||||
drop table test_ttl;
|
||||
|
||||
## not supported data type
|
||||
--error 1235
|
||||
create table test_ttl(a int primary key, b varchar(1024), c varchar(1024)) TTL(c + INTERVAL 1 hour);
|
||||
--error 1235
|
||||
create table test_ttl(a int primary key, b varchar(1024), c date) TTL(c + INTERVAL 1 hour);
|
||||
--error 1235
|
||||
create table test_ttl(a int primary key, b varchar(1024), c time) TTL(c + INTERVAL 1 hour);
|
||||
--error 1235
|
||||
create table test_ttl(a int primary key, b varchar(1024)) TTL(now() + INTERVAL 1 hour);
|
||||
|
||||
## alter table ttl
|
||||
create table test_ttl(a int primary key, b varchar(1024), c timestamp, d datetime) TTL(c + INTERVAL 0 hour);
|
||||
show create table test_ttl;
|
||||
alter table test_ttl TTL(c + INTERVAL 60 DAY);
|
||||
show create table test_ttl;
|
||||
drop table test_ttl;
|
||||
|
||||
## different ttl unit
|
||||
create table test_ttl(a int primary key, b varchar(1024), c timestamp) TTL(c + INTERVAL 1 second);
|
||||
drop table test_ttl;
|
||||
create table test_ttl(a int primary key, b varchar(1024), c timestamp) TTL(c + INTERVAL 1 minute);
|
||||
drop table test_ttl;
|
||||
create table test_ttl(a int primary key, b varchar(1024), c timestamp) TTL(c + INTERVAL 1 hour);
|
||||
drop table test_ttl;
|
||||
create table test_ttl(a int primary key, b varchar(1024), c timestamp) TTL(c + INTERVAL 1 day);
|
||||
drop table test_ttl;
|
||||
create table test_ttl(a int primary key, b varchar(1024), c timestamp) TTL(c + INTERVAL 1 month);
|
||||
drop table test_ttl;
|
||||
create table test_ttl(a int primary key, b varchar(1024), c timestamp) TTL(c + INTERVAL 1 year);
|
||||
|
||||
## drop or modify a ttl column
|
||||
--error 1235
|
||||
alter table test_ttl drop column c;
|
||||
--error 1235
|
||||
alter table test_ttl change column c c2 datetime;
|
||||
--error 1235
|
||||
alter table test_ttl modify column c bigint;
|
||||
--error 1235
|
||||
alter table test_ttl modify column c datetime;
|
||||
--error 1235
|
||||
alter table test_ttl add column d datetime, ttl(d + INTERVAL 1 minute);
|
||||
|
||||
alter table test_ttl remove ttl;
|
||||
show create table test_ttl;
|
||||
alter table test_ttl drop column c;
|
||||
|
||||
drop table test_kv_attr;
|
||||
drop table test_ttl;
|
||||
72
tools/deploy/mysql_test/test_suite/table_api/t/ttl_full.test
Normal file
72
tools/deploy/mysql_test/test_suite/table_api/t/ttl_full.test
Normal file
@ -0,0 +1,72 @@
|
||||
#owner: shenyunlong.syl
|
||||
#owner group: shenzhen
|
||||
|
||||
connect (conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
connection default;
|
||||
alter system minor freeze;
|
||||
alter system set enable_kv_ttl = true;
|
||||
--disable_warnings
|
||||
drop table if exists ttl_tm;
|
||||
CREATE TABLE ttl_tm(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"Hbase": {"TimeToLive": 5, "MaxVersions": 2}}' partition by key(K) partitions 3;
|
||||
|
||||
drop table if exists ttl_t;
|
||||
CREATE TABLE ttl_t(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes = '{"Hbase": {"TimeToLive": 5}}' partition by key(K) partitions 3;
|
||||
|
||||
drop table if exists ttl_m;
|
||||
CREATE TABLE ttl_m(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"Hbase": {"MaxVersions": 2}}' partition by key(K) partitions 3;
|
||||
|
||||
drop table if exists ttl_m_single;
|
||||
CREATE TABLE ttl_m_single(
|
||||
K varbinary(1024) NOT NULL,
|
||||
Q varbinary(256) NOT NULL,
|
||||
T bigint NOT NULL,
|
||||
V varbinary(1024) DEFAULT NULL,
|
||||
PRIMARY KEY (K, Q, T)
|
||||
) kv_attributes ='{"Hbase": {"MaxVersions": 2}}';
|
||||
--enable_warnings
|
||||
|
||||
--let $count = 0
|
||||
while($count < 100)
|
||||
{
|
||||
--let $stmt=insert into ttl_tm(K, Q, T, V) values ('row1', 'cq1', $count, 'del');insert into ttl_t(K, Q, T, V) values ('row1', 'cq1', $count, 'del');insert into ttl_m(K, Q, T, V) values ('row1', 'cq1', $count, 'del');insert into ttl_m_single(K, Q, T, V) values ('row1', 'cq1', $count, 'del');
|
||||
|
||||
eval $stmt;
|
||||
inc $count;
|
||||
}
|
||||
|
||||
sleep 10;
|
||||
alter system trigger ttl;
|
||||
|
||||
sleep 60;
|
||||
select count(*) from ttl_tm;
|
||||
select TABLE_NAME, TRIGGER_TYPE, STATUS, TTL_DEL_CNT, MAX_VERSION_DEL_CNT, SCAN_CNT, RET_CODE from oceanbase.DBA_OB_KV_TTL_TASK_HISTORY where table_name = 'ttl_tm' order by tablet_id;
|
||||
select count(*) from ttl_t;
|
||||
select TABLE_NAME, TRIGGER_TYPE, STATUS, TTL_DEL_CNT, MAX_VERSION_DEL_CNT, SCAN_CNT, RET_CODE from oceanbase.DBA_OB_KV_TTL_TASK_HISTORY where table_name = 'ttl_t' order by tablet_id;
|
||||
select count(*) from ttl_m;
|
||||
select TABLE_NAME, TRIGGER_TYPE, STATUS, TTL_DEL_CNT, MAX_VERSION_DEL_CNT, SCAN_CNT, RET_CODE from oceanbase.DBA_OB_KV_TTL_TASK_HISTORY where table_name = 'ttl_m' order by tablet_id;
|
||||
select count(*) from ttl_m_single;
|
||||
select TABLE_NAME, TRIGGER_TYPE, STATUS, TTL_DEL_CNT, MAX_VERSION_DEL_CNT, SCAN_CNT, RET_CODE from oceanbase.DBA_OB_KV_TTL_TASK_HISTORY where table_name = 'ttl_m_single' order by tablet_id;
|
||||
|
||||
drop table ttl_tm;
|
||||
drop table ttl_t;
|
||||
drop table ttl_m;
|
||||
drop table ttl_m_single;
|
||||
@ -0,0 +1,72 @@
|
||||
#owner: shenyunlong.syl
|
||||
#owner group: shenzhen
|
||||
|
||||
connect (conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection default;
|
||||
alter system minor freeze;
|
||||
alter system set enable_kv_ttl = true;
|
||||
alter system set ttl_thread_score = 4;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists ttl_table_ts;
|
||||
create table ttl_table_ts(a varchar(1024) primary key, b varchar(1024), c timestamp) TTL(c + INTERVAL 0 SECOND) partition by key(a) partitions 7;
|
||||
|
||||
# insert 4*7*500 rows, save one rows per cell
|
||||
--let $count = 0
|
||||
while($count < 500)
|
||||
{
|
||||
--let $stmt=insert into ttl_table_ts(a, b, c) values (concat('row', cast($count as char)), 'hello world', now());
|
||||
|
||||
eval $stmt;
|
||||
inc $count;
|
||||
}
|
||||
while($count < 600)
|
||||
{
|
||||
--let $stmt=insert into ttl_table_ts(a, b, c) values (concat('row', cast($count as char)), 'hello world', date_add(now(), interval + 2 MINUTE));
|
||||
|
||||
eval $stmt;
|
||||
inc $count;
|
||||
}
|
||||
|
||||
sleep 3;
|
||||
alter system trigger ttl;
|
||||
|
||||
sleep 60;
|
||||
select count(*) from ttl_table_ts;
|
||||
select TABLE_NAME, TRIGGER_TYPE, STATUS, TTL_DEL_CNT, MAX_VERSION_DEL_CNT, SCAN_CNT, RET_CODE from oceanbase.DBA_OB_KV_TTL_TASK_HISTORY where table_name = 'ttl_table_ts' order by tablet_id;
|
||||
|
||||
drop table ttl_table_ts;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists ttl_table_ts_column_order;
|
||||
--enable_warnings
|
||||
create table ttl_table_ts_column_order(a varchar(1024), b int primary key, c timestamp) TTL(c + INTERVAL 0 SECOND) partition by key(b) partitions 7;
|
||||
# insert 4*7*500 rows, save one rows per cell
|
||||
|
||||
drop procedure if exists insert_data;
|
||||
|
||||
delimiter |;
|
||||
create PROCEDURE insert_data(del int, no_del int)
|
||||
BEGIN
|
||||
DECLARE i INT DEFAULT 0;
|
||||
WHILE i < del do
|
||||
insert into ttl_table_ts_column_order(a, b, c) values (concat('row', cast(i as char)), i, now());
|
||||
set i = i + 1;
|
||||
end while;
|
||||
while i < del + no_del do
|
||||
insert into ttl_table_ts_column_order(a, b, c) values (concat('row', cast(i as char)), i, date_add(now(), interval + 2 MINUTE));
|
||||
set i = i + 1;
|
||||
end while;
|
||||
END |
|
||||
delimiter ;|
|
||||
|
||||
call insert_data(500, 100);
|
||||
|
||||
sleep 3;
|
||||
alter system trigger ttl;
|
||||
|
||||
sleep 70;
|
||||
select count(*) from ttl_table_ts_column_order;
|
||||
select TABLE_NAME, TRIGGER_TYPE, STATUS, TTL_DEL_CNT, MAX_VERSION_DEL_CNT, SCAN_CNT, RET_CODE from oceanbase.DBA_OB_KV_TTL_TASK_HISTORY where table_name = 'ttl_table_ts_column_order' order by tablet_id;
|
||||
|
||||
drop table ttl_table_ts_column_order;
|
||||
Reference in New Issue
Block a user