Skip to content

Commit 204f01a

Browse files
author
babenko
committed
Revert commit rXXXXXX, YT-18541: Sequoia Response Keeper
commit_hash:8e78a28686a046a10d7766109b2feba4f8ba50da
1 parent af48ba2 commit 204f01a

File tree

3 files changed

+14
-28
lines changed

3 files changed

+14
-28
lines changed

yt/yt/core/rpc/response_keeper.cpp

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "helpers.h"
55
#include "service.h"
66

7+
#include <atomic>
78
#include <yt/yt/core/concurrency/thread_affinity.h>
89
#include <yt/yt/core/concurrency/periodic_executor.h>
910

@@ -240,7 +241,9 @@ class TResponseKeeper
240241

241242
const auto& responseMessage = responseMessageOrError.Value();
242243

243-
auto remember = ValidateHeaderAndParseRememberOption(responseMessage);
244+
NProto::TResponseHeader header;
245+
YT_VERIFY(TryParseResponseHeader(responseMessage, &header));
246+
bool remember = FromProto<NRpc::EErrorCode>(header.error().code()) != NRpc::EErrorCode::Unavailable;
244247

245248
if (auto setResponseKeeperPromise = EndRequest(mutationId, responseMessage, remember)) {
246249
setResponseKeeperPromise();
@@ -310,16 +313,20 @@ class TResponseKeeper
310313

311314
auto pendingIt = PendingResponses_.find(id);
312315
if (pendingIt != PendingResponses_.end()) {
313-
ValidateRetry(id, isRetry);
314-
316+
if (!isRetry) {
317+
THROW_ERROR_EXCEPTION("Duplicate request is not marked as \"retry\"")
318+
<< TErrorAttribute("mutation_id", id);
319+
}
315320
YT_LOG_DEBUG("Replying with pending response (MutationId: %v)", id);
316321
return pendingIt->second;
317322
}
318323

319324
auto finishedIt = FinishedResponses_.find(id);
320325
if (finishedIt != FinishedResponses_.end()) {
321-
ValidateRetry(id, isRetry);
322-
326+
if (!isRetry) {
327+
THROW_ERROR_EXCEPTION("Duplicate request is not marked as \"retry\"")
328+
<< TErrorAttribute("mutation_id", id);
329+
}
323330
YT_LOG_DEBUG("Replying with finished response (MutationId: %v)", id);
324331
return MakeFuture(finishedIt->second);
325332
}
@@ -376,23 +383,6 @@ class TResponseKeeper
376383

377384
////////////////////////////////////////////////////////////////////////////////
378385

379-
bool ValidateHeaderAndParseRememberOption(const TSharedRefArray& responseMessage)
380-
{
381-
NProto::TResponseHeader header;
382-
YT_VERIFY(TryParseResponseHeader(responseMessage, &header));
383-
return FromProto<EErrorCode>(header.error().code()) != EErrorCode::Unavailable;
384-
}
385-
386-
void ValidateRetry(TMutationId mutationId, bool isRetry)
387-
{
388-
if (!isRetry) {
389-
THROW_ERROR_EXCEPTION("Duplicate request is not marked as \"retry\"")
390-
<< TErrorAttribute("mutation_id", mutationId);
391-
}
392-
}
393-
394-
////////////////////////////////////////////////////////////////////////////////
395-
396386
IResponseKeeperPtr CreateResponseKeeper(
397387
TResponseKeeperConfigPtr config,
398388
IInvokerPtr invoker,

yt/yt/core/rpc/response_keeper.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,6 @@ DEFINE_REFCOUNTED_TYPE(IResponseKeeper)
106106

107107
////////////////////////////////////////////////////////////////////////////////
108108

109-
bool ValidateHeaderAndParseRememberOption(const TSharedRefArray& responseMessage);
110-
111-
void ValidateRetry(TMutationId mutationId, bool isRetry);
112-
113-
////////////////////////////////////////////////////////////////////////////////
114-
115109
IResponseKeeperPtr CreateResponseKeeper(
116110
TResponseKeeperConfigPtr config,
117111
IInvokerPtr invoker,

yt/yt/core/rpc/service_detail.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ class TGenericTypedServiceContext
295295
return *Response_;
296296
}
297297

298+
298299
using IServiceContext::Reply;
299300

300301
void Reply()
@@ -314,6 +315,7 @@ class TGenericTypedServiceContext
314315
}
315316
}
316317

318+
317319
const THandlerInvocationOptions& GetOptions() const
318320
{
319321
return Options_;

0 commit comments

Comments
 (0)