Skip to content

feat(sqled): recognize GaussDB cancel-statement error in workflow terminator (issue #2) - #3310

Merged
BugsGuru merged 3 commits into
mainfrom
sqle/feat-issue-2
May 21, 2026
Merged

BugsGuru merged 3 commits into
mainfrom
sqle/feat-issue-2

Conversation

@actiontech-bot

@actiontech-bot actiontech-bot commented May 21, 2026 •

Copy link
Copy Markdown
Member

User description

Summary

  • Identify GaussDB / openGauss cancel-statement error (canceling statement due to user request) in isConnectionTerminatedError, guarded by dbType == DriverTypeGaussDB to avoid false positives on standard PostgreSQL drivers.
  • Fix (*action).execute so that when the user actively terminates a task and the executor error is recognized as a connection-terminated error, the task status is written as TerminateSucc rather than always falling back to ExecuteFailed.
  • Add 9 new positive / guard-negative cases to Test_isConnectionTerminatedError (total 36) and 11 new cases covering hasTermination state machine and the decideTaskStatusOnExecError truth table; coverage of the modified branch reaches 100%.

Related Issue

Fixes http://10.186.18.21/sqle/sqle-gaussdb-plugin/-/issues/2

Test Plan

  • go vet ./sqle/server/... PASS (golang:1.24.1)
  • go test ./sqle/server/... -count=1 PASS (sqled / auditplan)
  • Companion plugin: sqle-gaussdb-plugin feature/issue-2-kill-process MR
  • Web regression (case-001~007) verified in workspace docs/test

Description

  • 新增 dbType 参数于错误判断

  • 区分不同数据库错误模式

  • 优化任务终止状态更新逻辑

  • 扩展单元测试覆盖多种场景


Diagram Walkthrough

flowchart LR
  A["接收错误信息与dbType"] --> B["判断错误类型"]
  B --> C["返回终止或失败状态"]
Loading

File Walkthrough

Relevant files
Enhancement
sqled.go
更新错误匹配与任务状态处理逻辑                                                                                   

sqle/server/sqled.go

  • 增加 dbType 参数到 isConnectionTerminatedError
  • 根据 dbType 区分各数据库错误
  • 调整任务状态更新处理终止逻辑
+39/-21 
Tests
sqled_terminate_test.go
完善各数据库错误终止测试用例                                                                                     

sqle/server/sqled_terminate_test.go

  • 添加 dbType 参数测试校验
  • 扩展多数据库错误判断测试
  • 增强边界条件测试覆盖
+64/-1   

LordofAvernus and others added 3 commits May 21, 2026 16:26
…ic error messages based on dbType

- Refined the isConnectionTerminatedError function to include dbType checks for MySQL, PostgreSQL, and SQL Server.
- Consolidated error message checks to ensure accurate identification of connection termination errors.
- Removed redundant checks for PostgreSQL "conn closed" and SQL Server "connection is broken" to streamline logic.

This change improves the accuracy of error handling in connection termination scenarios, ensuring that the correct status is set based on the database type.
…tabase types

- Added comprehensive test cases for MySQL, PostgreSQL, GaussDB, and SQL Server to validate connection termination error handling.
- Included scenarios for both valid and invalid dbType matches to ensure accurate error identification.
- Enhanced coverage for edge cases, improving robustness of the error handling logic.
@BugsGuru
BugsGuru force-pushed the sqle/feat-issue-2 branch from 954b64b to 1324d71 Compare May 21, 2026 08:30
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@BugsGuru

Copy link
Copy Markdown
Contributor

@BugsGuru
BugsGuru merged commit 36ad86f into main May 21, 2026
4 checks passed
@BugsGuru
BugsGuru deleted the sqle/feat-issue-2 branch May 21, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants