diff --git a/cdc/kv/shared_client.go b/cdc/kv/shared_client.go index 30a25b5ae48..186c000df85 100644 --- a/cdc/kv/shared_client.go +++ b/cdc/kv/shared_client.go @@ -87,6 +87,7 @@ var ( metricFeedRPCCtxUnavailable = eventFeedErrorCounter.WithLabelValues("RPCCtxUnavailable") metricStoreSendRequestErr = eventFeedErrorCounter.WithLabelValues("SendRequestToStore") metricKvIsBusyCounter = eventFeedErrorCounter.WithLabelValues("KvIsBusy") + metricKvCongestedCounter = eventFeedErrorCounter.WithLabelValues("KvCongested") ) type eventError struct { @@ -693,6 +694,11 @@ func (s *SharedClient) doHandleError(ctx context.Context, errInfo regionErrorInf s.scheduleRangeRequest(ctx, errInfo.span, errInfo.subscribedTable) return nil } + if innerErr.GetCongested() != nil { + metricKvCongestedCounter.Inc() + s.scheduleRegionRequest(ctx, errInfo.regionInfo) + return nil + } if innerErr.GetServerIsBusy() != nil { metricKvIsBusyCounter.Inc() s.scheduleRegionRequest(ctx, errInfo.regionInfo) @@ -700,7 +706,7 @@ func (s *SharedClient) doHandleError(ctx context.Context, errInfo regionErrorInf } if duplicated := innerErr.GetDuplicateRequest(); duplicated != nil { metricFeedDuplicateRequestCounter.Inc() - // TODO(qupeng): It's better to add a new machanism to deregister one region. + // TODO(qupeng): It's better to add a new mechanism to deregister one region. return errors.New("duplicate request") } if compatibility := innerErr.GetCompatibility(); compatibility != nil { diff --git a/go.mod b/go.mod index 3757a1ef1dd..ce849e2aa63 100644 --- a/go.mod +++ b/go.mod @@ -67,7 +67,7 @@ require ( github.com/pingcap/check v0.0.0-20211026125417-57bd13f7b5f0 github.com/pingcap/errors v0.11.5-0.20240318064555-6bd07397691f github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 - github.com/pingcap/kvproto v0.0.0-20240620063548-118a4cab53e4 + github.com/pingcap/kvproto v0.0.0-20240911085438-1a933d30690a github.com/pingcap/log v1.1.1-0.20240314023424-862ccc32f18d github.com/pingcap/tidb v1.1.0-beta.0.20240722024203-504960d51b2a github.com/pingcap/tidb-dashboard v0.0.0-20240326110213-9768844ff5d7 diff --git a/go.sum b/go.sum index dd74ef9a83f..2ebe53e4f1c 100644 --- a/go.sum +++ b/go.sum @@ -892,8 +892,8 @@ github.com/pingcap/fn v1.0.0/go.mod h1:u9WZ1ZiOD1RpNhcI42RucFh/lBuzTu6rw88a+oF2Z github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989 h1:surzm05a8C9dN8dIUmo4Be2+pMRb6f55i+UIYrluu2E= github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989/go.mod h1:O17XtbryoCJhkKGbT62+L2OlrniwqiGLSqrmdHCMzZw= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= -github.com/pingcap/kvproto v0.0.0-20240620063548-118a4cab53e4 h1:6aIKNB2YGAec4IUDLw6G2eDECiGiufZcgEbZSCELBx0= -github.com/pingcap/kvproto v0.0.0-20240620063548-118a4cab53e4/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= +github.com/pingcap/kvproto v0.0.0-20240911085438-1a933d30690a h1:idCAlcvP0yfaUsoY56HYstzoYDBLRmjMop78yz+WjXM= +github.com/pingcap/kvproto v0.0.0-20240911085438-1a933d30690a/go.mod h1:rXxWk2UnwfUhLXha1jxRWPADw9eMZGWEWCg92Tgmb/8= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= github.com/pingcap/log v1.1.0/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=