CAICAIIs opened a new issue, #1060:
URL: https://github.com/apache/incubator-seata-go/issues/1060

   ### ✅ 验证清单
   
   - [x] 🔍 我已经搜索过 [现有 
Issues](https://github.com/apache/incubator-seata-go/issues),确信这不是重复问题
   - [x] 🛠️ 我愿意自己处理这个议题
   
   ### 🚀 Go 版本
   
   1.23
   
   ### 📦 Seata-go 版本
   
   v1.2.0
   
   ### 💾 操作系统
   
   🍎 macOS
   
   ### 📝 Bug 描述
   
   经过代码审查,发现seata-go项目中存在大量标记为 `panic("implement me")` 或空实现的核心功能,严重影响生产环境可用性:
   ---
   
   ### 1. TCC资源管理器核心方法
   **影响**: TCC模式无法查询锁或清理资源,会导致资源泄漏和死锁。
   
   **文件**: `pkg/rm/tcc/tcc_resource.go`
   - 第108行: `LockQuery(ctx, param)` - 无法检查分支事务锁
   - 第113行: `UnregisterResource(resource)` - 关闭时无法释放资源
   
   **状态**: 两个都是 `panic("implement me")`  
   **建议**: 对TCC模式用户至关重要(支付/订单系统常见)
   
   ---
   
   ### 2. AT模式数据库层
   **影响**: AT模式(最流行的模式)的资源管理不完整。
   
   **文件**:
   - `pkg/datasource/sql/db.go` 第124行: `GetResourceGroupId()` - 资源分组功能损坏
   - `pkg/datasource/sql/undo/base/undo.go` 第419行: `DBType()` - 数据库类型检测失败
   
   **状态**: 都是 `panic("implement me")`  
   **建议**: 在推广AT模式为生产就绪之前修复
   
   ---
   
   ### 3. XA模式实现缺失
   **影响**: XA模式部分损坏 - 提交操作不执行。
   
   **文件**:
   - `pkg/datasource/sql/tx_xa.go` 第44-45行: `commitOnXA()` - 空实现(返回nil)
   - `pkg/datasource/sql/xa_resource_manager.go` 第199-200行: `LockQuery()` - 
不检查直接返回false
   
   ---
   
   ### 4. SAGA模式限制
   **影响**: SAGA无法查询锁或注销资源。
   
   **文件**: `pkg/saga/statemachine/engine/rm/saga_resource_manager.go`
   - 第147行: `LockQuery()` - 返回错误 "not supported"
   - 第151行: `UnregisterResource()` - 返回错误 "not supported"
   
   **状态**: 有意不支持(返回错误,不是panic)  
   **建议**: 与Seata-Java确认SAGA是否应该支持这些。如果是,则实现;如果否,则明确文档说明。
   
   ---
   
   ### 5. 协议/编解码缺失
   **影响**: 替代序列化格式和压缩不可用。
   
   **文件**:
   - `pkg/protocol/codec/codec.go` 第33-37行: Protobuf/KRYO/FST编解码类型已声明但未实现
   - `pkg/compressor/7z_compress.go`: 空文件(只有许可证头)
   - 缺失编解码器: `MergedWarpMessage`(批处理操作), `UndoLogDeleteRequest`
   
   **建议**:
   - 从压缩器注册表中移除7z或实现它
   - 文档说明Protobuf/KRYO/FST不支持,或者实现它们
   
   ---
   
   ### 6. 多数据库支持
   **影响**: 只完全支持MySQL。Oracle、PostgreSQL、SQL Server、MariaDB不完整。
   
   **文件**:
   - `pkg/datasource/sql/exec/at/escape.go` 第161行: TODO Oracle/PG/SQLServer转义
   - `pkg/datasource/sql/undo/executor/sql.go` 第161行: TODO Oracle/PG/SQLServer转义
   - `pkg/datasource/sql/undo/factor/undo_executor_holder_factor.go` 第37行: TODO 
Oracle/MariaDB/PostgreSQL undo执行器
   
   **状态**: 仅MySQL实现  
   **建议**: 根据用户数据库分布优先级排序
   
   ---
   
   ### 7. SAGA表达式引擎
   **影响**: 无法在CEL表达式中设置值(可能不需要)。
   
   **文件**: `pkg/saga/statemachine/engine/expr/cel_expression.go` 第90行: 
`SetValue()`  
   **状态**: `panic("implement me")` 但注释提示"可能不需要"  
   **建议**: 与Seata-Java实现确认。如果未使用,则移除;如果需要,则实现。
   
   ---
   
   ### 8. TCC Fence优化
   **影响**: TCC fence日志清理的性能优化。
   
   **文件**: `pkg/rm/tcc/fence/handler/tcc_fence_wrapper_handler.go` 第243-250行: 
从日志缓存批量删除  
   **状态**: TODO注释  
   **建议**: 在核心TCC功能稳定后实现
   
   ---
   
   ### 9. 事务传播模式
   **影响**: 某些传播模式不支持。
   
   **文件**: `pkg/tm/transaction_executor.go` 第160行: 对不支持的传播类型返回错误  
   **状态**: 部分实现(Required/RequiresNew/Supports/NotSupported/Never/Mandatory 可用)  
   **建议**: 文档说明支持哪些模式
   
   ---
   
   ### 10. AT模式多语句SQL限制
   **影响**: 使用LIMIT或ORDER BY的多表UPDATE/DELETE会直接报错返回失败,AT模式在复杂SQL场景下不可用。
   
   **文件**:
   - `pkg/datasource/sql/exec/at/multi_update_excutor.go` 第249行(LIMIT), 
第252行(ORDER BY)
   - `pkg/datasource/sql/exec/at/multi_delete_executor.go` 第160行(LIMIT), 
第163行(ORDER BY)
   - `pkg/datasource/sql/undo/builder/mysql_multi_update_undo_log_builder.go` 
第161行(LIMIT), 第164行(ORDER BY)
   - 
`pkg/datasource/sql/undo/builder/postgresql_multi_update_undo_log_builder.go` 
第161行(LIMIT), 第164行(ORDER BY)
   
   **状态**: 显式返回错误,非panic - 生产路径会触发用户可见的业务失败
   
   ---
   
   ### 11. 测试Mock实现
   **影响**: 仅测试基础设施 - 不影响生产。
   
   **文件**: 各种 `*_test.go` 文件中的mock Rows 接口桩  
   **状态**: 测试mock中 `panic("implement me")`  
   **建议**: 为测试稳定性修复,但不阻塞生产使用
   
   ---
   
   ### 12. SAGA仓库TODO
   **影响**: 轻微 - 字符集和JSON解析器配置。
   
   **文件**: 
`pkg/saga/statemachine/engine/repo/repository/state_machine_repository.go` 
第58-59行  
   **状态**: TODO注释  
   **建议**: 除非报告特定的字符集问题,否则低优先级
   
   
   ### 🔄 重现步骤
   
   1
   
   ### ✅ 预期行为
   
   1
   
   ### ❌ 实际行为
   
   1
   
   ### 💡 可能的解决方案
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to