From 8f0e57a8ac031a9a4d14167e0dba9da7d52dd0c2 Mon Sep 17 00:00:00 2001 From: catcherwong Date: Fri, 26 Aug 2022 08:31:09 +0800 Subject: [PATCH] support RetryLimit for saga grpc --- client/dtmgrpc/dtmgimp/utils.go | 1 + client/dtmgrpc/dtmgpb/dtmgimp.pb.go | 18 ++++++++++++++---- client/dtmgrpc/dtmgpb/dtmgimp.proto | 1 + dtmsvr/trans_class.go | 1 + 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/client/dtmgrpc/dtmgimp/utils.go b/client/dtmgrpc/dtmgimp/utils.go index 8c7c0b2..ac8f0a1 100644 --- a/client/dtmgrpc/dtmgimp/utils.go +++ b/client/dtmgrpc/dtmgimp/utils.go @@ -41,6 +41,7 @@ func GetDtmRequest(s *dtmimp.TransBase) *dtmgpb.DtmRequest { RetryInterval: s.RetryInterval, BranchHeaders: s.BranchHeaders, RequestTimeout: s.RequestTimeout, + RetryLimit: s.RetryLimit, }, QueryPrepared: s.QueryPrepared, CustomedData: s.CustomData, diff --git a/client/dtmgrpc/dtmgpb/dtmgimp.pb.go b/client/dtmgrpc/dtmgpb/dtmgimp.pb.go index b296da2..8f489c2 100644 --- a/client/dtmgrpc/dtmgpb/dtmgimp.pb.go +++ b/client/dtmgrpc/dtmgpb/dtmgimp.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 -// protoc v3.17.3 +// protoc-gen-go v1.28.1 +// protoc v3.21.5 // source: client/dtmgrpc/dtmgpb/dtmgimp.proto package dtmgpb @@ -32,6 +32,7 @@ type DtmTransOptions struct { // repeated string PassthroughHeaders = 4; // depreceated BranchHeaders map[string]string `protobuf:"bytes,5,rep,name=BranchHeaders,proto3" json:"BranchHeaders,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` RequestTimeout int64 `protobuf:"varint,6,opt,name=RequestTimeout,proto3" json:"RequestTimeout,omitempty"` + RetryLimit int64 `protobuf:"varint,7,opt,name=RetryLimit,proto3" json:"RetryLimit,omitempty"` } func (x *DtmTransOptions) Reset() { @@ -101,6 +102,13 @@ func (x *DtmTransOptions) GetRequestTimeout() int64 { return 0 } +func (x *DtmTransOptions) GetRetryLimit() int64 { + if x != nil { + return x.RetryLimit + } + return 0 +} + // DtmRequest request sent to dtm server type DtmRequest struct { state protoimpl.MessageState @@ -551,7 +559,7 @@ var file_client_dtmgrpc_dtmgpb_dtmgimp_proto_rawDesc = []byte{ 0x2f, 0x64, 0x74, 0x6d, 0x67, 0x70, 0x62, 0x2f, 0x64, 0x74, 0x6d, 0x67, 0x69, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x64, 0x74, 0x6d, 0x67, 0x69, 0x6d, 0x70, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xba, 0x02, 0x0a, 0x0f, + 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, 0x02, 0x0a, 0x0f, 0x44, 0x74, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x57, 0x61, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x57, 0x61, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, @@ -567,7 +575,9 @@ var file_client_dtmgrpc_dtmgpb_dtmgimp_proto_rawDesc = []byte{ 0x0d, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, - 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x1a, 0x40, 0x0a, 0x12, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, + 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x74, 0x72, 0x79, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x52, 0x65, 0x74, 0x72, + 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x1a, 0x40, 0x0a, 0x12, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, diff --git a/client/dtmgrpc/dtmgpb/dtmgimp.proto b/client/dtmgrpc/dtmgpb/dtmgimp.proto index 7eaa369..9842fe7 100644 --- a/client/dtmgrpc/dtmgpb/dtmgimp.proto +++ b/client/dtmgrpc/dtmgpb/dtmgimp.proto @@ -22,6 +22,7 @@ message DtmTransOptions { // repeated string PassthroughHeaders = 4; // depreceated map BranchHeaders = 5; int64 RequestTimeout = 6; + int64 RetryLimit = 7; } // DtmRequest request sent to dtm server diff --git a/dtmsvr/trans_class.go b/dtmsvr/trans_class.go index 096e5c3..a311879 100644 --- a/dtmsvr/trans_class.go +++ b/dtmsvr/trans_class.go @@ -99,6 +99,7 @@ func TransFromDtmRequest(ctx context.Context, c *dtmgpb.DtmRequest) *TransGlobal RetryInterval: o.RetryInterval, BranchHeaders: o.BranchHeaders, RequestTimeout: o.RequestTimeout, + RetryLimit: o.RetryLimit, }, }} r.ReqExtra = c.ReqExtra