Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wzc789376152 opened this issue Sep 19, 2024 · 4 comments
Closed

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

wzc789376152 opened this issue Sep 19, 2024 · 4 comments
Labels
bug Something isn't working
Milestone

Comments

@wzc789376152
Copy link

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

@baisui1981
Copy link
Member

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

@wzc789376152
Copy link
Author

wzc789376152 commented Sep 20, 2024

涉及的表如下

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
Copy link
Author

wzc789376152 commented Sep 20, 2024

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

正则式:db_code_bind_log_2024_(\d+)

@baisui1981
Copy link
Member

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

  1. db_code_bind_log
  2. db_code_point

@baisui1981 baisui1981 added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Sep 23, 2024
@baisui1981 baisui1981 added this to the V4.0.1 milestone Sep 23, 2024
@baisui1981 baisui1981 changed the title 分表识别自定义规则怎么设置? 修改分表识别自定义规则没有生效 Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants