Skip to content

Commit

Permalink
bugfix: fix mysql insert use select last insert id is undo_log id val…
Browse files Browse the repository at this point in the history
…ue (apache#2659)
  • Loading branch information
jsbxyyx authored May 7, 2020
1 parent 196caae commit 9463b2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class MySQLUndoLogManager extends AbstractUndoLogManager {
+ ClientTableColumnsName.UNDO_LOG_CONTEXT + ", " + ClientTableColumnsName.UNDO_LOG_ROLLBACK_INFO + ", "
+ ClientTableColumnsName.UNDO_LOG_LOG_STATUS + ", " + ClientTableColumnsName.UNDO_LOG_LOG_CREATED + ", "
+ ClientTableColumnsName.UNDO_LOG_LOG_MODIFIED + ")" +
" VALUES (?, ?, ?, ?, ?, now(), now())";
" VALUES (?, ?, ?, ?, ?, now(6), now(6))";

private static final String DELETE_UNDO_LOG_BY_CREATE_SQL = "DELETE FROM " + UNDO_LOG_TABLE_NAME +
" WHERE log_created <= ? LIMIT ?";
Expand Down
8 changes: 3 additions & 5 deletions script/client/at/db/mysql.sql
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
-- for AT mode you must to init this sql for you business database. the seata server not need it.
CREATE TABLE IF NOT EXISTS `undo_log`
(
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'increment id',
`branch_id` BIGINT(20) NOT NULL COMMENT 'branch transaction id',
`xid` VARCHAR(100) NOT NULL COMMENT 'global transaction id',
`context` VARCHAR(128) NOT NULL COMMENT 'undo_log context,such as serialization',
`rollback_info` LONGBLOB NOT NULL COMMENT 'rollback info',
`log_status` INT(11) NOT NULL COMMENT '0:normal status,1:defense status',
`log_created` DATETIME NOT NULL COMMENT 'create datetime',
`log_modified` DATETIME NOT NULL COMMENT 'modify datetime',
PRIMARY KEY (`id`),
`log_created` DATETIME(6) NOT NULL COMMENT 'create datetime',
`log_modified` DATETIME(6) NOT NULL COMMENT 'modify datetime',
UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8 COMMENT ='AT transaction mode undo table';
DEFAULT CHARSET = utf8 COMMENT ='AT transaction mode undo table';

0 comments on commit 9463b2b

Please sign in to comment.