aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspuchin <spuchin@ydb.tech>2022-08-25 15:52:01 +0300
committerspuchin <spuchin@ydb.tech>2022-08-25 15:52:01 +0300
commita9cf4253d01d3c7ef62eeb9e798db23942ef1bcd (patch)
treea138bbdd9398990bba4c7f25108f8a148b5d0da9
parent0166916e98024b223fae6894817f4d8dc0a8a5a6 (diff)
downloadydb-a9cf4253d01d3c7ef62eeb9e798db23942ef1bcd.tar.gz
Fix status/issues on lost event. ()
-rw-r--r--contrib/restricted/boost/boost/spirit/home/qi/action/action.hpp1
-rw-r--r--contrib/restricted/boost/boost/spirit/home/qi/detail/fail_function.hpp1
-rw-r--r--contrib/restricted/boost/boost/spirit/home/qi/detail/pass_container.hpp1
-rw-r--r--contrib/restricted/boost/boost/spirit/home/qi/string/lit.hpp1
-rw-r--r--contrib/restricted/boost/phoenix/include/boost/phoenix/core/actor.hpp3
-rw-r--r--ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp34
-rw-r--r--ydb/core/kqp/executer/kqp_data_executer.cpp4
-rw-r--r--ydb/core/kqp/kqp_session_actor.cpp24
-rw-r--r--ydb/core/sys_view/ut_kqp.cpp2
-rw-r--r--ydb/library/yql/dq/actors/dq.cpp6
-rw-r--r--ydb/library/yql/dq/actors/protos/dq_status_codes.proto1
-rw-r--r--ydb/services/ydb/ydb_ut.cpp2
12 files changed, 49 insertions, 31 deletions
diff --git a/contrib/restricted/boost/boost/spirit/home/qi/action/action.hpp b/contrib/restricted/boost/boost/spirit/home/qi/action/action.hpp
index dbaa3f7727..31b279909b 100644
--- a/contrib/restricted/boost/boost/spirit/home/qi/action/action.hpp
+++ b/contrib/restricted/boost/boost/spirit/home/qi/action/action.hpp
@@ -146,6 +146,7 @@ namespace boost { namespace spirit { namespace qi
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(action& operator= (action const&));
+ action(const action&) = default;
};
}}}
diff --git a/contrib/restricted/boost/boost/spirit/home/qi/detail/fail_function.hpp b/contrib/restricted/boost/boost/spirit/home/qi/detail/fail_function.hpp
index 45972a4b5d..9d0e9a7c17 100644
--- a/contrib/restricted/boost/boost/spirit/home/qi/detail/fail_function.hpp
+++ b/contrib/restricted/boost/boost/spirit/home/qi/detail/fail_function.hpp
@@ -52,6 +52,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(fail_function& operator= (fail_function const&));
+ fail_function(const fail_function&) = default;
};
}}}}
diff --git a/contrib/restricted/boost/boost/spirit/home/qi/detail/pass_container.hpp b/contrib/restricted/boost/boost/spirit/home/qi/detail/pass_container.hpp
index 97e2906e2c..777dc8985b 100644
--- a/contrib/restricted/boost/boost/spirit/home/qi/detail/pass_container.hpp
+++ b/contrib/restricted/boost/boost/spirit/home/qi/detail/pass_container.hpp
@@ -356,6 +356,7 @@ namespace boost { namespace spirit { namespace qi { namespace detail
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(pass_container& operator= (pass_container const&));
+ pass_container(const pass_container&) = default;
};
///////////////////////////////////////////////////////////////////////////
diff --git a/contrib/restricted/boost/boost/spirit/home/qi/string/lit.hpp b/contrib/restricted/boost/boost/spirit/home/qi/string/lit.hpp
index 2e423c28c8..dedc0d8bb9 100644
--- a/contrib/restricted/boost/boost/spirit/home/qi/string/lit.hpp
+++ b/contrib/restricted/boost/boost/spirit/home/qi/string/lit.hpp
@@ -120,6 +120,7 @@ namespace boost { namespace spirit { namespace qi
// silence MSVC warning C4512: assignment operator could not be generated
BOOST_DELETED_FUNCTION(literal_string& operator= (literal_string const&));
+ literal_string(const literal_string&) = default;
};
template <typename String, bool no_attribute>
diff --git a/contrib/restricted/boost/phoenix/include/boost/phoenix/core/actor.hpp b/contrib/restricted/boost/phoenix/include/boost/phoenix/core/actor.hpp
index 8b42a988fc..e4a7acc842 100644
--- a/contrib/restricted/boost/phoenix/include/boost/phoenix/core/actor.hpp
+++ b/contrib/restricted/boost/phoenix/include/boost/phoenix/core/actor.hpp
@@ -226,6 +226,9 @@ namespace boost { namespace phoenix
#endif
BOOST_DELETED_FUNCTION(actor& operator=(actor const&))
+ actor(const actor& other) = default;
+ actor(const expr_type& proto_expr): proto_expr_(proto_expr) {};
+ actor() {};
};
}}
diff --git a/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp b/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp
index 034f202f40..8152d36178 100644
--- a/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp
+++ b/ydb/core/kqp/compute_actor/kqp_scan_compute_actor.cpp
@@ -193,11 +193,11 @@ public:
BaseStateFuncBody(ev, ctx);
}
} catch (const TMemoryLimitExceededException& e) {
- InternalError(TIssuesIds::KIKIMR_PRECONDITION_FAILED, TStringBuilder()
- << "Mkql memory limit exceeded, limit: " << GetMkqlMemoryLimit()
- << ", host: " << HostName() << ", canAllocateExtraMemory: " << CanAllocateExtraMemory);
+ InternalError(NYql::NDqProto::StatusIds::PRECONDITION_FAILED, TIssuesIds::KIKIMR_PRECONDITION_FAILED,
+ TStringBuilder() << "Mkql memory limit exceeded, limit: " << GetMkqlMemoryLimit()
+ << ", host: " << HostName() << ", canAllocateExtraMemory: " << CanAllocateExtraMemory);
} catch (const yexception& e) {
- InternalError(TIssuesIds::DEFAULT_ERROR, e.what());
+ InternalError(NYql::NDqProto::StatusIds::INTERNAL_ERROR, TIssuesIds::DEFAULT_ERROR, e.what());
}
ReportEventElapsedTime();
@@ -434,7 +434,7 @@ private:
return;
CA_LOG_W("Got EvScanError scan state: " << EShardStateToString(state->State)
- << " status: " << Ydb::StatusIds_StatusCode_Name(status)
+ << ", status: " << Ydb::StatusIds_StatusCode_Name(status)
<< ", reason: " << issues.ToString()
<< ", tablet id: " << state->TabletId);
@@ -502,8 +502,9 @@ private:
if (request->ErrorCount > 0) {
CA_LOG_E("Resolve request failed for table '" << ScanData->TablePath << "', ErrorCount# " << request->ErrorCount);
+ auto statusCode = NDqProto::StatusIds::UNAVAILABLE;
+ auto issueCode = TIssuesIds::KIKIMR_TEMPORARILY_UNAVAILABLE;
TString error;
- TIssuesIds::EIssueCode issueCode = TIssuesIds::KIKIMR_TEMPORARILY_UNAVAILABLE;
for (const auto& x : request->ResultSet) {
if ((ui32)x.Status < (ui32) NSchemeCache::TSchemeCacheRequest::EStatus::OkScheme) {
@@ -512,14 +513,17 @@ private:
switch (x.Status) {
case NSchemeCache::TSchemeCacheRequest::EStatus::PathErrorNotExist:
+ statusCode = NDqProto::StatusIds::SCHEME_ERROR;
issueCode = TIssuesIds::KIKIMR_SCHEME_ERROR;
error = TStringBuilder() << "Table '" << ScanData->TablePath << "' not exists.";
break;
case NSchemeCache::TSchemeCacheRequest::EStatus::TypeCheckError:
+ statusCode = NDqProto::StatusIds::ABORTED;
issueCode = TIssuesIds::KIKIMR_SCHEME_MISMATCH;
error = TStringBuilder() << "Table '" << ScanData->TablePath << "' scheme changed.";
break;
default:
+ statusCode = NDqProto::StatusIds::SCHEME_ERROR;
issueCode = TIssuesIds::KIKIMR_SCHEME_ERROR;
error = TStringBuilder() << "Unresolved table '" << ScanData->TablePath << "'. Status: " << x.Status;
break;
@@ -527,7 +531,7 @@ private:
}
}
- return InternalError(issueCode, error);
+ return InternalError(statusCode, issueCode, error);
}
auto keyDesc = std::move(request->ResultSet[0].KeyDescription);
@@ -535,7 +539,7 @@ private:
if (keyDesc->GetPartitions().empty()) {
TString error = TStringBuilder() << "No partitions to read from '" << ScanData->TablePath << "'";
CA_LOG_E(error);
- InternalError(TIssuesIds::KIKIMR_SCHEME_ERROR, error);
+ InternalError(NDqProto::StatusIds::SCHEME_ERROR, TIssuesIds::KIKIMR_SCHEME_ERROR, error);
return;
}
@@ -635,7 +639,8 @@ private:
if (shard.State == EShardState::Running && ev->Sender == shard.ActorId) {
CA_LOG_E("TEvScanDataAck lost while running scan, terminate execution. DataShard actor: "
<< shard.ActorId);
- InternalError(TIssuesIds::DEFAULT_ERROR, "Delivery problem: EvScanDataAck lost.");
+ InternalError(NDqProto::StatusIds::UNAVAILABLE, TIssuesIds::DEFAULT_ERROR,
+ "Delivery problem: EvScanDataAck lost.");
} else {
CA_LOG_D("Skip lost TEvScanDataAck to " << ev->Sender << ", active scan actor: " << shard.ActorId);
}
@@ -651,7 +656,8 @@ private:
TrackingNodes.erase(nodeId);
for(auto& [tabletId, state] : InFlightShards) {
if (state.ActorId && state.ActorId.NodeId() == nodeId) {
- InternalError(TIssuesIds::DEFAULT_ERROR, TStringBuilder() << "Connection with node " << nodeId << " lost.");
+ InternalError(NDqProto::StatusIds::UNAVAILABLE, TIssuesIds::DEFAULT_ERROR,
+ TStringBuilder() << "Connection with node " << nodeId << " lost.");
}
}
}
@@ -764,8 +770,8 @@ private:
if (state->TotalRetries >= MAX_TOTAL_SHARD_RETRIES) {
CA_LOG_E("TKqpScanComputeActor: broken pipe with tablet " << state->TabletId
<< ", retries limit exceeded (" << state->TotalRetries << ")");
- return InternalError(TIssuesIds::DEFAULT_ERROR, TStringBuilder()
- << "Retries limit with shard " << state->TabletId << " exceeded.");
+ return InternalError(NDqProto::StatusIds::UNAVAILABLE, TIssuesIds::KIKIMR_TEMPORARILY_UNAVAILABLE,
+ TStringBuilder() << "Retries limit with shard " << state->TabletId << " exceeded.");
}
// note: it might be possible that shard is already removed after successful split/merge operation and cannot be found
@@ -856,8 +862,8 @@ private:
void ResolveShard(TShardState* state) {
if (state->ResolveAttempt >= MAX_SHARD_RESOLVES) {
- InternalError(TIssuesIds::KIKIMR_SCHEME_ERROR, TStringBuilder()
- << "Table '" << ScanData->TablePath << "' resolve limit exceeded");
+ InternalError(NDqProto::StatusIds::UNAVAILABLE, TIssuesIds::KIKIMR_TEMPORARILY_UNAVAILABLE,
+ TStringBuilder() << "Table '" << ScanData->TablePath << "' resolve limit exceeded");
return;
}
diff --git a/ydb/core/kqp/executer/kqp_data_executer.cpp b/ydb/core/kqp/executer/kqp_data_executer.cpp
index 3cd2c8ff25..2b8438bafb 100644
--- a/ydb/core/kqp/executer/kqp_data_executer.cpp
+++ b/ydb/core/kqp/executer/kqp_data_executer.cpp
@@ -461,7 +461,7 @@ private:
if (er.GetKind() == NKikimrTxDataShard::TError::PROGRAM_ERROR) {
auto issue = YqlIssue({}, TIssuesIds::KIKIMR_PRECONDITION_FAILED);
issue.AddSubIssue(new TIssue(TStringBuilder() << "Data shard error: [PROGRAM_ERROR] " << er.GetReason()));
- return ReplyErrorAndDie(Ydb::StatusIds::ABORTED, issue);
+ return ReplyErrorAndDie(Ydb::StatusIds::PRECONDITION_FAILED, issue);
}
}
auto issue = YqlIssue({}, TIssuesIds::DEFAULT_ERROR, "Error executing transaction (ExecError): Execution failed");
@@ -475,7 +475,7 @@ private:
return ReplyErrorAndDie(Ydb::StatusIds::ABORTED, YqlIssue({}, TIssuesIds::KIKIMR_SCHEME_MISMATCH, er.GetReason()));
}
if (er.GetKind() == NKikimrTxDataShard::TError::SCHEME_ERROR) {
- return ReplyErrorAndDie(Ydb::StatusIds::BAD_REQUEST, YqlIssue({}, TIssuesIds::KIKIMR_SCHEME_ERROR, er.GetReason()));
+ return ReplyErrorAndDie(Ydb::StatusIds::SCHEME_ERROR, YqlIssue({}, TIssuesIds::KIKIMR_SCHEME_ERROR, er.GetReason()));
}
}
auto issue = YqlIssue({}, TIssuesIds::KIKIMR_TEMPORARILY_UNAVAILABLE);
diff --git a/ydb/core/kqp/kqp_session_actor.cpp b/ydb/core/kqp/kqp_session_actor.cpp
index dcdc5a7450..18cebe401f 100644
--- a/ydb/core/kqp/kqp_session_actor.cpp
+++ b/ydb/core/kqp/kqp_session_actor.cpp
@@ -312,11 +312,11 @@ public:
YQL_ENSURE(queryRequest.HasAction());
auto action = queryRequest.GetAction();
- LWTRACK(KqpSessionQueryRequest,
- QueryState->Orbit,
+ LWTRACK(KqpSessionQueryRequest,
+ QueryState->Orbit,
queryRequest.GetDatabase(),
queryRequest.HasType() ? queryRequest.GetType() : NKikimrKqp::QUERY_TYPE_UNDEFINED,
- action,
+ action,
queryRequest.GetQuery());
LOG_D(requestInfo << "Received request,"
<< " selfId : " << SelfId()
@@ -425,9 +425,9 @@ public:
}
auto compileRequestActor = CreateKqpCompileRequestActor(SelfId(), QueryState->UserToken, uid,
- std::move(query), keepInCache, compileDeadline, Settings.DbCounters,
+ std::move(query), keepInCache, compileDeadline, Settings.DbCounters,
QueryState ? std::move(QueryState->Orbit) : NLWTrace::TOrbit());
-
+
TlsActivationContext->ExecutorThread.RegisterActor(compileRequestActor);
Become(&TKqpSessionActor::CompileState);
@@ -987,11 +987,11 @@ public:
request.AcquireLocksTxId = txCtx.Locks.GetLockTxId();
}
- LWTRACK(KqpSessionPhyQueryProposeTx,
- QueryState->Orbit,
- QueryState->CurrentTx,
+ LWTRACK(KqpSessionPhyQueryProposeTx,
+ QueryState->Orbit,
+ QueryState->CurrentTx,
request.Transactions.size(),
- request.Locks.size(),
+ request.Locks.size(),
request.AcquireLocksTxId.Defined());
SendToExecuter(std::move(request));
return false;
@@ -1004,7 +1004,7 @@ public:
auto executerActor = CreateKqpExecuter(std::move(request), Settings.Database,
(QueryState && QueryState->UserToken) ? TMaybe<TString>(QueryState->UserToken) : Nothing(),
RequestCounters);
-
+
ExecuterId = TlsActivationContext->ExecutorThread.RegisterActor(executerActor);
LOG_D("Created new KQP executer: " << ExecuterId);
@@ -1079,7 +1079,7 @@ public:
issues.back().AddSubIssue(MakeIntrusive<TIssue>(i));
}
- ReplyQueryError(requestInfo, GetYdbStatus(issues), "", MessageFromIssues(issues));
+ ReplyQueryError(requestInfo, response->GetStatus(), "", MessageFromIssues(issues));
return;
}
@@ -1628,7 +1628,7 @@ public:
if (QueryState) {
LWTRACK(KqpSessionSendRollback, QueryState->Orbit, QueryState->CurrentTx);
}
-
+
auto request = PreparePhysicalRequest(nullptr);
request.EraseLocks = true;
diff --git a/ydb/core/sys_view/ut_kqp.cpp b/ydb/core/sys_view/ut_kqp.cpp
index cb99c617ec..01ff0e916e 100644
--- a/ydb/core/sys_view/ut_kqp.cpp
+++ b/ydb/core/sys_view/ut_kqp.cpp
@@ -846,7 +846,7 @@ Y_UNIT_TEST_SUITE(SystemView) {
UNIT_ASSERT_VALUES_EQUAL(streamPart.GetStatus(), EStatus::SUCCESS);
Cerr << "SUCCESS" << Endl;
} else {
- UNIT_ASSERT_VALUES_EQUAL(streamPart.GetStatus(), EStatus::GENERIC_ERROR);
+ UNIT_ASSERT_VALUES_EQUAL(streamPart.GetStatus(), EStatus::OVERLOADED);
Cerr << "FAIL " << streamPart.GetIssues().ToString() << Endl;
}
}
diff --git a/ydb/library/yql/dq/actors/dq.cpp b/ydb/library/yql/dq/actors/dq.cpp
index 795b91b468..66493ca6c3 100644
--- a/ydb/library/yql/dq/actors/dq.cpp
+++ b/ydb/library/yql/dq/actors/dq.cpp
@@ -24,9 +24,11 @@ Ydb::StatusIds::StatusCode DqStatusToYdbStatus(NYql::NDqProto::StatusIds::Status
return Ydb::StatusIds::CANCELLED;
case NYql::NDqProto::StatusIds::OVERLOADED:
return Ydb::StatusIds::OVERLOADED;
+ case NYql::NDqProto::StatusIds::SCHEME_ERROR:
+ return Ydb::StatusIds::SCHEME_ERROR;
default:
return Ydb::StatusIds::GENERIC_ERROR;
- }
+ }
}
NYql::NDqProto::StatusIds::StatusCode YdbStatusToDqStatus(Ydb::StatusIds::StatusCode statusCode) {
@@ -53,6 +55,8 @@ NYql::NDqProto::StatusIds::StatusCode YdbStatusToDqStatus(Ydb::StatusIds::Status
return NYql::NDqProto::StatusIds::PRECONDITION_FAILED;
case Ydb::StatusIds::CANCELLED:
return NYql::NDqProto::StatusIds::CANCELLED;
+ case Ydb::StatusIds::SCHEME_ERROR:
+ return NYql::NDqProto::StatusIds::SCHEME_ERROR;
default:
return NYql::NDqProto::StatusIds::UNSPECIFIED;
}
diff --git a/ydb/library/yql/dq/actors/protos/dq_status_codes.proto b/ydb/library/yql/dq/actors/protos/dq_status_codes.proto
index fd7fb9e868..7fa69f7ae5 100644
--- a/ydb/library/yql/dq/actors/protos/dq_status_codes.proto
+++ b/ydb/library/yql/dq/actors/protos/dq_status_codes.proto
@@ -19,5 +19,6 @@ message StatusIds {
UNSUPPORTED = 11;
EXTERNAL_ERROR = 12;
CLUSTER_OVERLOADED = 13;
+ SCHEME_ERROR = 14;
}
}
diff --git a/ydb/services/ydb/ydb_ut.cpp b/ydb/services/ydb/ydb_ut.cpp
index 8e02cd5ec6..65d0827b65 100644
--- a/ydb/services/ydb/ydb_ut.cpp
+++ b/ydb/services/ydb/ydb_ut.cpp
@@ -5357,7 +5357,7 @@ Y_UNIT_TEST(LocksFromAnotherTenants) {
TString query = Sprintf("UPSERT INTO `Root/%s/table` (Key, Value) SELECT Key, Value FROM `Root/%s/table`;", second_tenant_name.c_str(), first_tenant_name.c_str());
auto result = session.ExecuteDataQuery(query, TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync();
UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::GENERIC_ERROR,
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::CANCELLED,
"Status: " << result.GetStatus()
<< " Issues: " << result.GetIssues().ToString());
}