Skip to content

Commit 96dfeb9

Browse files
Better spilling errors (#8812)
1 parent 79a6b7a commit 96dfeb9

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

ydb/core/kqp/ut/spilling/kqp_scan_spilling_ut.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ Y_UNIT_TEST(HandleErrorsCorrectly) {
135135
Cerr << planres.GetStats()->GetAst() << Endl;
136136

137137
auto result = db.ExecuteQuery(SimpleGraceJoinWithSpillingQuery, NYdb::NQuery::TTxControl::BeginTx().CommitTx(), NYdb::NQuery::TExecuteQuerySettings()).ExtractValueSync();
138-
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::INTERNAL_ERROR, result.GetIssues().ToString());
138+
const auto errorMsg = result.GetIssues().ToString();
139+
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::INTERNAL_ERROR, errorMsg);
140+
141+
const auto spillingPrefix = "[Compute spilling]";
142+
const auto pos = errorMsg.find(spillingPrefix);
143+
UNIT_ASSERT_VALUES_UNEQUAL_C(pos, std::string::npos, "Spilling prefix not found in error message");
139144
}
140145

141146
Y_UNIT_TEST(SelfJoinQueryService) {

ydb/library/yql/dq/actors/spilling/channel_storage_actor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class TDqChannelStorageActor : public IDqChannelStorageActor,
8282
if (!ErrorCallback_) Y_ABORT("Error: %s", error.c_str());
8383

8484
LOG_E("Error: " << error);
85-
ErrorCallback_(error);
85+
ErrorCallback_(TStringBuilder() << "[Channel spilling]" << error);
8686
SendInternal(SpillingActorId_, new TEvents::TEvPoison);
8787
PassAway();
8888
}

ydb/library/yql/dq/actors/spilling/compute_storage_actor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class TDqComputeStorageActor : public NActors::TActorBootstrapped<TDqComputeStor
7676
if (!ErrorCallback_) Y_ABORT("Error: %s", error.c_str());
7777

7878
LOG_E("Error: " << error);
79-
ErrorCallback_(error);
79+
ErrorCallback_(TStringBuilder() << "[Compute spilling]" << error);
8080
SendInternal(SpillingActorId_, new TEvents::TEvPoison);
8181
PassAway();
8282
}

ydb/library/yql/dq/actors/spilling/spilling_file.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "spilling.h"
22
#include "spilling_file.h"
33

4+
#include <format>
45
#include <ydb/library/services/services.pb.h>
56
#include <ydb/library/yql/utils/yql_panic.h>
67

@@ -406,7 +407,10 @@ class TDqLocalFileSpillingService : public TActorBootstrapped<TDqLocalFileSpilli
406407
LOG_E("[Write] File size limit exceeded. "
407408
<< "From: " << ev->Sender << ", blobId: " << msg.BlobId << ", bytes: " << msg.Blob.size());
408409

409-
Send(ev->Sender, new TEvDqSpilling::TEvError("File size limit exceeded"));
410+
const auto usedMb = (fd.TotalSize + msg.Blob.size()) / 1024 / 1024;
411+
const auto limitMb = Config_.MaxFileSize / 1024 / 1024;
412+
413+
Send(ev->Sender, new TEvDqSpilling::TEvError(std::format("File size limit exceeded: {}/{}Mb", usedMb, limitMb)));
410414

411415
Counters_->SpillingTooBigFileErrors->Inc();
412416
return;
@@ -416,7 +420,9 @@ class TDqLocalFileSpillingService : public TActorBootstrapped<TDqLocalFileSpilli
416420
LOG_E("[Write] Total size limit exceeded. "
417421
<< "From: " << ev->Sender << ", blobId: " << msg.BlobId << ", bytes: " << msg.Blob.size());
418422

419-
Send(ev->Sender, new TEvDqSpilling::TEvError("Total size limit exceeded"));
423+
const auto usedMb = (TotalSize_ + msg.Blob.size()) / 1024 / 1024;
424+
const auto limitMb = Config_.MaxTotalSize / 1024 / 1024;
425+
Send(ev->Sender, new TEvDqSpilling::TEvError(std::format("Total size limit exceeded: {}/{}Mb", usedMb, limitMb)));
420426

421427
Counters_->SpillingNoSpaceErrors->Inc();
422428
return;

ydb/library/yql/dq/actors/spilling/spilling_file_ut.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ Y_UNIT_TEST_SUITE(DqSpillingFileTests) {
270270
runtime.Send(new IEventHandle(spillingActor, tester, ev));
271271

272272
auto resp = runtime.GrabEdgeEvent<TEvDqSpilling::TEvError>(tester);
273-
UNIT_ASSERT_STRINGS_EQUAL("Total size limit exceeded", resp->Get()->Message);
273+
UNIT_ASSERT_STRINGS_EQUAL("Total size limit exceeded: 0/0Mb", resp->Get()->Message);
274274
}
275275
}
276276

@@ -297,7 +297,7 @@ Y_UNIT_TEST_SUITE(DqSpillingFileTests) {
297297
runtime.Send(new IEventHandle(spillingActor, tester, ev));
298298

299299
auto resp = runtime.GrabEdgeEvent<TEvDqSpilling::TEvError>(tester);
300-
UNIT_ASSERT_STRINGS_EQUAL("File size limit exceeded", resp->Get()->Message);
300+
UNIT_ASSERT_STRINGS_EQUAL("File size limit exceeded: 0/0Mb", resp->Get()->Message);
301301
}
302302
}
303303

0 commit comments

Comments
 (0)