dm同步不支持增加分区

【 TiDB 使用环境】生产环境
【 TiDB 版本】
【复现路径】上游添加新分区,dm同步报错

下游是分区表,下游表结构
CREATE TABLE leader_order (
id bigint(20) NOT NULL AUTO_INCREMENT,
tenant_id int(11) NOT NULL DEFAULT ‘0’ COMMENT ‘团长租户主键’,
salesman_user_id int(11) NOT NULL DEFAULT ‘0’ COMMENT ‘达人id。rbac_common_user表id’,
salesman_user_info_id int(11) NOT NULL DEFAULT ‘0’ COMMENT ‘带货账号主键id’,
promote_platform_type int(2) NOT NULL COMMENT ‘推广平台类型 1抖音,2有赞,3快手 6视频号’,
relate_shop_salesman_id varchar(100) DEFAULT ‘0’ COMMENT ‘第三方达人号或达人id’,
relate_shop_salesman_name varchar(100) DEFAULT ‘’ COMMENT ‘第三方推广名称’,
relate_order_no varchar(100) NOT NULL COMMENT ‘第三方订单编号’,
relate_activity_id varchar(100) DEFAULT ‘’ COMMENT ‘第三方活动id’,
amount int(11) NOT NULL COMMENT ‘购买数量’,
status tinyint(2) NOT NULL COMMENT ‘0待付款 1已支付、2已结算、3退货退款 4 已收货’,
relate_shop_id varchar(255) DEFAULT NULL COMMENT ‘第三方店铺ID’,
relate_shop_name varchar(255) DEFAULT NULL COMMENT ‘第三方店铺名称’,
relate_product_id varchar(255) DEFAULT NULL COMMENT ‘第三方商品ID’,
relate_product_name varchar(255) DEFAULT NULL COMMENT ‘第三方商品名称’,
relate_product_img varchar(500) DEFAULT NULL COMMENT ‘第三方商品主图’,
buyer_paid bigint(20) DEFAULT ‘0’ COMMENT ‘买家实付金额’,
sys_relate_service_money_level_one bigint(20) DEFAULT ‘0’ COMMENT ‘预计第三方一级团长(普通团长)服务费’,
actual_relate_service_money_level_one bigint(20) DEFAULT ‘0’ COMMENT ‘实际第三方一级团长(普通团长)服务费’,
relate_service_ratio_level_one decimal(15,5) DEFAULT NULL COMMENT ‘一级团长(普通团长)服务费率’,
sys_relate_service_money_level_sec bigint(20) DEFAULT ‘0’ COMMENT ‘预计第三方二级团长服务费’,
actual_relate_service_money_level_sec bigint(20) DEFAULT ‘0’ COMMENT ‘实际第三方二级团长服务费’,
relate_service_ratio_level_sec decimal(15,5) DEFAULT NULL COMMENT ‘二级团长服务费率’,
leader_sys_service_money decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘团长预估收入的服务费’,
leader_actual_service_money decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘团长实际收入的服务费(一级团-二级团)’,
leader_service_ratio decimal(15,5) DEFAULT ‘0.00000’ COMMENT ‘团长收入的服务费率’,
relate_technical_service_ratio decimal(15,5) DEFAULT NULL COMMENT ‘团长技术服务费率’,
sys_relate_technical_service_money bigint(20) DEFAULT ‘0’ COMMENT ‘预计团长技术服务费’,
actual_relate_technical_service_money bigint(20) DEFAULT ‘0’ COMMENT ‘实际团长技术服务费’,
sys_settle_money bigint(20) DEFAULT ‘0’ COMMENT ‘预计参与结算金额’,
actual_settle_money bigint(20) DEFAULT ‘0’ COMMENT ‘实际参与结算金额’,
relate_salesman_commission bigint(20) DEFAULT ‘0’ COMMENT ‘预计第三方达人佣金’,
actual_relate_salesman_commission bigint(20) DEFAULT ‘0’ COMMENT ‘实际第三方达人佣金’,
relate_salesman_commission_ratio decimal(15,5) DEFAULT NULL COMMENT ‘第三方达人佣金率’,
link_id bigint(20) DEFAULT ‘0’ COMMENT ‘商品链接ID’,
order_settle_time datetime DEFAULT NULL COMMENT ‘订单结算时间’,
order_pay_time datetime DEFAULT NULL COMMENT ‘买家付款时间’,
order_refund_time datetime DEFAULT NULL COMMENT ‘订单退款时间’,
order_confirm_time datetime DEFAULT NULL COMMENT ‘确认收货时间’,
remark varchar(1000) DEFAULT NULL COMMENT ‘商家备注’,
leasing_manager_id bigint(20) NOT NULL DEFAULT ‘0’ COMMENT ‘招商负责人ID’,
media_director_id bigint(20) NOT NULL DEFAULT ‘0’ COMMENT ‘媒介经理ID’,
institution_id varchar(100) DEFAULT NULL COMMENT ‘当前订单主体团长机构ID(普通、一级为一级团长,二级为二级团长)’,
institution_id_level_one varchar(100) DEFAULT NULL COMMENT ‘一级团长机构ID’,
institution_name_level_one varchar(500) DEFAULT NULL COMMENT ‘一级团长机构名称’,
institution_id_level_sec varchar(100) DEFAULT NULL COMMENT ‘二级团长机构ID’,
institution_name_level_sec varchar(500) DEFAULT NULL COMMENT ‘二级团长机构名称’,
relate_order_source tinyint(2) DEFAULT ‘1’ COMMENT ‘第三方订单来源:1其他 2橱窗 3视频 4直播’,
colonel_type tinyint(1) DEFAULT ‘0’ COMMENT ‘团长类型。0:普通;1:一级团长;2: 二级团长’,
sales_role tinyint(2) DEFAULT ‘1’ COMMENT ‘带货账号角色 1达人,2二级团长’,
platform_order_xxg_sample_apply tinyint(2) NOT NULL DEFAULT ‘0’ COMMENT ‘平台单类型(寄样,普通团的达人寄样,一级团的团长寄样),0不是,1是。’,
platform_order_xxg_apply_activity_sec tinyint(2) NOT NULL DEFAULT ‘0’ COMMENT ‘平台单类型(二级团报名,一级团的主动报名,二级团的被动报名),0不是,1是。’,
media_id varchar(255) DEFAULT NULL COMMENT ‘视频/直播间 id’,
promote_terminal varchar(100) DEFAULT NULL COMMENT ‘推广终端:抖音,火山’,
relate_user_no varchar(100) DEFAULT ‘0’ COMMENT ‘第三方达人号’,
relate_user_id varchar(100) DEFAULT ‘0’ COMMENT ‘第三方达人Id’,
operator varchar(100) NOT NULL COMMENT ‘操作人’,
create_time datetime DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间’,
update_time datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT ‘更新时间’,
display_to_user tinyint(2) NOT NULL DEFAULT ‘0’ COMMENT ‘展示给用户,-1不展示,0展示’,
platform_sys_service_money decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘公共团长预估服务费(扣除代理服务费前的)’,
platform_actual_service_money decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘公共团长实际服务费(扣除代理服务费前的)’,
platform_service_ratio decimal(15,5) DEFAULT ‘0.00000’ COMMENT ‘公共团长服务费比例(扣除代理服务费前的)’,
pusher_sys_service_money decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘推手预估服务费’,
pusher_actual_service_money decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘推手实际服务费’,
pusher_divide_ratio decimal(15,5) DEFAULT ‘0.00000’ COMMENT ‘推手服务费比例(代理团长服务费率*推手分成比例)’,
virtual_leader tinyint(2) NOT NULL DEFAULT ‘0’ COMMENT ‘是否代理团长,1是,0不是’,
pusher_order tinyint(2) NOT NULL DEFAULT ‘0’ COMMENT ‘是否推手订单,1是,0不是’,
platform_settle_status tinyint(2) NOT NULL DEFAULT ‘0’ COMMENT ‘兴选结算状态:未结算:0 已结算:1 不需结算:2’,
platform_settle_time datetime DEFAULT NULL COMMENT ‘兴选订单结算时间’,
team_pusher_sys_service_money decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘团队推手总预估服务费(不包含出单推手)’,
team_pusher_actual_service_money decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘团队推手总实际服务费(不包含出单推手)’,
team_pusher_divide_ratio decimal(15,5) DEFAULT ‘0.00000’ COMMENT ‘团队推手总服务费分成比例(不包含出单推手)’,
all_pusher_sys_service_money decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘所有推手预估服务费(包含出单推手)’,
all_pusher_actual_service_money decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘所有推手实际服务费(包含出单推手)’,
all_pusher_divide_ratio decimal(15,5) DEFAULT ‘0.00000’ COMMENT ‘所有推手服务费分成比例(包含出单推手)’,
virtual_leader_divide_ratio decimal(15,5) DEFAULT ‘0.00000’ COMMENT ‘代理团长分成比例’,
xxg_sys_profit decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘兴选官预估收益=预估公共团长服务费-预估代理服务费’,
xxg_actual_profit decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘兴选官实际收益=实际公共团长服务费-实际代理服务费’,
virtual_leader_sys_profit decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘代理团长预估收益=代理预估服务费-出单推手预估服务费-团队推手预估服务费’,
virtual_leader_actual_profit decimal(15,4) DEFAULT ‘0.0000’ COMMENT ‘代理团长实际收益=代理实际服务费-出单推手实际服务费-团队推手实际服务费’,
PRIMARY KEY (id,tenant_id) /*T![clustered_index] NONCLUSTERED */,
UNIQUE KEY relate_order_no_tenant_id (relate_order_no,tenant_id,promote_platform_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=111818750 /*T! SHARD_ROW_ID_BITS=4 PRE_SPLIT_REGIONS=2 */ COMMENT=‘团长订单’
PARTITION BY RANGE (tenant_id)
(PARTITION p3 VALUES LESS THAN (4),
PARTITION p4 VALUES LESS THAN (6),
PARTITION p6 VALUES LESS THAN (9),
PARTITION p9 VALUES LESS THAN (16),
PARTITION p16 VALUES LESS THAN (24),
PARTITION p24 VALUES LESS THAN (25),
PARTITION p25 VALUES LESS THAN (29),
PARTITION p29 VALUES LESS THAN (30),
PARTITION p30 VALUES LESS THAN (39),
PARTITION p39 VALUES LESS THAN (46),
PARTITION p46 VALUES LESS THAN (47),
PARTITION p47 VALUES LESS THAN (49),
PARTITION p49 VALUES LESS THAN (50),
PARTITION p50 VALUES LESS THAN (51),
PARTITION p51 VALUES LESS THAN (57),
PARTITION p57 VALUES LESS THAN (58),
PARTITION p58 VALUES LESS THAN (61),
PARTITION p61 VALUES LESS THAN (62),
PARTITION p62 VALUES LESS THAN (63),
PARTITION p63 VALUES LESS THAN (65),
PARTITION p65 VALUES LESS THAN (67),
PARTITION p67 VALUES LESS THAN (68),
PARTITION p68 VALUES LESS THAN (70),
PARTITION p70 VALUES LESS THAN (74),
PARTITION p74 VALUES LESS THAN (85),
PARTITION p85 VALUES LESS THAN (90),
PARTITION p90 VALUES LESS THAN (97),
PARTITION p97 VALUES LESS THAN (99),
PARTITION p99 VALUES LESS THAN (101),
PARTITION p101 VALUES LESS THAN (104),
PARTITION p104 VALUES LESS THAN (105),
PARTITION p105 VALUES LESS THAN (106),
PARTITION p106 VALUES LESS THAN (107),
PARTITION p107 VALUES LESS THAN (109),
PARTITION p109 VALUES LESS THAN (110),
PARTITION p110 VALUES LESS THAN (114),
PARTITION p114 VALUES LESS THAN (115),
PARTITION p115 VALUES LESS THAN (118),
PARTITION p118 VALUES LESS THAN (120),
PARTITION p120 VALUES LESS THAN (121),
PARTITION p121 VALUES LESS THAN (123),
PARTITION p123 VALUES LESS THAN (129),
PARTITION p129 VALUES LESS THAN (130),
PARTITION p130 VALUES LESS THAN (135),
PARTITION p135 VALUES LESS THAN (142),
PARTITION p142 VALUES LESS THAN (147),
PARTITION p147 VALUES LESS THAN (152),
PARTITION p152 VALUES LESS THAN (155),
PARTITION p155 VALUES LESS THAN (157),
PARTITION p157 VALUES LESS THAN (158),
PARTITION p158 VALUES LESS THAN (161),
PARTITION p161 VALUES LESS THAN (165),
PARTITION p165 VALUES LESS THAN (170),
PARTITION p170 VALUES LESS THAN (175),
PARTITION p175 VALUES LESS THAN (180),
PARTITION p180 VALUES LESS THAN (184),
PARTITION p184 VALUES LESS THAN (187),
PARTITION p187 VALUES LESS THAN (190),
PARTITION p190 VALUES LESS THAN (194),
PARTITION p194 VALUES LESS THAN (200),
PARTITION p200 VALUES LESS THAN (204),
PARTITION p204 VALUES LESS THAN (207),
PARTITION p207 VALUES LESS THAN (210),
PARTITION p210 VALUES LESS THAN (214),
PARTITION p214 VALUES LESS THAN (217),
PARTITION p217 VALUES LESS THAN (220),
PARTITION p220 VALUES LESS THAN (224),
PARTITION p224 VALUES LESS THAN (227),
PARTITION p227 VALUES LESS THAN (230),
PARTITION p230 VALUES LESS THAN (234),
PARTITION p234 VALUES LESS THAN (237),
PARTITION p237 VALUES LESS THAN (240))

其实报错已经很清楚了,你在非分区表上执行了分区语句。应该是下游的TiDB上,这个表并不是分区表吧

可以参考一下: https://docs.pingcap.com/zh/tidb/stable/dm-binlog-event-filter , 把上游MySQL的partition类操作都过滤下

下游这个表是分区表,但是dm 不识别

tidb 里面 create like 下这个表,然后再 create 出的表上执行这个 ddl ,看看报错不。如果不报错代表 dm 里面的 sync 的 parser 部分代码可能比较老。如果报错就是语法不支持。

试下执行binlog-schema update 更新一下缓存的schema试下?

1 个赞

知道原因了, 同事用普通表 修改过字段更新。 dm 里面是旧的schema

在非分区表上执行了分区语句是不支持的。检查一下表结构

感谢大佬的分享,学习了

确保同步的表一致应该就不会出现问题。要么都分,要么都不分。

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。