obdumper 导出表ddl信息丢失table group信息

【 使用环境 】生产环境 or 测试环境
【 OB or 其他组件 】
【 使用版本 】
【问题描述】清晰明确描述问题
【复现路径】问题出现前后相关操作
【问题现象及影响】
obdumper 导出表ddl信息丢失table group信息
版本:4.0.1

复现:
建表组:create tablegroup testgroup1 partition by hash partitions 10;
建表:create table test100(id int ,name char(10),address char(10)) tablegroup testgroup1 partition by hash(id) partitions 10;
导出表结构:obdumper -h 1.2.3.4 -P 2883 -u root -t tenant1-c cluster1 -p ‘12345’ --sys-password ‘12345’ -D test --ddl --table test100 -f /home/admin/dump/
查看导出表结构:
cat dump/data/test/TABLE/test100-schema.sql
create table if not exists test100 (
id int(11),
name char(10),
address char(10)
)
default charset=utf8mb4
default collate=utf8mb4_general_ci
PARTITION BY HASH (id) PARTITIONS 10;
查看源表结构:
MySQL [test]> show create table test100;

| test100 | CREATE TABLE test100 (
id int(11) DEFAULT NULL,
name char(10) DEFAULT NULL,
address char(10) DEFAULT NULL
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = ‘zstd_1.3.8’ REPLICA_NUM = 3 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0 TABLEGROUP = ‘testgroup1’
partition by hash(id)
(partition p0,
partition p1,
partition p2,
partition p3,
partition p4,
partition p5,
partition p6,
partition p7,
partition p8,
partition p9)

【附件】

你好,你的问题我们已经收到。稍后会有相关同学给你回复。

可以指定 --table-group ‘testgroup1’ 单独导出表组定义。

当我使用导出工具的时候,我不确定数据库中存在哪些tg,也不知道他的名称。

可以指定 --table-group ‘*’ 单独导出所有的表组定义。

即使我指定tablegroup,建表ddl没有指定tablegroup,有啥用?

这是工具问题,显然是个bug

obdumper -h 1.2.3.4 -P 2883 -u root -t tenant1-c cluster1 -p ‘12345’ --sys-password ‘12345’ -D test --ddl --table test100 --add-extra-message -f /home/admin/dump/

导出采用:obdumper -h 1.2.3.4 -P 2883 -u root -t tenant1-c cluster1 -p ‘12345’ --sys-password ‘12345’ -D test --ddl --table test100 --add-extra-message --table-group ‘*’ -f /home/admin/dump/

导入采用:obloader -h 1.2.3.4 -P 2883 -u root -t tenant1-c cluster1 -p ‘12345’ --sys-password ‘12345’ -D test --ddl --table test100 --table-group ‘’ -f /home/admin/dump/ 报错,其中表组创建成功,但表创建失败,
使用obloader -h 1.2.3.4 -P 2883 -u root -t tenant1-c cluster1 -p ‘12345’ --sys-password ‘12345’ -D test --ddl --table-group '
’ --table test100 -f /home/admin/dump/ 成功
是否说明指定的条件先后顺序对导入有影响?

多谢

顺序:优先创建表组,再创建表。

建表报什么错误:SQL语法错误?还是报 表组不存在错误?

table在前,tablegroup在后,报错信息为tablegroup not exist

可能是 4.0.1 版本没有处理好依赖顺序,请使用最新的 4.2.4 版本。