Skip to content

Commit

Permalink
bugfix: fix oracle insert undolog failed (#5645)
Browse files Browse the repository at this point in the history
Signed-off-by: slievrly <slievrly@163.com>
  • Loading branch information
slievrly authored Jun 14, 2023
1 parent bd18f08 commit 6851eb4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions changes/en-us/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Add changes here for all PR submitted to the develop branch.
- [[#5552](https://github.com/seata/seata/pull/5552)] fix mariadb rollback failed
- [[#5583](https://github.com/seata/seata/pull/5583)] fix grpc interceptor xid unbinding problem
- [[#5602](https://github.com/seata/seata/pull/5602)] fix log in participant transaction role
- [[#5645](https://github.com/seata/seata/pull/5645)] fix oracle insert undolog failed

### optimize:
- [[#5208](https://github.com/seata/seata/pull/5208)] optimize throwable getCause once more
Expand Down
1 change: 1 addition & 0 deletions changes/zh-cn/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- [[#5552](https://github.com/seata/seata/pull/5552)] 修复mariadb回滚失败的问题
- [[#5583](https://github.com/seata/seata/pull/5583)] 修复grpc xid 解绑问题
- [[#5602](https://github.com/seata/seata/pull/5602)] 修复participant情况下的重复日志
- [[#5645](https://github.com/seata/seata/pull/5645)] 修复 oracle 插入 undolog 失败问题

### optimize:
- [[#5208](https://github.com/seata/seata/pull/5208)] 优化多次重复获取Throwable#getCause问题
Expand Down
7 changes: 6 additions & 1 deletion script/client/at/db/oracle.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
-- for AT mode you must to init this sql for you business database. the seata server not need it.
CREATE TABLE undo_log
(
id NUMBER(19) NOT NULL,
branch_id NUMBER(19) NOT NULL,
xid VARCHAR2(128) NOT NULL,
context VARCHAR2(128) NOT NULL,
rollback_info BLOB NOT NULL,
log_status NUMBER(10) NOT NULL,
log_created TIMESTAMP(0) NOT NULL,
log_modified TIMESTAMP(0) NOT NULL,
PRIMARY KEY (id),
CONSTRAINT ux_undo_log UNIQUE (xid, branch_id)
);
CREATE INDEX ix_log_created ON undo_log(log_created);
Expand All @@ -18,4 +20,7 @@ COMMENT ON COLUMN undo_log.context is 'undo_log context,such as serialization';
COMMENT ON COLUMN undo_log.rollback_info is 'rollback info';
COMMENT ON COLUMN undo_log.log_status is '0:normal status,1:defense status';
COMMENT ON COLUMN undo_log.log_created is 'create datetime';
COMMENT ON COLUMN undo_log.log_modified is 'modify datetime';
COMMENT ON COLUMN undo_log.log_modified is 'modify datetime';

-- Generate ID using sequence and trigger
CREATE SEQUENCE UNDO_LOG_SEQ START WITH 1 INCREMENT BY 1;
6 changes: 5 additions & 1 deletion script/client/at/db/postgresql.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
-- for AT mode you must to init this sql for you business database. the seata server not need it.
CREATE TABLE IF NOT EXISTS public.undo_log
(
id SERIAL NOT NULL,
branch_id BIGINT NOT NULL,
xid VARCHAR(128) NOT NULL,
context VARCHAR(128) NOT NULL,
rollback_info BYTEA NOT NULL,
log_status INT NOT NULL,
log_created TIMESTAMP(0) NOT NULL,
log_modified TIMESTAMP(0) NOT NULL,
CONSTRAINT pk_undo_log PRIMARY KEY (id),
CONSTRAINT ux_undo_log UNIQUE (xid, branch_id)
);
CREATE INDEX ix_log_created ON undo_log(log_created);
Expand All @@ -19,4 +21,6 @@ COMMENT ON COLUMN public.undo_log.context IS 'undo_log context,such as serializa
COMMENT ON COLUMN public.undo_log.rollback_info IS 'rollback info';
COMMENT ON COLUMN public.undo_log.log_status IS '0:normal status,1:defense status';
COMMENT ON COLUMN public.undo_log.log_created IS 'create datetime';
COMMENT ON COLUMN public.undo_log.log_modified IS 'modify datetime';
COMMENT ON COLUMN public.undo_log.log_modified IS 'modify datetime';

CREATE SEQUENCE IF NOT EXISTS undo_log_id_seq INCREMENT BY 1 MINVALUE 1 ;

0 comments on commit 6851eb4

Please sign in to comment.