From b1b81d6f2dc55d5d4eb1c365c76de290a798db2a Mon Sep 17 00:00:00 2001 From: Nikolay Shestakov Date: Wed, 20 Dec 2023 12:37:23 +0000 Subject: [PATCH] Replace Y_ABORT_UNLESS #2 --- ydb/core/persqueue/partition_read.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ydb/core/persqueue/partition_read.cpp b/ydb/core/persqueue/partition_read.cpp index 12d78771538c..7173ebbf2ae2 100644 --- a/ydb/core/persqueue/partition_read.cpp +++ b/ydb/core/persqueue/partition_read.cpp @@ -709,7 +709,8 @@ void TPartition::DoRead(TEvPQ::TEvRead::TPtr ev, TDuration waitQuotaTime, const const TString& user = read->ClientId; auto userInfo = UsersInfoStorage->GetIfExists(user); if(!userInfo) { - ReplyError(ctx, read->Cookie, NPersQueue::NErrorCode::BAD_REQUEST, TStringBuilder() << "cannot finish read request. Consumer " << read->ClientId << " is gone from partition"); + ReplyError(ctx, read->Cookie, NPersQueue::NErrorCode::BAD_REQUEST, + TStringBuilder() << "cannot finish read request. Consumer " << read->ClientId << " is gone from partition"); Send(ReadQuotaTrackerActor, new TEvPQ::TEvConsumerRemoved(user)); OnReadRequestFinished(read->Cookie, 0, user, ctx); return; @@ -757,7 +758,11 @@ void TPartition::DoRead(TEvPQ::TEvRead::TPtr ev, TDuration waitQuotaTime, const return; } - Y_ABORT_UNLESS(offset < EndOffset); + if (offset > EndOffset) { + ReplyError(ctx, read->Cookie, NPersQueue::NErrorCode::BAD_REQUEST, + TStringBuilder() << "Offset more than EndOffset. Offset=" << offset << ", EndOffset=" << EndOffset); + return; + } ProcessRead(ctx, std::move(info), cookie, false); }