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

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

Open
lbj812 opened this issue May 11, 2024 · 4 comments
Open

Comments

@lbj812
Copy link

lbj812 commented May 11, 2024

用的是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
Copy link
Contributor

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

@Bughue
Copy link
Contributor

Bughue commented May 21, 2024

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

标题写的是mysql

@funky-eyes
Copy link
Contributor

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

lbj812 commented May 28, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants