mark some file to been opensource for ce-farm
This commit is contained in:
@ -0,0 +1,157 @@
|
||||
part_name low_bound_val high_bound_val part_position sub_part_num
|
||||
M202003 1585670400 0 0
|
||||
M202004 1596211200 0 0
|
||||
M202011 1606752000 0 0
|
||||
part_name low_bound_val high_bound_val part_position sub_part_num
|
||||
M202003 '2020-04-01' 0 0
|
||||
M202007 '2020-08-01' 0 0
|
||||
M202011 '2020-12-01' 0 0
|
||||
MMAX MAXVALUE 0 0
|
||||
part_name low_bound_val high_bound_val part_position sub_part_num
|
||||
p0 1,2,3 0 0
|
||||
p1 5,6 0 0
|
||||
p2 DEFAULT 0 0
|
||||
part_name low_bound_val high_bound_val part_position sub_part_num
|
||||
p0 '00','01' 0 0
|
||||
p1 '02','03' 0 0
|
||||
p2 DEFAULT 0 0
|
||||
part_name low_bound_val high_bound_val part_position sub_part_num
|
||||
p0 NULL 0 0
|
||||
p1 NULL 1 0
|
||||
p2 NULL 2 0
|
||||
p3 NULL 3 0
|
||||
p4 NULL 4 0
|
||||
p5 NULL 5 0
|
||||
p6 NULL 6 0
|
||||
p7 NULL 7 0
|
||||
p8 NULL 8 0
|
||||
p9 NULL 9 0
|
||||
p10 NULL 10 0
|
||||
p11 NULL 11 0
|
||||
p12 NULL 12 0
|
||||
p13 NULL 13 0
|
||||
p14 NULL 14 0
|
||||
p15 NULL 15 0
|
||||
p16 NULL 16 0
|
||||
p17 NULL 17 0
|
||||
p18 NULL 18 0
|
||||
p19 NULL 19 0
|
||||
p20 NULL 20 0
|
||||
p21 NULL 21 0
|
||||
p22 NULL 22 0
|
||||
p23 NULL 23 0
|
||||
p24 NULL 24 0
|
||||
p25 NULL 25 0
|
||||
p26 NULL 26 0
|
||||
p27 NULL 27 0
|
||||
p28 NULL 28 0
|
||||
p29 NULL 29 0
|
||||
p30 NULL 30 0
|
||||
p31 NULL 31 0
|
||||
p32 NULL 32 0
|
||||
p33 NULL 33 0
|
||||
p34 NULL 34 0
|
||||
p35 NULL 35 0
|
||||
p36 NULL 36 0
|
||||
p37 NULL 37 0
|
||||
p38 NULL 38 0
|
||||
p39 NULL 39 0
|
||||
p40 NULL 40 0
|
||||
p41 NULL 41 0
|
||||
p42 NULL 42 0
|
||||
p43 NULL 43 0
|
||||
p44 NULL 44 0
|
||||
p45 NULL 45 0
|
||||
p46 NULL 46 0
|
||||
p47 NULL 47 0
|
||||
p48 NULL 48 0
|
||||
p49 NULL 49 0
|
||||
p50 NULL 50 0
|
||||
p51 NULL 51 0
|
||||
p52 NULL 52 0
|
||||
p53 NULL 53 0
|
||||
p54 NULL 54 0
|
||||
p55 NULL 55 0
|
||||
p56 NULL 56 0
|
||||
p57 NULL 57 0
|
||||
p58 NULL 58 0
|
||||
p59 NULL 59 0
|
||||
part_name low_bound_val high_bound_val part_position sub_part_num
|
||||
p0 NULL 0 0
|
||||
p1 NULL 1 0
|
||||
p2 NULL 2 0
|
||||
p3 NULL 3 0
|
||||
p4 NULL 4 0
|
||||
p5 NULL 5 0
|
||||
p6 NULL 6 0
|
||||
p7 NULL 7 0
|
||||
p8 NULL 8 0
|
||||
p9 NULL 9 0
|
||||
part_name low_bound_val high_bound_val part_position sub_part_num
|
||||
p1 NULL 0 4
|
||||
p2 NULL 1 4
|
||||
ERROR HY000: Incorrect arguments to tenant_name and table_id (must all be specified)
|
||||
ERROR HY000: Incorrect arguments to tenant_name and table_id (must all be specified)
|
||||
ERROR 0A000: batch query not supported
|
||||
part_name low_bound_val high_bound_val part_position sub_part_num
|
||||
part_name low_bound_val high_bound_val part_position sub_part_num
|
||||
p0 NULL 0 0
|
||||
p1 NULL 1 0
|
||||
p2 NULL 2 0
|
||||
p3 NULL 3 0
|
||||
p4 NULL 4 0
|
||||
p5 NULL 5 0
|
||||
p6 NULL 6 0
|
||||
p7 NULL 7 0
|
||||
p8 NULL 8 0
|
||||
p9 NULL 9 0
|
||||
p10 NULL 10 0
|
||||
p11 NULL 11 0
|
||||
p12 NULL 12 0
|
||||
p13 NULL 13 0
|
||||
p14 NULL 14 0
|
||||
p15 NULL 15 0
|
||||
p16 NULL 16 0
|
||||
p17 NULL 17 0
|
||||
p18 NULL 18 0
|
||||
p19 NULL 19 0
|
||||
p20 NULL 20 0
|
||||
p21 NULL 21 0
|
||||
p22 NULL 22 0
|
||||
p23 NULL 23 0
|
||||
p24 NULL 24 0
|
||||
p25 NULL 25 0
|
||||
p26 NULL 26 0
|
||||
p27 NULL 27 0
|
||||
p28 NULL 28 0
|
||||
p29 NULL 29 0
|
||||
p30 NULL 30 0
|
||||
p31 NULL 31 0
|
||||
p32 NULL 32 0
|
||||
p33 NULL 33 0
|
||||
p34 NULL 34 0
|
||||
p35 NULL 35 0
|
||||
p36 NULL 36 0
|
||||
p37 NULL 37 0
|
||||
p38 NULL 38 0
|
||||
p39 NULL 39 0
|
||||
p40 NULL 40 0
|
||||
p41 NULL 41 0
|
||||
p42 NULL 42 0
|
||||
p43 NULL 43 0
|
||||
p44 NULL 44 0
|
||||
p45 NULL 45 0
|
||||
p46 NULL 46 0
|
||||
p47 NULL 47 0
|
||||
p48 NULL 48 0
|
||||
p49 NULL 49 0
|
||||
p50 NULL 50 0
|
||||
p51 NULL 51 0
|
||||
p52 NULL 52 0
|
||||
p53 NULL 53 0
|
||||
p54 NULL 54 0
|
||||
p55 NULL 55 0
|
||||
p56 NULL 56 0
|
||||
p57 NULL 57 0
|
||||
p58 NULL 58 0
|
||||
p59 NULL 59 0
|
||||
Binary file not shown.
@ -0,0 +1,63 @@
|
||||
part_name low_bound_val high_bound_val sub_part_position
|
||||
p0smp0 1,3 NULL
|
||||
p0smp1 4,6 NULL
|
||||
p0smp2 7 NULL
|
||||
p1smp0 1,3 NULL
|
||||
p1smp1 4,6 NULL
|
||||
p1smp2 7 NULL
|
||||
p2smp0 1,3 NULL
|
||||
p2smp1 4,6 NULL
|
||||
p2smp2 7 NULL
|
||||
part_name low_bound_val high_bound_val sub_part_position
|
||||
p0sp0 NULL 0
|
||||
p0sp1 NULL 1
|
||||
p0sp2 NULL 2
|
||||
p0sp3 NULL 3
|
||||
p0sp4 NULL 4
|
||||
p1sp0 NULL 0
|
||||
p1sp1 NULL 1
|
||||
p1sp2 NULL 2
|
||||
p1sp3 NULL 3
|
||||
p1sp4 NULL 4
|
||||
p2sp0 NULL 0
|
||||
p2sp1 NULL 1
|
||||
p2sp2 NULL 2
|
||||
p2sp3 NULL 3
|
||||
p2sp4 NULL 4
|
||||
part_name low_bound_val high_bound_val sub_part_position
|
||||
p0ssp0 100 NULL
|
||||
p0ssp1 200 NULL
|
||||
p0ssp2 300 NULL
|
||||
p1ssp0 100 NULL
|
||||
p1ssp1 200 NULL
|
||||
p1ssp2 300 NULL
|
||||
p2ssp0 100 NULL
|
||||
p2ssp1 200 NULL
|
||||
p2ssp2 300 NULL
|
||||
part_name low_bound_val high_bound_val sub_part_position
|
||||
sp0 2020 NULL
|
||||
sp1 2021 NULL
|
||||
sp2 2022 NULL
|
||||
sp3 2023 NULL
|
||||
sp4 2020 NULL
|
||||
sp5 2021 NULL
|
||||
sp6 2022 NULL
|
||||
sp7 2023 NULL
|
||||
part_name low_bound_val high_bound_val sub_part_position
|
||||
sp0 1,3 NULL
|
||||
sp1 4,6 NULL
|
||||
sp2 7,9 NULL
|
||||
sp3 1,3 NULL
|
||||
sp4 4,6 NULL
|
||||
sp5 7,9 NULL
|
||||
ERROR HY000: Incorrect arguments to tenant_name and table_id (must all be specified)
|
||||
ERROR HY000: Incorrect arguments to tenant_name and table_id (must all be specified)
|
||||
ERROR 0A000: batch query not supported
|
||||
part_name low_bound_val high_bound_val sub_part_position
|
||||
part_name low_bound_val high_bound_val sub_part_position
|
||||
sp0 1,3 NULL
|
||||
sp1 4,6 NULL
|
||||
sp2 7,9 NULL
|
||||
sp3 1,3 NULL
|
||||
sp4 4,6 NULL
|
||||
sp5 7,9 NULL
|
||||
@ -0,0 +1,119 @@
|
||||
#owner: wangzhennan.wzn
|
||||
#owner group: RS
|
||||
#description: Test __all_virtual_proxy_partition;
|
||||
|
||||
connect (obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
connection default;
|
||||
--disable_query_log
|
||||
--disable_warnings
|
||||
drop table if exists tbl1_r;
|
||||
drop table if exists tbl1_log_rc;
|
||||
drop table if exists tbl1_l;
|
||||
drop table if exists tbl1_lc;
|
||||
drop table if exists tbl1_h;
|
||||
drop table if exists tbl1_k;
|
||||
# range
|
||||
CREATE TABLE tbl1_r (log_id BIGINT NOT NULL,log_value VARCHAR(50),log_date TIMESTAMP NOT NULL)
|
||||
PARTITION BY RANGE(UNIX_TIMESTAMP(log_date))
|
||||
(PARTITION M202003 VALUES LESS THAN(UNIX_TIMESTAMP('2020/04/01'))
|
||||
, PARTITION M202004 VALUES LESS THAN(UNIX_TIMESTAMP('2020/08/01'))
|
||||
, PARTITION M202011 VALUES LESS THAN(UNIX_TIMESTAMP('2020/12/01'))
|
||||
);
|
||||
# range columns
|
||||
CREATE TABLE tbl1_log_rc (log_id BIGINT NOT NULL,log_value VARCHAR(50),log_date DATE NOT NULL)
|
||||
PARTITION BY RANGE COLUMNS(log_date)
|
||||
(PARTITION M202003 VALUES LESS THAN('2020/04/01')
|
||||
, PARTITION M202007 VALUES LESS THAN('2020/08/01')
|
||||
, PARTITION M202011 VALUES LESS THAN('2020/12/01')
|
||||
, PARTITION MMAX VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
# list
|
||||
CREATE TABLE tbl1_l (col1 BIGINT PRIMARY KEY,col2 VARCHAR(50))
|
||||
PARTITION BY LIST(col1)
|
||||
(PARTITION p0 VALUES IN (1, 2, 3),
|
||||
PARTITION p1 VALUES IN (5, 6),
|
||||
PARTITION p2 VALUES IN (DEFAULT)
|
||||
);
|
||||
# list columns
|
||||
CREATE TABLE tbl1_lc (id INT,partition_id VARCHAR(2))
|
||||
PARTITION BY LIST COLUMNS(partition_id)
|
||||
(PARTITION p0 VALUES IN ('00','01'),
|
||||
PARTITION p1 VALUES IN ('02','03'),
|
||||
PARTITION p2 VALUES IN (DEFAULT)
|
||||
);
|
||||
# hash
|
||||
CREATE TABLE tbl1_h(col1 INT,col2 VARCHAR(50))
|
||||
PARTITION BY HASH(col1) PARTITIONS 60;
|
||||
# key
|
||||
CREATE TABLE tbl1_k(id INT,gmt_create DATETIME,info VARCHAR(20))
|
||||
PARTITION BY KEY(id,gmt_create) PARTITIONS 10;
|
||||
|
||||
# Non-template sub partition
|
||||
# Hash + Range
|
||||
CREATE TABLE t2_f_hr (col1 INT,col2 INT)
|
||||
PARTITION BY KEY(col1)
|
||||
SUBPARTITION BY RANGE(col2)
|
||||
(PARTITION p1
|
||||
(SUBPARTITION sp0 VALUES LESS THAN (2020)
|
||||
,SUBPARTITION sp1 VALUES LESS THAN (2021)
|
||||
,SUBPARTITION sp2 VALUES LESS THAN (2022)
|
||||
,SUBPARTITION sp3 VALUES LESS THAN (2023)
|
||||
),
|
||||
PARTITION p2
|
||||
(SUBPARTITION sp4 VALUES LESS THAN (2020)
|
||||
,SUBPARTITION sp5 VALUES LESS THAN (2021)
|
||||
,SUBPARTITION sp6 VALUES LESS THAN (2022)
|
||||
,SUBPARTITION sp7 VALUES LESS THAN (2023)
|
||||
)
|
||||
);
|
||||
|
||||
connection obsys;
|
||||
drop table if exists sys_tbl1_h;
|
||||
CREATE TABLE sys_tbl1_h(col1 INT,col2 VARCHAR(50))
|
||||
PARTITION BY HASH(col1) PARTITIONS 60;
|
||||
|
||||
let $table_id_tbl1_r = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='tbl1_r' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where tenant_name = 'mysql' and table_id = $table_id_tbl1_r;
|
||||
|
||||
let $table_id_tbl1_log_rc = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='tbl1_log_rc' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where tenant_name = 'mysql' and table_id = $table_id_tbl1_log_rc;
|
||||
|
||||
let $table_id_tbl1_l = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='tbl1_l' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where tenant_name = 'mysql' and table_id = $table_id_tbl1_l;
|
||||
|
||||
let $table_id_tbl1_lc = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='tbl1_lc' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where tenant_name = 'mysql' and table_id = $table_id_tbl1_lc;
|
||||
|
||||
let $table_id_tbl1_h = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='tbl1_h' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where tenant_name = 'mysql' and table_id = $table_id_tbl1_h;
|
||||
|
||||
let $table_id_tbl1_k = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='tbl1_k' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where tenant_name = 'mysql' and table_id = $table_id_tbl1_k;
|
||||
|
||||
let $table_id_t2_f_hr = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='t2_f_hr' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where tenant_name = 'mysql' and table_id = $table_id_t2_f_hr;
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where tenant_name = 'mysql';
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where table_id = $table_id_tbl1_k;
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where (tenant_name, table_id) in (('mysql', $table_id_tbl1_h),('mysql', $table_id_tbl1_k));
|
||||
|
||||
# mysql tenant can only get tables belong to itself
|
||||
let $table_id_sys_tbl1_h = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='sys_tbl1_h' order by schema_version desc limit 1, table_id, 1);
|
||||
connection default;
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where tenant_name = 'sys' and table_id = $table_id_sys_tbl1_h;
|
||||
eval select part_name, low_bound_val, high_bound_val, part_position, sub_part_num from oceanbase.__all_virtual_proxy_partition where tenant_name = 'mysql' and table_id = $table_id_tbl1_h;
|
||||
|
||||
drop table tbl1_r;
|
||||
drop table tbl1_log_rc;
|
||||
drop table tbl1_l;
|
||||
drop table tbl1_lc;
|
||||
drop table tbl1_h;
|
||||
drop table tbl1_k;
|
||||
drop table t2_f_hr;
|
||||
|
||||
connection obsys;
|
||||
drop table sys_tbl1_h;
|
||||
@ -0,0 +1,128 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: xiaoyi.xy
|
||||
# owner group: sql2
|
||||
# description: test __all_virtual_proxy_partition_info
|
||||
|
||||
connect (obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
connection default;
|
||||
--echo
|
||||
--echo #******* 含1个constraint check, 且能用于分区裁减
|
||||
--disable_warnings
|
||||
drop table if exists proxy_constrain_part_pruning_t;
|
||||
--enable_warnings
|
||||
create table proxy_constrain_part_pruning_t(c1 varchar(20) primary key, c2 varchar(20), c3 varchar(20),
|
||||
partition_id varchar(2) GENERATED ALWAYS AS (substr(c1,19,2)) VIRTUAL,
|
||||
CONSTRAINT cst_proxy_00 CHECK (partition_id = substr(c2,19,2)))
|
||||
partition by list columns(partition_id)
|
||||
(partition p0 values in('00'), partition p1 values in('11'));
|
||||
|
||||
connection obsys;
|
||||
let $table_id = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='proxy_constrain_part_pruning_t' order by schema_version desc limit 1, table_id, 1);
|
||||
--disable_query_log
|
||||
eval select part_key_name, part_key_extra, part_key_expr from oceanbase.__all_virtual_proxy_partition_info where tenant_name = 'mysql' and table_id = $table_id;
|
||||
--enable_query_log
|
||||
|
||||
connection default;
|
||||
--echo
|
||||
--echo #******* 含3个不同形式constraint check, 且均能用于分区裁减
|
||||
--disable_warnings
|
||||
drop table if exists proxy_constrain_part_pruning_t;
|
||||
--enable_warnings
|
||||
create table proxy_constrain_part_pruning_t(c1 varchar(20) primary key, c2 varchar(20), c3 varchar(20), c4 varchar(2),
|
||||
partition_id varchar(2) GENERATED ALWAYS AS (substr(c1,19,2)) VIRTUAL,
|
||||
CONSTRAINT cst_proxy_00 CHECK (partition_id = substr(c2,19,2)),
|
||||
CONSTRAINT cst_proxy_01 CHECK (partition_id = c4),
|
||||
CONSTRAINT cst_proxy_02 CHECK (substr(c3,19,2) = partition_id))
|
||||
partition by list columns(partition_id)
|
||||
(partition p0 values in('00'), partition p1 values in('11'));
|
||||
|
||||
connection obsys;
|
||||
let $table_id = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='proxy_constrain_part_pruning_t' order by schema_version desc limit 1, table_id, 1);
|
||||
--disable_query_log
|
||||
eval select part_key_name, part_key_extra, part_key_expr from oceanbase.__all_virtual_proxy_partition_info where tenant_name = 'mysql' and table_id = $table_id;
|
||||
--enable_query_log
|
||||
|
||||
connection default;
|
||||
--echo
|
||||
--echo #******* 含1个constraint, 且不能用于分区裁减
|
||||
--disable_warnings
|
||||
drop table if exists proxy_constrain_part_pruning_t;
|
||||
--enable_warnings
|
||||
create table proxy_constrain_part_pruning_t(c1 varchar(20) primary key, c2 varchar(20), c3 varchar(20), c4 varchar(2),
|
||||
partition_id varchar(2) GENERATED ALWAYS AS (substr(c1,19,2)) VIRTUAL,
|
||||
CONSTRAINT cst_proxy_00 CHECK (c4 = substr(c2,19,2)))
|
||||
partition by list columns(partition_id)
|
||||
(partition p0 values in('00'), partition p1 values in('11'));
|
||||
|
||||
connection obsys;
|
||||
let $table_id = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='proxy_constrain_part_pruning_t' order by schema_version desc limit 1, table_id, 1);
|
||||
--disable_query_log
|
||||
eval select part_key_name, part_key_extra, part_key_expr from oceanbase.__all_virtual_proxy_partition_info where tenant_name = 'mysql' and table_id = $table_id;
|
||||
--enable_query_log
|
||||
|
||||
connection default;
|
||||
--echo
|
||||
--echo #******* 含3个constraint, 且有2个constraint不含分区键
|
||||
--disable_warnings
|
||||
drop table if exists proxy_constrain_part_pruning_t;
|
||||
--enable_warnings
|
||||
create table proxy_constrain_part_pruning_t(c1 varchar(20) primary key, c2 varchar(20), c3 varchar(20), c4 varchar(2),
|
||||
partition_id varchar(2) GENERATED ALWAYS AS (substr(c1,19,2)) VIRTUAL,
|
||||
CONSTRAINT cst_proxy_00 CHECK (c4 = substr(c3,19,2)),
|
||||
CONSTRAINT cst_proxy_02 CHECK (partition_id = substr(c2,19,2)))
|
||||
partition by list columns(partition_id)
|
||||
(partition p0 values in('00'), partition p1 values in('11'));
|
||||
|
||||
connection obsys;
|
||||
let $table_id = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='proxy_constrain_part_pruning_t' order by schema_version desc limit 1, table_id, 1);
|
||||
--disable_query_log
|
||||
eval select part_key_name, part_key_extra, part_key_expr from oceanbase.__all_virtual_proxy_partition_info where tenant_name = 'mysql' and table_id = $table_id;
|
||||
--enable_query_log
|
||||
|
||||
|
||||
# test part_key_default_value
|
||||
connection default;
|
||||
--echo
|
||||
--echo #******* 测试各数据类型的default_value是否正常输出,其中part_key_default_value是序列化后的二进制值。
|
||||
--disable_warnings
|
||||
drop table if exists default_value_t, default_value_null_t;
|
||||
create table default_value_t(c1 BOOL default true, c2 SMALLINT default 2, c3 MEDIUMINT default 3, c4 INT default 5,
|
||||
c5 BIGINT default 6, c6 DATE default '2020-10-10', c7 TIME default '15:56:23', c8 DATETIME default '2020-10-12 15:55:55',
|
||||
c9 TIMESTAMP default '2022-10-11 16:56:56', c10 YEAR default '2022', c11 CHAR(10) default 'aaa', c12 VARCHAR(10) default 'bbb')
|
||||
partition by key(c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12);
|
||||
create table default_value_null_t(c1 INT default 1, c2 INT, c3 INT GENERATED ALWAYS AS (c1 + 1)) partition by key(c2,c3);
|
||||
|
||||
connection obsys;
|
||||
let $table_id = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='default_value_t' order by schema_version desc limit 1, table_id, 1);
|
||||
--disable_query_log
|
||||
eval select part_key_default_value from oceanbase.__all_virtual_proxy_partition_info where tenant_name = 'mysql' and table_id = $table_id;
|
||||
--enable_query_log
|
||||
let $table_id = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='default_value_null_t' order by schema_version desc limit 1, table_id, 1);
|
||||
--disable_query_log
|
||||
eval select part_key_default_value from oceanbase.__all_virtual_proxy_partition_info where tenant_name = 'mysql' and table_id = $table_id;
|
||||
--enable_query_log
|
||||
|
||||
# bugfix: issue/48579037
|
||||
connection default;
|
||||
--disable_warnings
|
||||
drop table if exists proxy_list_hash;
|
||||
--enable_warnings
|
||||
create table proxy_list_hash(c1 int, c2 int, primary key(c1, c2)) partition by list (c1) subpartition by hash(c2) subpartitions 2 (partition p0 values in (null), partition p1 values in (1));
|
||||
let $tenant_id = `select effective_tenant_id()`;
|
||||
|
||||
connection obsys;
|
||||
let $table_id = query_get_value(select table_id from oceanbase.__all_virtual_table where tenant_id = $tenant_id and table_name = 'proxy_list_hash' order by schema_version desc limit 1, table_id, 1);
|
||||
--disable_query_log
|
||||
eval select part_name, high_bound_val from oceanbase.__all_virtual_proxy_partition where tenant_name = 'mysql' and table_id = $table_id;
|
||||
eval select part_name, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where tenant_name = 'mysql' and table_id = $table_id;
|
||||
--enable_query_log
|
||||
|
||||
connection default;
|
||||
--disable_warnings
|
||||
drop table if exists proxy_list_hash;
|
||||
--enable_warnings
|
||||
|
||||
disconnect obsys;
|
||||
@ -0,0 +1,138 @@
|
||||
#owner: wangzhennan.wzn
|
||||
#owner group: RS
|
||||
#description: Test __all_virtual_proxy_sub_partition;
|
||||
|
||||
connect (obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
connection default;
|
||||
--disable_query_log
|
||||
--disable_warnings
|
||||
|
||||
drop table if exists t_m_rclc;
|
||||
drop table if exists t2_m_lch;
|
||||
drop table if exists tbl2_m_krc;
|
||||
drop table if exists t2_f_hr;
|
||||
drop table if exists t2_f_rclc;
|
||||
|
||||
# Template sub partition
|
||||
# Range Columns + List Columns
|
||||
CREATE TABLE t_m_rclc(col1 INT,col2 INT)
|
||||
PARTITION BY RANGE COLUMNS(col1)
|
||||
SUBPARTITION BY LIST COLUMNS(col2)
|
||||
SUBPARTITION TEMPLATE
|
||||
(SUBPARTITION mp0 VALUES IN(1,3),
|
||||
SUBPARTITION mp1 VALUES IN(4,6),
|
||||
SUBPARTITION mp2 VALUES IN(7)
|
||||
)
|
||||
(PARTITION p0 VALUES LESS THAN(100),
|
||||
PARTITION p1 VALUES LESS THAN(200),
|
||||
PARTITION p2 VALUES LESS THAN(300)
|
||||
);
|
||||
|
||||
# List Columns + Hash
|
||||
CREATE TABLE t2_m_lch(col1 INT,col2 INT)
|
||||
PARTITION BY LIST COLUMNS(col1)
|
||||
SUBPARTITION BY HASH(col2) SUBPARTITIONS 5
|
||||
(PARTITION p0 VALUES IN(100),
|
||||
PARTITION p1 VALUES IN(200),
|
||||
PARTITION p2 VALUES IN(300)
|
||||
);
|
||||
|
||||
# Key + Range Columns
|
||||
CREATE TABLE tbl2_m_krc(col1 INT,col2 INT,col3 INT)
|
||||
PARTITION BY KEY(col1)
|
||||
SUBPARTITION BY RANGE COLUMNS(col2)
|
||||
SUBPARTITION TEMPLATE
|
||||
(SUBPARTITION sp0 VALUES LESS THAN(100),
|
||||
SUBPARTITION sp1 VALUES LESS THAN(200),
|
||||
SUBPARTITION sp2 VALUES LESS THAN(300)
|
||||
)
|
||||
(PARTITION p0,
|
||||
PARTITION p1,
|
||||
PARTITION p2
|
||||
);
|
||||
|
||||
# Non-template sub partition
|
||||
# Hash + Range
|
||||
CREATE TABLE t2_f_hr (col1 INT,col2 INT)
|
||||
PARTITION BY KEY(col1)
|
||||
SUBPARTITION BY RANGE(col2)
|
||||
(PARTITION p1
|
||||
(SUBPARTITION sp0 VALUES LESS THAN (2020)
|
||||
,SUBPARTITION sp1 VALUES LESS THAN (2021)
|
||||
,SUBPARTITION sp2 VALUES LESS THAN (2022)
|
||||
,SUBPARTITION sp3 VALUES LESS THAN (2023)
|
||||
),
|
||||
PARTITION p2
|
||||
(SUBPARTITION sp4 VALUES LESS THAN (2020)
|
||||
,SUBPARTITION sp5 VALUES LESS THAN (2021)
|
||||
,SUBPARTITION sp6 VALUES LESS THAN (2022)
|
||||
,SUBPARTITION sp7 VALUES LESS THAN (2023)
|
||||
)
|
||||
);
|
||||
|
||||
# Range Columns + List Columns
|
||||
CREATE TABLE t2_f_rclc (col1 INT,col2 INT)
|
||||
PARTITION BY RANGE COLUMNS(col1)
|
||||
SUBPARTITION BY LIST COLUMNS(col2)
|
||||
(PARTITION p0 VALUES LESS THAN(100)
|
||||
(SUBPARTITION sp0 VALUES IN(1,3),
|
||||
SUBPARTITION sp1 VALUES IN(4,6),
|
||||
SUBPARTITION sp2 VALUES IN(7,9)),
|
||||
PARTITION p1 VALUES LESS THAN(200)
|
||||
(SUBPARTITION sp3 VALUES IN(1,3),
|
||||
SUBPARTITION sp4 VALUES IN(4,6),
|
||||
SUBPARTITION sp5 VALUES IN(7,9))
|
||||
);
|
||||
|
||||
connection obsys;
|
||||
drop table if exists sys_t2_f_rclc;
|
||||
CREATE TABLE sys_t2_f_rclc (col1 INT,col2 INT)
|
||||
PARTITION BY RANGE COLUMNS(col1)
|
||||
SUBPARTITION BY LIST COLUMNS(col2)
|
||||
(PARTITION p0 VALUES LESS THAN(100)
|
||||
(SUBPARTITION sp0 VALUES IN(1,3),
|
||||
SUBPARTITION sp1 VALUES IN(4,6),
|
||||
SUBPARTITION sp2 VALUES IN(7,9)),
|
||||
PARTITION p1 VALUES LESS THAN(200)
|
||||
(SUBPARTITION sp3 VALUES IN(1,3),
|
||||
SUBPARTITION sp4 VALUES IN(4,6),
|
||||
SUBPARTITION sp5 VALUES IN(7,9))
|
||||
);
|
||||
|
||||
let $table_id_t_m_rclc = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='t_m_rclc' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where tenant_name = 'mysql' and table_id = $table_id_t_m_rclc;
|
||||
|
||||
let $table_id_t2_m_lch = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='t2_m_lch' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where tenant_name = 'mysql' and table_id = $table_id_t2_m_lch;
|
||||
|
||||
let $table_id_tbl2_m_krc = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='tbl2_m_krc' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where tenant_name = 'mysql' and table_id = $table_id_tbl2_m_krc;
|
||||
|
||||
let $table_id_t2_f_hr = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='t2_f_hr' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where tenant_name = 'mysql' and table_id = $table_id_t2_f_hr;
|
||||
|
||||
let $table_id_t2_f_rclc = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='t2_f_rclc' order by schema_version desc limit 1, table_id, 1);
|
||||
eval select part_name, low_bound_val, high_bound_val, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where tenant_name = 'mysql' and table_id = $table_id_t2_f_rclc;
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
eval select part_name, low_bound_val, high_bound_val, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where tenant_name = 'mysql';
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
eval select part_name, low_bound_val, high_bound_val, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where table_id = $table_id_t_m_rclc;
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
eval select part_name, low_bound_val, high_bound_val, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where (tenant_name, table_id) in (('mysql', $table_id_t_m_rclc),('mysql', $table_id_t2_m_lch));
|
||||
|
||||
# mysql tenant can only get tables belong to itself
|
||||
let $table_id_sys_t2_f_rclc = query_get_value(select table_id from oceanbase.__all_virtual_table where table_name='sys_t2_f_rclc' order by schema_version desc limit 1, table_id, 1);
|
||||
connection default;
|
||||
eval select part_name, low_bound_val, high_bound_val, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where tenant_name = 'sys' and table_id = $table_id_sys_t2_f_rclc;
|
||||
eval select part_name, low_bound_val, high_bound_val, sub_part_position from oceanbase.__all_virtual_proxy_sub_partition where tenant_name = 'mysql' and table_id = $table_id_t2_f_rclc;
|
||||
|
||||
drop table t_m_rclc;
|
||||
drop table t2_m_lch;
|
||||
drop table tbl2_m_krc;
|
||||
drop table t2_f_hr;
|
||||
drop table t2_f_rclc;
|
||||
|
||||
connection obsys;
|
||||
drop table sys_t2_f_rclc;
|
||||
Reference in New Issue
Block a user