Skip to content

Commit

Permalink
Merge pull request #2437 from actiontech/issue1562-1
Browse files Browse the repository at this point in the history
fix: check the last batch
  • Loading branch information
ColdWaterLW authored May 30, 2024
2 parents a43b268 + 4706a39 commit f66cb1c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions sqle/server/sqled.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,8 @@ func (a *action) executeSqlsGroupByBatchId(sqls []*model.ExecuteSQL) error {
if err := a.executeSQLBatch(sqlBatch); err != nil {
return err
}
for _, sqlInBatch := range sqlBatch {
if sqlInBatch.ExecStatus == model.SQLExecuteStatusFailed {
// 一旦出现执行失败的SQL,则不再执行其他未执行的SQL
return ErrExecuteFileFailed
}
if err := checkBatchExecuteStatus(sqlBatch); err != nil {
return err
}
// clear sql batch
sqlBatch = make([]*model.ExecuteSQL, 0)
Expand All @@ -589,6 +586,19 @@ func (a *action) executeSqlsGroupByBatchId(sqls []*model.ExecuteSQL) error {
if err := a.executeSQLBatch(sqlBatch); err != nil {
return err
}
if err := checkBatchExecuteStatus(sqlBatch); err != nil {
return err
}
}

}
return nil
}

func checkBatchExecuteStatus(sqlBatch []*model.ExecuteSQL) error {
for _, sql := range sqlBatch {
if sql.ExecStatus == model.SQLExecuteStatusFailed {
return ErrExecuteFileFailed
}
}
return nil
Expand Down

0 comments on commit f66cb1c

Please sign in to comment.