datavane / tis

Support agile DataOps Based on Flink, DataX and Flink-CDC, Chunjun with Web-UI
https://tis.pub
Apache License 2.0
1.04k stars 221 forks source link

修改分表识别自定义规则没有生效 #361

Closed wzc789376152 closed 2 months ago

wzc789376152 commented 2 months ago

表分区策略设置为on,分表识别规则不管怎么设置都是默认的。不起作用。

baisui1981 commented 2 months ago

能否加详细说明一下?或者加微信 16660356

wzc789376152 commented 2 months ago

涉及的表如下

CREATE TABLE `db_code_bind_log_2024_5` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='码日志表';

CREATE TABLE `db_code_bind_log_2024_6` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='码日志表';

CREATE TABLE `db_code_bind_log_2024_7` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='码日志表';

CREATE TABLE `db_code_bind_log_2024_8` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='码日志表';

CREATE TABLE `db_code_bind_log_2024_9` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='码日志表';

另一种规则表

CREATE TABLE `db_code_point_100` (
  `id` bigint NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='码表';

CREATE TABLE `db_code_point_101` (
  `id` bigint NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='码表';

CREATE TABLE `db_code_point_102` (
  `id` bigint NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='码表';
wzc789376152 commented 2 months ago

问题描述,在开启分表规则策略时 db_code_bindlog 相关的几个表,只会满足(\S+)(\d+)匹配规则,合并成db_code_bind_log_2024,无论怎么设置都是无效的。db_code_point 表则会按照规则合并,但是设置不属于它的规则,也通向合并db_code_point。

微信图片_20240920125048 微信图片_20240920125154 微信图片_20240920125215

正则式:db_code_bind_log_2024_(\d+)

baisui1981 commented 2 months ago

查看了一下代码,确实如您所说使用默认值在进行匹配,这个已经修复了。 另外,正对您提供的两种表的样式,可以使用正则式:(\S+?)_([\d_]+) 进行匹配,可识别成以下两个逻辑表名:

  1. db_code_bind_log
  2. db_code_point