File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed
qplayer/storage/interface Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 11#include " yql_qstorage.h"
22
3+ #include < util/system/mutex.h>
4+
35namespace NYql {
46class 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 }
2847private:
48+ TMaybe<TString> Exception_;
2949 IQWriterPtr Underlying_;
3050 std::atomic<bool > Closed_ = false ;
51+ TMutex Mutex_;
3152};
3253
3354IQWriterPtr MakeCloseAwareWriterDecorator (IQWriterPtr&& rhs) {
Original file line number Diff line number Diff line change 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;
You can’t perform that action at this time.
0 commit comments