一、问题处理说明 哈希分区表及key分区表迁移后,分区数据和mysql分区数据不一样 二、问题描述 【测试类型:工具功能】【测试版本:3.0.1】 问题描述:哈希分区表及key分区表迁移后,分区数据和mysql分区数据不一样 https://e.gitee.com/opengaussorg/dashboard?issue=I5EVDM
在该问题单中主要问题在于,迁移后,mysql与openGauss创建的分区一致,但是插入数据后,数据分放在了不同的分区中。
mysql创建哈希分区表并查询各个分区数据
mysql> create table t_chameleon_ddl_1201_1 ( -> id int not null, -> fname varchar(30), -> lname varchar(30) -> ) -> partition by hash (id) partitions 4; Query OK, 0 rows affected (0.04 sec)
mysql> insert into t_chameleon_ddl_1201_1 values -> (1, "jim", "smith"), -> (2, "mary", "jones"), -> (3, "frank", "white"), -> (4, "linda", "black"); Query OK, 4 rows affected (0.00 sec) Records: 4 Duplicates: 0 Warnings: 0
mysql> select * from t_chameleon_ddl_1201_1 partition (p0); +----+-------+-------+| id | fname | lname | +----+-------+-------+| 4 | linda | black | +----+-------+-------+ 1 row in set (0.00 sec)
mysql> select * from t_chameleon_ddl_1201_1 partition (p1); +----+-------+-------+| id | fname | lname | +----+-------+-------+| 1 | jim | smith | +----+-------+-------+ 1 row in set (0.00 sec)
mysql> select * from t_chameleon_ddl_1201_1 partition (p2); +----+-------+-------+| id | fname | lname | +----+-------+-------+| 2 | mary | jones | +----+-------+-------+ 1 row in set (0.00 sec)
mysql> select * from t_chameleon_ddl_1201_1 partition (p3); +----+-------+-------+| id | fname | lname | +----+-------+-------+| 3 | frank | white | +----+-------+-------+ 1 row in set (0.00 sec) openGauss侧查询
target_testdb=> select * from t_chameleon_ddl_1201_1 partition (p0); id | fname | lname ----+-------+------- 3 | frank | white4 | linda | black (2 rows)
target_testdb=> select * from t_chameleon_ddl_1201_1 partition (p1); id | fname | lname ----+-------+------- 1 | jim | smith2 | mary | jones (2 rows)
target_testdb=> select * from t_chameleon_ddl_1201_1 partition (p2); id | fname | lname ----+-------+------- (0 rows)
target_testdb=> select * from t_chameleon_ddl_1201_1 partition (p3); id | fname | lname ----+-------+------- (0 rows) 转化后的ddl语句在openGauss侧直接执行: CREATE TABLE "sch_mysql_database"."t_chameleon_ddl_1201_1" ( "id" integer NOT NULL , "fname" character varying (30) NULL , "lname" character varying (30) NULL ) PARTITION BY HASH(id) ( partition p0 , partition p1 , partition p2 , partition p3 ); insert into t_chameleon_ddl_1201_1 values(1, 'jim', 'smith'),(2, 'mary', 'jones'),(3, 'frank', 'white'),(4, 'linda', 'black'); 结果与MySQL侧分区数据存放不一致 三、根因分析 对于MySQL和openGauss,同样是创建了4个hash分区,但是在创建hash分区时并无分区规则的限制,由于MySQL和openGauss中hash分区内核实现的不同,使得上述样例四个数据在mysql侧分别放在四个分区,而对于openGauss则是放在了前两个分区。该问题无法从chameleon工具层面解决。
四、消减或规避措施 五、处理满足度 六、影响分析 由于由于MySQL和openGauss中hash分区内核实现的不同,hash分区表及key分区表迁移后,插入的数据在MySQL侧与openGauss侧放置分区,导致分区数据不一样。 七、决策点 是否同意将该问题单转为需求。