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.36k stars 8.79k forks source link

seata2.1.0 服务端用mysql+SqlServer业务端+客户端2.0.0 主键使用雪花算法,回滚事务报没有标识属性。无法执行 SET 操作 #6450

Open zhao-wen-bin opened 7 months ago

zhao-wen-bin commented 7 months ago

2024-03-28 13:52:50.385 ERROR 11556 --- [_RMROLE_1_16_16] i.seata.rm.datasource.DataSourceManager : [stacktrace]branchRollback failed. branchType:[AT], xid:[192.168.1.5:8091:6629803150973841558], branchId:[6629803150973841560], resourceId:[jdbc:sqlserver://sqlserver:1433;databaseName=DL_CP_WMS_DEVICE], applicationData:[null]. reason:[Branch session rollback failed and try again later xid = 192.168.1.5:8091:6629803150973841558 branchId = 6629803150973841560 表 'rf_collection' 没有标识属性。无法执行 SET 操作。]

io.seata.core.exception.BranchTransactionException: Branch session rollback failed and try again later xid = 192.168.1.5:8091:6629803150973841558 branchId = 6629803150973841560 表 'rf_collection' 没有标识属性。无法执行 SET 操作。 at io.seata.rm.datasource.undo.AbstractUndoLogManager.undo(AbstractUndoLogManager.java:370) at io.seata.rm.datasource.DataSourceManager.branchRollback(DataSourceManager.java:122) at io.seata.rm.AbstractRMHandler.doBranchRollback(AbstractRMHandler.java:125) at io.seata.rm.AbstractRMHandler$2.execute(AbstractRMHandler.java:67) at io.seata.rm.AbstractRMHandler$2.execute(AbstractRMHandler.java:63) at io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:131) at io.seata.rm.AbstractRMHandler.handle(AbstractRMHandler.java:63) at io.seata.rm.DefaultRMHandler.handle(DefaultRMHandler.java:68) at io.seata.core.protocol.transaction.BranchRollbackRequest.handle(BranchRollbackRequest.java:35) at io.seata.rm.AbstractRMHandler.onRequest(AbstractRMHandler.java:150) at io.seata.core.rpc.processor.client.RmBranchRollbackProcessor.handleBranchRollback(RmBranchRollbackProcessor.java:63) at io.seata.core.rpc.processor.client.RmBranchRollbackProcessor.process(RmBranchRollbackProcessor.java:58) at io.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:280) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 表 'rf_collection' 没有标识属性。无法执行 SET 操作。 at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1624) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:594) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:524) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2979) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:473) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:3254) at com.alibaba.druid.filter.FilterAdapter.preparedStatement_executeUpdate(FilterAdapter.java:1075) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeUpdate(FilterEventAdapter.java:486) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:3252) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeUpdate(PreparedStatementProxyImpl.java:192) at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:241) at io.seata.rm.datasource.undo.AbstractUndoExecutor.executeOn(AbstractUndoExecutor.java:137) at io.seata.rm.datasource.undo.AbstractUndoLogManager.undo(AbstractUndoLogManager.java:317) ... 16 common frames omitted

2024-03-28 13:52:50.385 INFO 11556 --- [_RMROLE_1_16_16] io.seata.rm.AbstractRMHandler : Branch Rollbacked result: PhaseTwo_RollbackFailed_Retryable 2024-03-28 13:52:51.372 INFO 11556 --- [h_RMROLE_1_1_16] i.s.c.r.p.c.RmBranchRollbackProcessor : rm handle branch rollback process:BranchRollbackRequest{xid='192.168.1.5:8091:6629803150973841558', branchId=6629803150973841560, branchType=AT, resourceId='jdbc:sqlserver://sqlserver:1433;databaseName=DL_CP_WMS_DEVICE', applicationData='null'}

-- undolog内容 image

-- rf_collection 的表结构

IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[rf_collection]') AND type IN ('U')) DROP TABLE [dbo].[rf_collection] GO

CREATE TABLE [dbo].[rf_collection] ( [id] varchar(32) COLLATE Chinese_PRC_CI_AS NOT NULL, [fixture_code] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [fixture_name] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [line_code] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [line_name] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [class_code] varchar(32) COLLATE Chinese_PRC_CI_AS NOT NULL, [class_name] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [warehouse_id] varchar(32) COLLATE Chinese_PRC_CI_AS NOT NULL, [warehouse_name] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [stock_location_id] varchar(32) COLLATE Chinese_PRC_CI_AS NOT NULL, [stock_location_name] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [tray_code] varchar(32) COLLATE Chinese_PRC_CI_AS NOT NULL, [goods_id] varchar(32) COLLATE Chinese_PRC_CI_AS NOT NULL, [goods_name] nvarchar(128) COLLATE Chinese_PRC_CI_AS NULL, [goods_spec] nvarchar(255) COLLATE Chinese_PRC_CI_AS NULL, [goods_bar_code] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [goods_unit_id] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [goods_unit_name] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [goods_order_code] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [goods_sap_code] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [other_code] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [print_date] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [batch_code] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [goods_status_id] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [goods_status_name] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [num] decimal(18,3) NULL, [batch_rule_id] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [batch_rule_name] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [inout_type_id] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [inout_type_name] nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL, [task_id] int NULL, [is_tray] char(1) COLLATE Chinese_PRC_CI_AS DEFAULT '0' NULL, [print_sign] char(1) COLLATE Chinese_PRC_CI_AS NULL, [left_or_right] varchar(1) COLLATE Chinese_PRC_CI_AS NULL, [is_in] char(1) COLLATE Chinese_PRC_CI_AS NULL, [err_type] char(1) COLLATE Chinese_PRC_CI_AS NULL, [tray_time] datetime DEFAULT getdate() NULL, [src_table_code] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [src_line] int NULL, [order_code] varchar(12) COLLATE Chinese_PRC_CI_AS NULL, [order_line] varchar(4) COLLATE Chinese_PRC_CI_AS NULL, [return_id] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, [line_no] varchar(8) COLLATE Chinese_PRC_CI_AS NULL, [remark] nvarchar(512) COLLATE Chinese_PRC_CI_AS NULL, [create_by] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [create_time] datetime NULL, [update_by] varchar(32) COLLATE Chinese_PRC_CI_AS NULL, [update_time] datetime NULL, [tenant_id] varchar(32) COLLATE Chinese_PRC_CI_AS NULL ) GO

ALTER TABLE [dbo].[rf_collection] SET (LOCK_ESCALATION = TABLE) GO

EXEC sp_addextendedproperty 'MS_Description', N'主键ID', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'id' GO

EXEC sp_addextendedproperty 'MS_Description', N'输送机编码', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'fixture_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'输送机名称', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'fixture_name' GO

EXEC sp_addextendedproperty 'MS_Description', N'生产线编码', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'line_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'生产线名称', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'line_name' GO

EXEC sp_addextendedproperty 'MS_Description', N'班次编码', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'class_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'班次名称', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'class_name' GO

EXEC sp_addextendedproperty 'MS_Description', N'库房ID', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'warehouse_id' GO

EXEC sp_addextendedproperty 'MS_Description', N'库房名称', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'warehouse_name' GO

EXEC sp_addextendedproperty 'MS_Description', N'库存地点ID', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'stock_location_id' GO

EXEC sp_addextendedproperty 'MS_Description', N'库存地点名称', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'stock_location_name' GO

EXEC sp_addextendedproperty 'MS_Description', N'托盘编码', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'tray_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品ID', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'goods_id' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品名称', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'goods_name' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品规格型号', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'goods_spec' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品编码', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'goods_bar_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品单位ID', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'goods_unit_id' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品单位名称', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'goods_unit_name' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品条码', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'goods_order_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'SAP产品编码', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'goods_sap_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'其他外部产品编码', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'other_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品日期', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'print_date' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品批次', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'batch_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品状态ID', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'goods_status_id' GO

EXEC sp_addextendedproperty 'MS_Description', N'产品状态名称', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'goods_status_name' GO

EXEC sp_addextendedproperty 'MS_Description', N'组托数量', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'num' GO

EXEC sp_addextendedproperty 'MS_Description', N'批次规则ID', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'batch_rule_id' GO

EXEC sp_addextendedproperty 'MS_Description', N'批次规则名称', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'batch_rule_name' GO

EXEC sp_addextendedproperty 'MS_Description', N'单据类型ID', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'inout_type_id' GO

EXEC sp_addextendedproperty 'MS_Description', N'单据类型名称', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'inout_type_name' GO

EXEC sp_addextendedproperty 'MS_Description', N'流水号', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'task_id' GO

EXEC sp_addextendedproperty 'MS_Description', N'托盘标志(0不是托盘,1是托盘)', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'is_tray' GO

EXEC sp_addextendedproperty 'MS_Description', N'打印标志(0等待贴标机打印,1等待人工打印,2打印完成,3贴标完成,4无需打印)', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'print_sign' GO

EXEC sp_addextendedproperty 'MS_Description', N'左右去向(0等待分配,1左,2右)', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'left_or_right' GO

EXEC sp_addextendedproperty 'MS_Description', N'直接入库标志', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'is_in' GO

EXEC sp_addextendedproperty 'MS_Description', N'采集错误类型', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'err_type' GO

EXEC sp_addextendedproperty 'MS_Description', N'组托时间', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'tray_time' GO

EXEC sp_addextendedproperty 'MS_Description', N'来源单据编码', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'src_table_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'来源单据行号', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'src_line' GO

EXEC sp_addextendedproperty 'MS_Description', N'生产订单编号', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'order_code' GO

EXEC sp_addextendedproperty 'MS_Description', N'生产订单明细号', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'order_line' GO

EXEC sp_addextendedproperty 'MS_Description', N'SAP返回报工确认编号', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'return_id' GO

EXEC sp_addextendedproperty 'MS_Description', N'SAP返回报工确认计数器', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'line_no' GO

EXEC sp_addextendedproperty 'MS_Description', N'备注', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'remark' GO

EXEC sp_addextendedproperty 'MS_Description', N'创建人', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'create_by' GO

EXEC sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'create_time' GO

EXEC sp_addextendedproperty 'MS_Description', N'更新人', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'update_by' GO

EXEC sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'update_time' GO

EXEC sp_addextendedproperty 'MS_Description', N'租户ID', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection', 'COLUMN', N'tenant_id' GO

EXEC sp_addextendedproperty 'MS_Description', N'组托信息表', 'SCHEMA', N'dbo', 'TABLE', N'rf_collection' GO

-- Primary Key structure for table rf_collection

ALTER TABLE [dbo].[rf_collection] ADD CONSTRAINT [PK_rf_collection] PRIMARY KEY CLUSTERED ([id]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO

slievrly commented 7 months ago

ref #6449