From 6db1c923bb79e619a95b48db3d1d13a0b635ab56 Mon Sep 17 00:00:00 2001 From: Grigoriy Pisarenko Date: Mon, 3 Jun 2024 07:14:11 +0000 Subject: [PATCH] Added fallback to old behaviour --- ydb/core/fq/libs/compute/ydb/result_writer_actor.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ydb/core/fq/libs/compute/ydb/result_writer_actor.cpp b/ydb/core/fq/libs/compute/ydb/result_writer_actor.cpp index d1e4eda46d52..cae7e6b57f65 100644 --- a/ydb/core/fq/libs/compute/ydb/result_writer_actor.cpp +++ b/ydb/core/fq/libs/compute/ydb/result_writer_actor.cpp @@ -96,6 +96,13 @@ class TResultSetWriterActor : public TBaseComputeActor { void Handle(const TEvYdbCompute::TEvFetchScriptResultResponse::TPtr& ev) { const auto& response = *ev.Get()->Get(); + if (response.Status == NYdb::EStatus::BAD_REQUEST && FetchRowsLimit == 0) { + LOG_W("ResultSetId: " << ResultSetId << " Got bad request: " << ev->Get()->Issues.ToOneLineString() << ", try to fallback to old behaviour"); + FetchRowsLimit = 1000; + SendFetchScriptResultRequest(); + return; + } + if (response.Status != NYdb::EStatus::SUCCESS) { LOG_E("ResultSetId: " << ResultSetId << " Can't fetch script result: " << ev->Get()->Issues.ToOneLineString()); Send(Parent, new TEvYdbCompute::TEvResultSetWriterResponse(ResultSetId, ev->Get()->Issues, NYdb::EStatus::INTERNAL_ERROR)); @@ -190,7 +197,7 @@ class TResultSetWriterActor : public TBaseComputeActor { void SendFetchScriptResultRequest() { LastProcessedToken = FetchToken; - Register(new TRetryActor(Counters.GetCounters(ERequestType::RT_FETCH_SCRIPT_RESULT), SelfId(), Connector, OperationId, ResultSetId, FetchToken, 0)); + Register(new TRetryActor(Counters.GetCounters(ERequestType::RT_FETCH_SCRIPT_RESULT), SelfId(), Connector, OperationId, ResultSetId, FetchToken, FetchRowsLimit)); } void SendReplyAndPassAway() { @@ -222,6 +229,7 @@ class TResultSetWriterActor : public TBaseComputeActor { bool Truncated = false; TString FetchToken; TString LastProcessedToken; + ui64 FetchRowsLimit = 0; const size_t ProtoMessageLimit = 10_MB; const size_t MaxRowsCountPerChunk = 100'000; const size_t BaseProtoByteSize = CreateProtoRequestWithoutResultSet(0).ByteSizeLong();