From 510e56b272f712b29cdc438f49472fc0ea8a31b6 Mon Sep 17 00:00:00 2001 From: Wenyi Hu Date: Sun, 18 Aug 2024 01:54:17 -0400 Subject: [PATCH] kvserver/rangefeed: add newRetryErrBufferCapacityExceeded This patch refactors the error for kvpb.RangeFeedRetryError_REASON_SLOW_CONSUMER into newRetryErrBufferCapacityExceeded. Epic: none Release note: none --- pkg/kv/kvserver/rangefeed/processor.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/kv/kvserver/rangefeed/processor.go b/pkg/kv/kvserver/rangefeed/processor.go index 55e0413e9f09..1778366c57f7 100644 --- a/pkg/kv/kvserver/rangefeed/processor.go +++ b/pkg/kv/kvserver/rangefeed/processor.go @@ -58,13 +58,15 @@ var ( ) ) +func newRetryErrBufferCapacityExceeded() error { + return kvpb.NewRangeFeedRetryError(kvpb.RangeFeedRetryError_REASON_SLOW_CONSUMER) +} + // newErrBufferCapacityExceeded creates an error that is returned to subscribers // if the rangefeed processor is not able to keep up with the flow of incoming // events and is forced to drop events in order to not block. func newErrBufferCapacityExceeded() *kvpb.Error { - return kvpb.NewError( - kvpb.NewRangeFeedRetryError(kvpb.RangeFeedRetryError_REASON_SLOW_CONSUMER), - ) + return kvpb.NewError(newRetryErrBufferCapacityExceeded()) } // Config encompasses the configuration required to create a Processor.