XiaoFeiASK opened a new issue, #1169: URL: https://github.com/apache/incubator-seata-go/issues/1169
### ✅ 验证清单 - [x] 🔍 我已经搜索过 [现有 Issues](https://github.com/apache/incubator-seata-go/issues),确信这不是重复问题 - [x] 🛠️ 我愿意自己处理这个议题 ### 🚀 Go 版本 go1.26.4 ### 📦 Seata-go 版本 v2.0.0-rc01 ### 💾 操作系统 🪟 Windows ### 📝 Bug 描述 Several gRPC protobuf messages use an incorrect or missing nested `AbstractMessage.messageType`. This makes the Go client's gRPC wire format inconsistent with the Seata protocol and the Java client implementation. The following issues have been identified: 1. `pkg/rm/remoting/grpc/rm_remoting.go` sets `BranchReportRequestProto` to `TYPE_BRANCH_COMMIT`, but it should use `TYPE_BRANCH_STATUS_REPORT`. 2. `pkg/remoting/grpc/channel_manager.go` does not set the nested `AbstractMessage.messageType` for `RegisterTMRequestProto`. It should use `TYPE_REG_CLT`. 3. `pkg/remoting/processor/client/rm_branch_commit_processor.go` does not set the nested message type for `BranchCommitResponseProto`. It should use `TYPE_BRANCH_COMMIT_RESULT`. 4. `pkg/remoting/processor/client/rm_branch_rollback_processor.go` does not set the nested message type for `BranchRollbackResponseProto`. It should use `TYPE_BRANCH_ROLLBACK_RESULT`. These messages should be aligned with the corresponding Seata Java protocol definitions to ensure cross-language gRPC protocol consistency. ### 🔄 重现步骤 1. Configure seata-go to use the gRPC transport protocol. 2. Call the RM `BranchReport()` method. 3. Intercept the `BranchReportRequestProto` passed to `SendSyncRequest()`. 4. Inspect the following field: ```go req.GetAbstractTransactionRequest(). GetAbstractMessage(). GetMessageType() ``` 5. Observe that the value is `TYPE_BRANCH_COMMIT` instead of `TYPE_BRANCH_STATUS_REPORT`. 6. Inspect the TM registration request and the RM branch commit and rollback responses. 7. Observe that their nested `AbstractMessage.messageType` fields are not set. ### ✅ 预期行为 The gRPC protobuf messages should use message types consistent with the Seata protocol and the Java client: | Message | Expected Message Type | | --- | --- | | `BranchReportRequestProto` | `TYPE_BRANCH_STATUS_REPORT` | | `RegisterTMRequestProto` | `TYPE_REG_CLT` | | `BranchCommitResponseProto` | `TYPE_BRANCH_COMMIT_RESULT` | | `BranchRollbackResponseProto` | `TYPE_BRANCH_ROLLBACK_RESULT` | Regression tests should also verify that these message types are correctly set. ### ❌ 实际行为 The current behavior is: | Message | Current Behavior | | --- | --- | | `BranchReportRequestProto` | Incorrectly uses `TYPE_BRANCH_COMMIT` | | `RegisterTMRequestProto` | Does not set `AbstractMessage.messageType` | | `BranchCommitResponseProto` | Does not set `AbstractMessage.messageType` | | `BranchRollbackResponseProto` | Does not set `AbstractMessage.messageType` | ### 💡 可能的解决方案 1. Change the `BranchReportRequestProto` message type from: ```go pb.MessageTypeProto_TYPE_BRANCH_COMMIT ``` to: ```go pb.MessageTypeProto_TYPE_BRANCH_STATUS_REPORT ``` 2. Set the message type of `RegisterTMRequestProto` to: ```go pb.MessageTypeProto_TYPE_REG_CLT ``` 3. Set the message type of `BranchCommitResponseProto` to: ```go pb.MessageTypeProto_TYPE_BRANCH_COMMIT_RESULT ``` 4. Set the message type of `BranchRollbackResponseProto` to: ```go pb.MessageTypeProto_TYPE_BRANCH_ROLLBACK_RESULT ``` 5. Add regression tests for the affected requests and responses to verify that their message types match the Seata protocol definitions. -- 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]
