apache / incubator-seata

:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution.
https://seata.apache.org/
Apache License 2.0
25.33k stars 8.78k forks source link

OceanBase数据库mysql模式,分区表主键是两个字段,无法回滚 #6531

Open lbj812 opened 6 months ago

lbj812 commented 6 months ago

用的是OceanBase数据库企业版 3.2.2,因为数据量很大,所以用了分区表 以下是建表语句: CREATE TABLE sto_kucun_move_detail_title ( id bigint(20) NOT NULL AUTO_INCREMENT, mtanr_vouch_no varchar(60) NOT NULL COMMENT '商品凭证编号', order_date datetime NOT NULL COMMENT '单据日期(业务日期,凭证日期)', posting_date datetime DEFAULT NULL COMMENT '过账日期', create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', cankao_vouch_text varchar(60) DEFAULT NULL COMMENT '参考凭证文本', vouch_title_text varchar(60) DEFAULT NULL COMMENT '凭证抬头文本', note_order_no varchar(300) DEFAULT NULL COMMENT '备注单号', vouch_type varchar(2) DEFAULT NULL COMMENT 'C1出库 R1入库 A1移库', td_order varchar(20) DEFAULT NULL COMMENT '天端参考单号', order_type varchar(10) DEFAULT NULL COMMENT '单据类型', order_type_name varchar(50) DEFAULT NULL COMMENT '天端订单类型描述', sapcankao_order varchar(20) DEFAULT NULL COMMENT 'sap参考编号', congxiao_vouch_no varchar(30) DEFAULT NULL COMMENT '冲销凭证的凭证号', imei_update_result int(1) NOT NULL DEFAULT '0' COMMENT '串码更新结果 1完成', imei_update_flag int(1) NOT NULL DEFAULT '0' COMMENT '串码更新标识 0否,1是', update_time datetime DEFAULT NULL COMMENT '更新时间', create_user varchar(30) DEFAULT NULL COMMENT '创建者用户名', create_name varchar(50) DEFAULT NULL COMMENT '创建者姓名', congxiao_flag varchar(1) DEFAULT NULL COMMENT '冲销标识:1冲销2被冲销', business_type varchar(5) DEFAULT NULL COMMENT '业务类型', version int(10) DEFAULT NULL, churuku_status int(1) DEFAULT NULL COMMENT '出入库标识 1出库 2入库', manual_status varchar(2) DEFAULT '0' COMMENT '是否手工更新(0为否,1为是)', PRIMARY KEY (id, create_time), UNIQUE KEY sto_goods_vouch (mtanr_vouch_no) GLOBAL, UNIQUE KEY id (id) GLOBAL, KEY order_date (order_date) GLOBAL, KEY order_type (order_type) GLOBAL, KEY sapcankao_order (sapcankao_order) GLOBAL, KEY td_order (td_order) GLOBAL ) DEFAULT CHARSET = utf8mb4 COMMENT = '物料凭证抬头表' partition by list(year(create_time)) (partition p2020 values in (2020), partition p2021 values in (2021), partition p2022 values in (2022), partition p2023 values in (2023), partition p2024 values in (2024), partition p2025 values in (2025));

因为要根据字段 create_time 做分区,所以create_time字段必须包含在主键中,所以主键是两个字段 :id 和 create_time。 OceanBase的分区表是这样要求的,分区键必须包含在主键中。

我用的seata版本是 1.7.0

funky-eyes commented 5 months ago

OceanBase的mode是什么?mysql还是oracle? What is the mode of OceanBase? MySQL or Oracle?

Bughue commented 5 months ago

OceanBase的mode是什么?mysql还是oracle? What is the mode of OceanBase? MySQL or Oracle?

标题写的是mysql

funky-eyes commented 5 months ago

OceanBase的mode是什么?mysql还是oracle? What is the mode of OceanBase? MySQL or Oracle?

标题写的是mysql

mysql已经支持多主键了,就提交的信息无法判断问题是什么引起的 MySQL already supports multiple primary keys, so the commit information cannot determine what caused the problem.

lbj812 commented 5 months ago

这个表就是多主键,关键是 seata不支持多主键回滚。

lbj812 commented 4 months ago

OceanBase的mode是什么?mysql还是oracle? What is the mode of OceanBase? MySQL or Oracle?

标题写的是mysql

mysql已经支持多主键了,就提交的信息无法判断问题是什么引起的 MySQL already supports multiple primary keys, so the commit information cannot determine what caused the problem.

从哪个版本开始支持的?

funky-eyes commented 4 months ago

把异常信息拿出来,我怀疑是sql中的大小写问题,跟数据表不一致导致的,2.1上会修复

lbj812 commented 2 months ago

把异常信息拿出来,我怀疑是sql中的大小写问题,跟数据表不一致导致的,2.1上会修复

sql中的大小写问题,说得具体一点,麻烦您举个例子,我先试试