Skip to content

Commit

Permalink
bugfix: at model execution failed (apache#429)
Browse files Browse the repository at this point in the history
* bugfix: at model execution failed
  • Loading branch information
lxfeng1997 authored and georgehao committed Feb 3, 2023
1 parent 7ab546e commit 2740434
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/datasource/sql/exec/at/delete_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func (d *deleteExecutor) beforeImage(ctx context.Context) (*types.RecordImage, e
}
if ok {
rowsi, err = util.CtxDriverQuery(ctx, queryerCtx, queryer, selectSQL, selectArgs)
defer func() {
if rowsi != nil {
rowsi.Close()
}
}()
if err != nil {
log.Errorf("ctx driver query: %+v", err)
return nil, err
Expand Down
5 changes: 5 additions & 0 deletions pkg/datasource/sql/exec/at/insert_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ func (i *insertExecutor) afterImage(ctx context.Context) (*types.RecordImage, er
}
if ok {
rowsi, err = util.CtxDriverQuery(ctx, queryerCtx, queryer, selectSQL, selectArgs)
defer func() {
if rowsi != nil {
rowsi.Close()
}
}()
if err != nil {
log.Errorf("ctx driver query: %+v", err)
return nil, err
Expand Down
10 changes: 10 additions & 0 deletions pkg/datasource/sql/exec/at/update_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ func (u *updateExecutor) beforeImage(ctx context.Context) (*types.RecordImage, e
}
if ok {
rowsi, err = util.CtxDriverQuery(ctx, queryerCtx, queryer, selectSQL, selectArgs)
defer func() {
if rowsi != nil {
rowsi.Close()
}
}()
if err != nil {
log.Errorf("ctx driver query: %+v", err)
return nil, err
Expand Down Expand Up @@ -153,6 +158,11 @@ func (u *updateExecutor) afterImage(ctx context.Context, beforeImage types.Recor
}
if ok {
rowsi, err = util.CtxDriverQuery(ctx, queryerCtx, queryer, selectSQL, selectArgs)
defer func() {
if rowsi != nil {
rowsi.Close()
}
}()
if err != nil {
log.Errorf("ctx driver query: %+v", err)
return nil, err
Expand Down
15 changes: 15 additions & 0 deletions testdata/sql/undo_log.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
DROP TABLE IF EXISTS `undo_log`;
CREATE TABLE `undo_log`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`branch_id` bigint(20) NOT NULL,
`xid` varchar(100) NOT NULL,
`context` varchar(128) NOT NULL,
`rollback_info` longblob NOT NULL,
`log_status` int(11) NOT NULL,
`log_created` datetime NOT NULL,
`log_modified` datetime NOT NULL,
`ext` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

0 comments on commit 2740434

Please sign in to comment.