Skip to content

Commit afe5f17

Browse files
committed
YQL-19537: QPlayer test
commit_hash:bcd3e54f9aef46d22d4547aecf501bb839b57e9d
1 parent f29f617 commit afe5f17

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

yql/essentials/core/qplayer/storage/interface/yql_qstorage.cpp

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "yql_qstorage.h"
22

3+
#include <util/system/mutex.h>
4+
35
namespace NYql {
46
class TQWriterDecorator : public IQWriter {
57
public:
@@ -8,14 +10,31 @@ class TQWriterDecorator : public IQWriter {
810
if (Closed_) {
911
return NThreading::MakeFuture();
1012
}
11-
return Underlying_->Put(key, value);
13+
try {
14+
return Underlying_->Put(key, value);
15+
} catch (...) {
16+
auto message = CurrentExceptionMessage();
17+
with_lock(Mutex_) {
18+
Exception_ = std::move(message);
19+
}
20+
Close();
21+
return NThreading::MakeFuture();
22+
}
1223
}
1324

1425
NThreading::TFuture<void> Commit() override final {
15-
if (Closed_) {
26+
with_lock(Mutex_) {
27+
if (Exception_) {
28+
throw yexception() << "QWriter exception while Put(): " << *Exception_ << ")";
29+
}
30+
}
31+
bool expected = false;
32+
if (!Closed_.compare_exchange_strong(expected, true)) {
1633
throw yexception() << "QWriter closed";
1734
}
18-
return Underlying_->Commit();
35+
auto result = Underlying_->Commit();
36+
Underlying_ = {};
37+
return result;
1938
}
2039

2140
// Close all used files, doesn't commit anything
@@ -26,8 +45,10 @@ class TQWriterDecorator : public IQWriter {
2645
}
2746
}
2847
private:
48+
TMaybe<TString> Exception_;
2949
IQWriterPtr Underlying_;
3050
std::atomic<bool> Closed_ = false;
51+
TMutex Mutex_;
3152
};
3253

3354
IQWriterPtr MakeCloseAwareWriterDecorator(IQWriterPtr&& rhs) {

yql/essentials/core/type_ann/type_ann_core.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <util/string/cast.h>
3838
#include <util/string/join.h>
3939
#include <util/string/split.h>
40+
#include <util/system/env.h>
4041

4142
#include <algorithm>
4243
#include <functional>
@@ -589,12 +590,15 @@ namespace NTypeAnnImpl {
589590
}
590591

591592
auto failureKind = input->Child(0)->Content();
593+
Y_ABORT_UNLESS(!TryGetEnv("YQL_DETERMINISTIC_MODE") || failureKind != "crash");
592594
if (failureKind == "expr") {
593595
input->SetTypeAnn(ctx.Expr.MakeType<TDataExprType>(NUdf::EDataSlot::String));
594596
} else if (failureKind == "type") {
595597
input->SetTypeAnn(ctx.Expr.MakeType<TDataExprType>(NUdf::EDataSlot::String));
596598
} else if (failureKind == "constraint") {
597599
input->SetTypeAnn(ctx.Expr.MakeType<TListExprType>(ctx.Expr.MakeType<TDataExprType>(NUdf::EDataSlot::String)));
600+
} else if (failureKind == "exception") {
601+
ythrow yexception() << "FailMe exception";
598602
} else {
599603
ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(input->Child(0)->Pos()), TStringBuilder() << "Unknown failure kind: " << failureKind));
600604
return IGraphTransformer::TStatus::Error;

0 commit comments

Comments
 (0)