diff options
author | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-09 20:25:13 +0300 |
---|---|---|
committer | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-09 20:46:53 +0300 |
commit | 6ef6895772bc473a21252db8a2a9f4c1b179841c (patch) | |
tree | d02a2d6e7014703f915b4042d8648196847186a6 /yt/cpp | |
parent | c9bb61f5c70bf0d4194b5d6285afc1e5447130e4 (diff) | |
download | ydb-6ef6895772bc473a21252db8a2a9f4c1b179841c.tar.gz |
Y_VERIFY->Y_ABORT_UNLESS at ^yt
https://clubs.at.yandex-team.ru/arcadia/29404
Diffstat (limited to 'yt/cpp')
25 files changed, 86 insertions, 86 deletions
diff --git a/yt/cpp/mapreduce/client/client.cpp b/yt/cpp/mapreduce/client/client.cpp index a395174f79..42c96fcde2 100644 --- a/yt/cpp/mapreduce/client/client.cpp +++ b/yt/cpp/mapreduce/client/client.cpp @@ -1102,7 +1102,7 @@ TAuthorizationInfo TClient::WhoAmI() NJson::TJsonValue jsonValue; bool ok = NJson::ReadJsonTree(requestResult.Response, &jsonValue, /* throwOnError = */ true); - Y_VERIFY(ok); + Y_ABORT_UNLESS(ok); result.Login = jsonValue["login"].GetString(); result.Realm = jsonValue["realm"].GetString(); return result; diff --git a/yt/cpp/mapreduce/client/client_reader.cpp b/yt/cpp/mapreduce/client/client_reader.cpp index 5b4369ecbf..f1c1231220 100644 --- a/yt/cpp/mapreduce/client/client_reader.cpp +++ b/yt/cpp/mapreduce/client/client_reader.cpp @@ -54,7 +54,7 @@ TClientReader::TClientReader( , ReadTransaction_(nullptr) { if (options.CreateTransaction_) { - Y_VERIFY(transactionPinger, "Internal error: transactionPinger is null"); + Y_ABORT_UNLESS(transactionPinger, "Internal error: transactionPinger is null"); ReadTransaction_ = MakeHolder<TPingableTransaction>( ClientRetryPolicy_, Context_, diff --git a/yt/cpp/mapreduce/client/file_reader.cpp b/yt/cpp/mapreduce/client/file_reader.cpp index 35b2133651..5454b9b11f 100644 --- a/yt/cpp/mapreduce/client/file_reader.cpp +++ b/yt/cpp/mapreduce/client/file_reader.cpp @@ -153,7 +153,7 @@ NHttpClient::IHttpResponsePtr TFileReader::Request(const TClientContext& context header.SetOutputFormat(TMaybe<TFormat>()); // Binary format if (EndOffset_) { - Y_VERIFY(*EndOffset_ >= currentOffset); + Y_ABORT_UNLESS(*EndOffset_ >= currentOffset); FileReaderOptions_.Length(*EndOffset_ - currentOffset); } FileReaderOptions_.Offset(currentOffset); diff --git a/yt/cpp/mapreduce/client/file_writer.cpp b/yt/cpp/mapreduce/client/file_writer.cpp index daf6461edd..6e6553b88c 100644 --- a/yt/cpp/mapreduce/client/file_writer.cpp +++ b/yt/cpp/mapreduce/client/file_writer.cpp @@ -41,7 +41,7 @@ void TFileWriter::DoWrite(const void* buf, size_t len) // and server produced one chunk of desired size and one small chunk. while (len > 0) { const auto retryBlockRemainingSize = RetryfulWriter_.GetRetryBlockRemainingSize(); - Y_VERIFY(retryBlockRemainingSize > 0); + Y_ABORT_UNLESS(retryBlockRemainingSize > 0); const auto firstWriteLen = Min(len, retryBlockRemainingSize); RetryfulWriter_.Write(buf, firstWriteLen); RetryfulWriter_.NotifyRowEnd(); diff --git a/yt/cpp/mapreduce/client/format_hints.cpp b/yt/cpp/mapreduce/client/format_hints.cpp index 1f6eb173ad..0c0121e7a5 100644 --- a/yt/cpp/mapreduce/client/format_hints.cpp +++ b/yt/cpp/mapreduce/client/format_hints.cpp @@ -34,7 +34,7 @@ static void ApplyEnableTypeConversion(TFormat* format, const TFormatHints& forma template <> void ApplyFormatHints<TNode>(TFormat* format, const TMaybe<TFormatHints>& formatHints) { - Y_VERIFY(format); + Y_ABORT_UNLESS(format); if (!formatHints) { return; } @@ -60,7 +60,7 @@ void ApplyFormatHints<TNode>(TFormat* format, const TMaybe<TFormatHints>& format template <> void ApplyFormatHints<TYaMRRow>(TFormat* format, const TMaybe<TFormatHints>& formatHints) { - Y_VERIFY(format); + Y_ABORT_UNLESS(format); if (!formatHints) { return; } @@ -71,7 +71,7 @@ void ApplyFormatHints<TYaMRRow>(TFormat* format, const TMaybe<TFormatHints>& for template <> void ApplyFormatHints<::google::protobuf::Message>(TFormat* format, const TMaybe<TFormatHints>& formatHints) { - Y_VERIFY(format); + Y_ABORT_UNLESS(format); if (!formatHints) { return; } diff --git a/yt/cpp/mapreduce/client/operation.cpp b/yt/cpp/mapreduce/client/operation.cpp index dfe7ecd223..855e6e834c 100644 --- a/yt/cpp/mapreduce/client/operation.cpp +++ b/yt/cpp/mapreduce/client/operation.cpp @@ -240,7 +240,7 @@ TStructuredJobTableList ApplyProtobufColumnFilters( continue; } auto& table = newTableList[tableIndex]; - Y_VERIFY(table.RichYPath); + Y_ABORT_UNLESS(table.RichYPath); if (table.RichYPath->Columns_) { continue; } @@ -326,7 +326,7 @@ TSimpleOperationIo CreateSimpleOperationIo( &outputs, hints); - Y_VERIFY(outputs.size() == outputSchemas.size()); + Y_ABORT_UNLESS(outputs.size() == outputSchemas.size()); for (int i = 0; i < static_cast<int>(outputs.size()); ++i) { if (!outputs[i].Schema_ && !outputSchemas[i].Columns().empty()) { outputs[i].Schema_ = outputSchemas[i]; @@ -556,7 +556,7 @@ EOperationBriefState CheckOperation( TGetOperationOptions().AttributeFilter(TOperationAttributeFilter() .Add(EOperationAttribute::State) .Add(EOperationAttribute::Result))); - Y_VERIFY(attributes.BriefState, + Y_ABORT_UNLESS(attributes.BriefState, "get_operation for operation %s has not returned \"state\" field", GetGuidAsString(operationId).Data()); if (*attributes.BriefState == EOperationBriefState::Completed) { @@ -573,7 +573,7 @@ EOperationBriefState CheckOperation( operationId, TGetFailedJobInfoOptions()); - Y_VERIFY(attributes.Result && attributes.Result->Error); + Y_ABORT_UNLESS(attributes.Result && attributes.Result->Error); ythrow TOperationFailedError( *attributes.BriefState == EOperationBriefState::Aborted ? TOperationFailedError::Aborted @@ -1624,7 +1624,7 @@ void ExecuteMapReduce( operationIo.MapperInputFormat = inputFormat; operationIo.MapperOutputFormat = outputFormat; - Y_VERIFY(mapperInferenceResult.size() >= 1); + Y_ABORT_UNLESS(mapperInferenceResult.size() >= 1); currentInferenceResult = TVector<TTableSchema>{mapperInferenceResult[0]}; // The first output as it corresponds to the intermediate data. TVector<TTableSchema> additionalOutputsInferenceResult(mapperInferenceResult.begin() + 1, mapperInferenceResult.end()); @@ -2051,7 +2051,7 @@ void ExecuteVanilla( preparer->GetPreparationId()); auto addTask = [&](TFluentMap fluent, const TVanillaTask& task) { - Y_VERIFY(task.Job_.Get()); + Y_ABORT_UNLESS(task.Job_.Get()); if (std::holds_alternative<TVoidStructuredRowStream>(task.Job_->GetOutputRowStreamDescription())) { Y_ENSURE_EX(task.Outputs_.empty(), TApiUsageError() << "Vanilla task with void IVanillaJob doesn't expect output tables"); @@ -2268,7 +2268,7 @@ public: OperationImpl_->AnalyzeUnrecognizedSpec(*attributes.UnrecognizedSpec); UnrecognizedSpecAnalyzed_ = true; } - Y_VERIFY(attributes.BriefState, + Y_ABORT_UNLESS(attributes.BriefState, "get_operation for operation %s has not returned \"state\" field", GetGuidAsString(OperationImpl_->GetId()).Data()); if (*attributes.BriefState != EOperationBriefState::InProgress) { @@ -2315,7 +2315,7 @@ TString TOperation::TOperationImpl::GetWebInterfaceUrl() const void TOperation::TOperationImpl::OnPrepared() { - Y_VERIFY(!PreparedPromise_.HasException() && !PreparedPromise_.HasValue()); + Y_ABORT_UNLESS(!PreparedPromise_.HasException() && !PreparedPromise_.HasValue()); PreparedPromise_.SetValue(); } @@ -2361,7 +2361,7 @@ bool TOperation::TOperationImpl::IsStarted() const { void TOperation::TOperationImpl::OnPreparationException(std::exception_ptr e) { - Y_VERIFY(!PreparedPromise_.HasValue() && !PreparedPromise_.HasException()); + Y_ABORT_UNLESS(!PreparedPromise_.HasValue() && !PreparedPromise_.HasException()); PreparedPromise_.SetException(e); } @@ -2437,7 +2437,7 @@ EOperationBriefState TOperation::TOperationImpl::GetBriefState() ValidateOperationStarted(); EOperationBriefState result = EOperationBriefState::InProgress; UpdateAttributesAndCall(false, [&] (const TOperationAttributes& attributes) { - Y_VERIFY(attributes.BriefState, + Y_ABORT_UNLESS(attributes.BriefState, "get_operation for operation %s has not returned \"state\" field", GetGuidAsString(*Id_).Data()); result = *attributes.BriefState; @@ -2450,7 +2450,7 @@ TMaybe<TYtError> TOperation::TOperationImpl::GetError() ValidateOperationStarted(); TMaybe<TYtError> result; UpdateAttributesAndCall(false, [&] (const TOperationAttributes& attributes) { - Y_VERIFY(attributes.Result); + Y_ABORT_UNLESS(attributes.Result); result = attributes.Result->Error; }); return result; @@ -2516,9 +2516,9 @@ void TOperation::TOperationImpl::AnalyzeUnrecognizedSpec(TNode unrecognizedSpec) } }; - Y_VERIFY(unrecognizedSpec.IsMap()); + Y_ABORT_UNLESS(unrecognizedSpec.IsMap()); for (const auto& knownFieldPath : knownUnrecognizedSpecFieldPaths) { - Y_VERIFY(!knownFieldPath.empty()); + Y_ABORT_UNLESS(!knownFieldPath.empty()); removeByPath(unrecognizedSpec, knownFieldPath.cbegin(), knownFieldPath.cend(), removeByPath); } @@ -2534,13 +2534,13 @@ void TOperation::TOperationImpl::AnalyzeUnrecognizedSpec(TNode unrecognizedSpec) void TOperation::TOperationImpl::OnStarted(const TOperationId& operationId) { auto guard = Guard(Lock_); - Y_VERIFY(!Id_, + Y_ABORT_UNLESS(!Id_, "OnStarted() called with operationId = %s for operation with id %s", GetGuidAsString(operationId).Data(), GetGuidAsString(*Id_).Data()); Id_ = operationId; - Y_VERIFY(!StartedPromise_.HasValue() && !StartedPromise_.HasException()); + Y_ABORT_UNLESS(!StartedPromise_.HasValue() && !StartedPromise_.HasException()); StartedPromise_.SetValue(); } @@ -2657,12 +2657,12 @@ void TOperation::TOperationImpl::SyncFinishOperationImpl(const TOperationAttribu { { auto guard = Guard(Lock_); - Y_VERIFY(Id_); + Y_ABORT_UNLESS(Id_); } - Y_VERIFY(attributes.BriefState, + Y_ABORT_UNLESS(attributes.BriefState, "get_operation for operation %s has not returned \"state\" field", GetGuidAsString(*Id_).Data()); - Y_VERIFY(*attributes.BriefState != EOperationBriefState::InProgress); + Y_ABORT_UNLESS(*attributes.BriefState != EOperationBriefState::InProgress); { try { @@ -2681,7 +2681,7 @@ void TOperation::TOperationImpl::SyncFinishOperationImpl(const TOperationAttribu if (*attributes.BriefState == EOperationBriefState::Completed) { CompletePromise_->SetValue(); } else if (*attributes.BriefState == EOperationBriefState::Aborted || *attributes.BriefState == EOperationBriefState::Failed) { - Y_VERIFY(attributes.Result && attributes.Result->Error); + Y_ABORT_UNLESS(attributes.Result && attributes.Result->Error); const auto& error = *attributes.Result->Error; YT_LOG_ERROR("Operation %v is `%v' with error: %v", *Id_, diff --git a/yt/cpp/mapreduce/client/operation_preparer.cpp b/yt/cpp/mapreduce/client/operation_preparer.cpp index e84dc1091f..81321d9726 100644 --- a/yt/cpp/mapreduce/client/operation_preparer.cpp +++ b/yt/cpp/mapreduce/client/operation_preparer.cpp @@ -125,7 +125,7 @@ public: private: void UpdateOperationStatus(TStringBuf err) { - Y_VERIFY(Operation_); + Y_ABORT_UNLESS(Operation_); Operation_->OnStatusUpdated( ::TStringBuilder() << "Retriable error during operation start: " << err); } @@ -683,7 +683,7 @@ TMaybe<TString> TJobPreparer::TryUploadWithDeduplication(const IItemToUpload& it TString TJobPreparer::UploadToCacheUsingApi(const IItemToUpload& itemToUpload) const { auto md5Signature = itemToUpload.CalculateMD5(); - Y_VERIFY(md5Signature.size() == 32); + Y_ABORT_UNLESS(md5Signature.size() == 32); if (auto cachedItemPath = GetItemFromCypressCache(md5Signature, itemToUpload.GetDescription())) { return *cachedItemPath; diff --git a/yt/cpp/mapreduce/client/prepare_operation.cpp b/yt/cpp/mapreduce/client/prepare_operation.cpp index 7f772dc99a..cd775f5357 100644 --- a/yt/cpp/mapreduce/client/prepare_operation.cpp +++ b/yt/cpp/mapreduce/client/prepare_operation.cpp @@ -76,7 +76,7 @@ const TVector<TTableSchema>& TOperationPreparationContext::GetInputSchemas() con schemaFutures.emplace_back(); continue; } - Y_VERIFY(Inputs_[tableIndex]); + Y_ABORT_UNLESS(Inputs_[tableIndex]); schemaFutures.push_back(batch.Get(TransactionId_, Inputs_[tableIndex]->Path_ + "/@schema", TGetOptions{})); } @@ -98,7 +98,7 @@ const TTableSchema& TOperationPreparationContext::GetInputSchema(int index) cons { auto& schema = InputSchemas_[index]; if (!InputSchemasLoaded_[index]) { - Y_VERIFY(Inputs_[index]); + Y_ABORT_UNLESS(Inputs_[index]); auto schemaNode = NRawClient::Get( RetryPolicy_->CreatePolicyForGenericRequest(), Context_, @@ -111,7 +111,7 @@ const TTableSchema& TOperationPreparationContext::GetInputSchema(int index) cons TMaybe<TYPath> TOperationPreparationContext::GetInputPath(int index) const { - Y_VERIFY(index < static_cast<int>(Inputs_.size())); + Y_ABORT_UNLESS(index < static_cast<int>(Inputs_.size())); if (Inputs_[index]) { return Inputs_[index]->Path_; } @@ -120,7 +120,7 @@ TMaybe<TYPath> TOperationPreparationContext::GetInputPath(int index) const TMaybe<TYPath> TOperationPreparationContext::GetOutputPath(int index) const { - Y_VERIFY(index < static_cast<int>(Outputs_.size())); + Y_ABORT_UNLESS(index < static_cast<int>(Outputs_.size())); if (Outputs_[index]) { return Outputs_[index]->Path_; } @@ -137,7 +137,7 @@ TSpeculativeOperationPreparationContext::TSpeculativeOperationPreparationContext , Inputs_(std::move(inputs)) , Outputs_(std::move(outputs)) { - Y_VERIFY(Inputs_.size() == previousResult.size()); + Y_ABORT_UNLESS(Inputs_.size() == previousResult.size()); } int TSpeculativeOperationPreparationContext::GetInputCount() const @@ -157,13 +157,13 @@ const TVector<TTableSchema>& TSpeculativeOperationPreparationContext::GetInputSc const TTableSchema& TSpeculativeOperationPreparationContext::GetInputSchema(int index) const { - Y_VERIFY(index < static_cast<int>(InputSchemas_.size())); + Y_ABORT_UNLESS(index < static_cast<int>(InputSchemas_.size())); return InputSchemas_[index]; } TMaybe<TYPath> TSpeculativeOperationPreparationContext::GetInputPath(int index) const { - Y_VERIFY(index < static_cast<int>(Inputs_.size())); + Y_ABORT_UNLESS(index < static_cast<int>(Inputs_.size())); if (Inputs_[index].RichYPath) { return Inputs_[index].RichYPath->Path_; } @@ -172,7 +172,7 @@ TMaybe<TYPath> TSpeculativeOperationPreparationContext::GetInputPath(int index) TMaybe<TYPath> TSpeculativeOperationPreparationContext::GetOutputPath(int index) const { - Y_VERIFY(index < static_cast<int>(Outputs_.size())); + Y_ABORT_UNLESS(index < static_cast<int>(Outputs_.size())); if (Outputs_[index].RichYPath) { return Outputs_[index].RichYPath->Path_; } diff --git a/yt/cpp/mapreduce/client/structured_table_formats.cpp b/yt/cpp/mapreduce/client/structured_table_formats.cpp index b6e82c6c15..60e3d61c99 100644 --- a/yt/cpp/mapreduce/client/structured_table_formats.cpp +++ b/yt/cpp/mapreduce/client/structured_table_formats.cpp @@ -208,7 +208,7 @@ TStructuredJobTableList CanonizeStructuredTableList(const TClientContext& contex toCanonize.emplace_back(table.RichYPath); } const auto canonized = NRawClient::CanonizeYPaths(/* retryPolicy */ nullptr, context, toCanonize); - Y_VERIFY(canonized.size() == tableList.size()); + Y_ABORT_UNLESS(canonized.size() == tableList.size()); TStructuredJobTableList result; result.reserve(tableList.size()); @@ -223,7 +223,7 @@ TVector<TRichYPath> GetPathList( const TMaybe<TVector<TTableSchema>>& jobSchemaInferenceResult, bool inferSchemaFromDescriptions) { - Y_VERIFY(!jobSchemaInferenceResult || tableList.size() == jobSchemaInferenceResult->size()); + Y_ABORT_UNLESS(!jobSchemaInferenceResult || tableList.size() == jobSchemaInferenceResult->size()); auto maybeInferSchema = [&] (const TStructuredJobTable& table, ui32 tableIndex) -> TMaybe<TTableSchema> { if (jobSchemaInferenceResult && !jobSchemaInferenceResult->at(tableIndex).Empty()) { @@ -239,7 +239,7 @@ TVector<TRichYPath> GetPathList( result.reserve(tableList.size()); for (size_t tableIndex = 0; tableIndex != tableList.size(); ++tableIndex) { const auto& table = tableList[tableIndex]; - Y_VERIFY(table.RichYPath, "Cannot get path for intermediate table"); + Y_ABORT_UNLESS(table.RichYPath, "Cannot get path for intermediate table"); auto richYPath = *table.RichYPath; if (!richYPath.Schema_) { if (auto schema = maybeInferSchema(table, tableIndex)) { @@ -373,7 +373,7 @@ std::pair<TFormat, TMaybe<TSmallJobFile>> TFormatBuilder::CreateYamrFormat( if (allowFormatFromTableAttribute && OperationOptions_.UseTableFormats_) { TVector<TRichYPath> tableList; for (const auto& table: structuredTableList) { - Y_VERIFY(table.RichYPath, "Cannot use format from table for intermediate table"); + Y_ABORT_UNLESS(table.RichYPath, "Cannot use format from table for intermediate table"); tableList.push_back(*table.RichYPath); } formatFromTableAttributes = GetTableFormats(ClientRetryPolicy_, Context_, TransactionId_, tableList); @@ -416,7 +416,7 @@ std::pair<TFormat, TMaybe<TSmallJobFile>> TFormatBuilder::CreateNodeFormat( if (nodeReaderFormat != ENodeReaderFormat::Yson) { TVector<TRichYPath> tableList; for (const auto& table: structuredTableList) { - Y_VERIFY(table.RichYPath, "Cannot use skiff with temporary tables"); + Y_ABORT_UNLESS(table.RichYPath, "Cannot use skiff with temporary tables"); tableList.emplace_back(*table.RichYPath); } skiffSchema = TryCreateSkiffSchema( @@ -515,7 +515,7 @@ std::pair<TFormat, TMaybe<TSmallJobFile>> TFormatBuilder::CreateProtobufFormat( if (!descriptor) { // It must be intermediate table, because there is no proper way to add such table to spec // (AddInput requires to specify proper message). - Y_VERIFY(!table.RichYPath, "Descriptors for all tables except intermediate must be known"); + Y_ABORT_UNLESS(!table.RichYPath, "Descriptors for all tables except intermediate must be known"); if (jobDescriptor) { descriptor = jobDescriptor; } else { @@ -532,7 +532,7 @@ std::pair<TFormat, TMaybe<TSmallJobFile>> TFormatBuilder::CreateProtobufFormat( } descriptorList.push_back(descriptor); } - Y_VERIFY(!descriptorList.empty(), "Messages for proto format are unknown (empty ProtoDescriptors)"); + Y_ABORT_UNLESS(!descriptorList.empty(), "Messages for proto format are unknown (empty ProtoDescriptors)"); return { TFormat::Protobuf(descriptorList, Context_.Config->ProtobufFormatWithDescriptors), TSmallJobFile{ diff --git a/yt/cpp/mapreduce/client/yt_poller.cpp b/yt/cpp/mapreduce/client/yt_poller.cpp index e0bea1690e..5750f5840c 100644 --- a/yt/cpp/mapreduce/client/yt_poller.cpp +++ b/yt/cpp/mapreduce/client/yt_poller.cpp @@ -89,7 +89,7 @@ void TYtPoller::WatchLoop() if (!Pending_.empty()) { InProgress_.splice(InProgress_.end(), Pending_); } - Y_VERIFY(!InProgress_.empty()); + Y_ABORT_UNLESS(!InProgress_.empty()); } TRawBatchRequest rawBatchRequest(Context_.Config); diff --git a/yt/cpp/mapreduce/http/helpers.cpp b/yt/cpp/mapreduce/http/helpers.cpp index 233a565f20..8a5fe16138 100644 --- a/yt/cpp/mapreduce/http/helpers.cpp +++ b/yt/cpp/mapreduce/http/helpers.cpp @@ -53,7 +53,7 @@ static TString GetParametersDebugString(const THttpHeader& header) TString TruncateForLogs(const TString& text, size_t maxSize) { - Y_VERIFY(maxSize > 10); + Y_ABORT_UNLESS(maxSize > 10); if (text.empty()) { static TString empty = "empty"; return empty; diff --git a/yt/cpp/mapreduce/http/http.cpp b/yt/cpp/mapreduce/http/http.cpp index d44b2638a0..c5c358c46c 100644 --- a/yt/cpp/mapreduce/http/http.cpp +++ b/yt/cpp/mapreduce/http/http.cpp @@ -101,9 +101,9 @@ private: // if error has happend. This function tries to read error response // in such cases. void HandleWriteException() { - Y_VERIFY(WriteError_ == nullptr); + Y_ABORT_UNLESS(WriteError_ == nullptr); WriteError_ = std::current_exception(); - Y_VERIFY(WriteError_ != nullptr); + Y_ABORT_UNLESS(WriteError_ != nullptr); try { HttpRequest_->GetResponseStream(); } catch (const TErrorResponse &) { @@ -774,7 +774,7 @@ size_t THttpResponse::DoRead(void* buf, size_t len) if (read == 0 && len != 0) { // THttpInput MUST return defined (but may be empty) // trailers when it is exhausted. - Y_VERIFY(HttpInput_.Trailers().Defined(), + Y_ABORT_UNLESS(HttpInput_.Trailers().Defined(), "trailers MUST be defined for exhausted stream"); CheckTrailers(HttpInput_.Trailers().GetRef()); IsExhausted_ = true; @@ -793,7 +793,7 @@ size_t THttpResponse::DoSkip(size_t len) if (skipped == 0 && len != 0) { // THttpInput MUST return defined (but may be empty) // trailers when it is exhausted. - Y_VERIFY(HttpInput_.Trailers().Defined(), + Y_ABORT_UNLESS(HttpInput_.Trailers().Defined(), "trailers MUST be defined for exhausted stream"); CheckTrailers(HttpInput_.Trailers().GetRef()); IsExhausted_ = true; @@ -964,7 +964,7 @@ THttpResponse* THttpRequest::GetResponseStream() if (!Input) { SocketInput.Reset(new TSocketInput(*Connection->Socket.Get())); if (TConfig::Get()->UseAbortableResponse) { - Y_VERIFY(!Url_.empty()); + Y_ABORT_UNLESS(!Url_.empty()); Input.Reset(new TAbortableHttpResponse(SocketInput.Get(), RequestId, HostName, Url_)); } else { Input.Reset(new THttpResponse(SocketInput.Get(), RequestId, HostName)); diff --git a/yt/cpp/mapreduce/http/http_client.cpp b/yt/cpp/mapreduce/http/http_client.cpp index a2af1182dc..6dc24c6ef2 100644 --- a/yt/cpp/mapreduce/http/http_client.cpp +++ b/yt/cpp/mapreduce/http/http_client.cpp @@ -226,7 +226,7 @@ public: CheckErrorResponse(Context_.HostName, Context_.RequestId, Response_); if (TConfig::Get()->UseAbortableResponse) { - Y_VERIFY(!Context_.Url.empty()); + Y_ABORT_UNLESS(!Context_.Url.empty()); Stream_ = std::make_unique<TAbortableCoreHttpResponse>(std::move(stream), Context_.Url); } else { Stream_ = std::move(stream); @@ -423,9 +423,9 @@ private: // if error has happend. This function tries to read error response // in such cases. void HandleWriteException() { - Y_VERIFY(WriteError_ == nullptr); + Y_ABORT_UNLESS(WriteError_ == nullptr); WriteError_ = std::current_exception(); - Y_VERIFY(WriteError_ != nullptr); + Y_ABORT_UNLESS(WriteError_ != nullptr); try { HttpRequest_->FinishWithError()->GetResponseStream(); } catch (const TErrorResponse &) { diff --git a/yt/cpp/mapreduce/interface/common.cpp b/yt/cpp/mapreduce/interface/common.cpp index 31c5990e6b..28f98713f6 100644 --- a/yt/cpp/mapreduce/interface/common.cpp +++ b/yt/cpp/mapreduce/interface/common.cpp @@ -325,14 +325,14 @@ TColumnSchema TColumnSchema::Type(EValueType type) && TColumnSchema& TColumnSchema::Type(const NTi::TTypePtr& type) & { - Y_VERIFY(type.Get(), "Cannot create column schema with nullptr type"); + Y_ABORT_UNLESS(type.Get(), "Cannot create column schema with nullptr type"); TypeV3_ = type; return *this; } TColumnSchema TColumnSchema::Type(const NTi::TTypePtr& type) && { - Y_VERIFY(type.Get(), "Cannot create column schema with nullptr type"); + Y_ABORT_UNLESS(type.Get(), "Cannot create column schema with nullptr type"); TypeV3_ = type; return *this; } @@ -526,7 +526,7 @@ TTableSchema CreateTableSchema( TTableSchema CreateTableSchema(NTi::TTypePtr type) { - Y_VERIFY(type); + Y_ABORT_UNLESS(type); TTableSchema schema; Deserialize(schema, NodeFromYsonString(NTi::NIo::AsYtSchema(type.Get()))); return schema; diff --git a/yt/cpp/mapreduce/interface/format.cpp b/yt/cpp/mapreduce/interface/format.cpp index a663e7dfa8..aec9570bc2 100644 --- a/yt/cpp/mapreduce/interface/format.cpp +++ b/yt/cpp/mapreduce/interface/format.cpp @@ -92,7 +92,7 @@ bool TFormat::IsYamredDsv() const static TString FormatName(const TFormat& format) { if (!format.Config.IsString()) { - Y_VERIFY(format.Config.IsUndefined()); + Y_ABORT_UNLESS(format.Config.IsUndefined()); return "<undefined>"; } return format.Config.AsString(); diff --git a/yt/cpp/mapreduce/interface/io-inl.h b/yt/cpp/mapreduce/interface/io-inl.h index 542749c679..fee7ba20ff 100644 --- a/yt/cpp/mapreduce/interface/io-inl.h +++ b/yt/cpp/mapreduce/interface/io-inl.h @@ -242,7 +242,7 @@ protected: template <typename U, typename TMover, typename TCacheMover> void DoMoveRowCached(U* result, TMover mover, TCacheMover cacheMover) { - Y_VERIFY(result); + Y_ABORT_UNLESS(result); switch (RowState_) { case ERowState::None: mover(result); @@ -355,7 +355,7 @@ public: }, /* cacheGetter */ [&] { auto result = dynamic_cast<const U*>(CachedRow_.Get()); - Y_VERIFY(result); + Y_ABORT_UNLESS(result); return result; }); } @@ -372,7 +372,7 @@ public: }, /* cacheMover */ [&] (U* result) { auto cast = dynamic_cast<U*>(CachedRow_.Get()); - Y_VERIFY(cast); + Y_ABORT_UNLESS(cast); result->Swap(cast); }); } @@ -430,7 +430,7 @@ public: Reader_->ReadRow(result); }, /* cacheMover */ [&] (U* result) { - Y_VERIFY((NDetail::TIndexInTuple<U, decltype(CachedRows_)>::Value) == CachedIndex_); + Y_ABORT_UNLESS((NDetail::TIndexInTuple<U, decltype(CachedRows_)>::Value) == CachedIndex_); *result = std::move(std::get<U>(CachedRows_)); }); } @@ -531,7 +531,7 @@ public: *result = std::move(std::get<U>(CachedRows_)); }, /* cacheMover */ [&] (U* result) { - Y_VERIFY((NDetail::TIndexInTuple<U, decltype(CachedRows_)>::Value) == CachedIndex_); + Y_ABORT_UNLESS((NDetail::TIndexInTuple<U, decltype(CachedRows_)>::Value) == CachedIndex_); *result = std::move(std::get<U>(CachedRows_)); }); } diff --git a/yt/cpp/mapreduce/interface/job_statistics.cpp b/yt/cpp/mapreduce/interface/job_statistics.cpp index bd9791672d..4ff8dde3cc 100644 --- a/yt/cpp/mapreduce/interface/job_statistics.cpp +++ b/yt/cpp/mapreduce/interface/job_statistics.cpp @@ -117,7 +117,7 @@ public: static void ParseNode(const TNode& node, const TString& curPath, TName2State2TaskName2Data* output) { - Y_VERIFY(node.IsMap()); + Y_ABORT_UNLESS(node.IsMap()); for (const auto& [key, value] : node.AsMap()) { if (key == "$"sv) { diff --git a/yt/cpp/mapreduce/interface/logging/yt_log.cpp b/yt/cpp/mapreduce/interface/logging/yt_log.cpp index 9fa7b91580..8948021407 100644 --- a/yt/cpp/mapreduce/interface/logging/yt_log.cpp +++ b/yt/cpp/mapreduce/interface/logging/yt_log.cpp @@ -53,7 +53,7 @@ public: const TLoggingCategory* GetCategory(TStringBuf categoryName) override { - Y_VERIFY(categoryName == CategoryName); + Y_ABORT_UNLESS(categoryName == CategoryName); return &Category_; } diff --git a/yt/cpp/mapreduce/interface/operation-inl.h b/yt/cpp/mapreduce/interface/operation-inl.h index 8d53cd446f..c1323f820f 100644 --- a/yt/cpp/mapreduce/interface/operation-inl.h +++ b/yt/cpp/mapreduce/interface/operation-inl.h @@ -573,10 +573,10 @@ int RunVanillaJob(size_t outputTableCount, IInputStream& jobStateStream) job.Load(jobStateStream); if constexpr (std::is_base_of<IVanillaJob<>, TVanillaJob>::value) { - Y_VERIFY(outputTableCount == 0, "Void vanilla job expects zero 'outputTableCount'"); + Y_ABORT_UNLESS(outputTableCount == 0, "Void vanilla job expects zero 'outputTableCount'"); job.Do(); } else { - Y_VERIFY(outputTableCount, "Vanilla job with table writer expects nonzero 'outputTableCount'"); + Y_ABORT_UNLESS(outputTableCount, "Vanilla job with table writer expects nonzero 'outputTableCount'"); using TOutputRow = typename TVanillaJob::TWriter::TRowType; THolder<IProxyOutput> rawJobWriter; diff --git a/yt/cpp/mapreduce/interface/operation.cpp b/yt/cpp/mapreduce/interface/operation.cpp index 706fc4caa4..03592b13fe 100644 --- a/yt/cpp/mapreduce/interface/operation.cpp +++ b/yt/cpp/mapreduce/interface/operation.cpp @@ -316,7 +316,7 @@ TVector<TTableSchema> TJobOperationPreparer::GetOutputSchemas() TVector<TTableSchema> result; result.reserve(OutputSchemas_.size()); for (auto& schema : OutputSchemas_) { - Y_VERIFY(schema.Defined()); + Y_ABORT_UNLESS(schema.Defined()); result.push_back(std::move(*schema)); schema.Clear(); } @@ -455,7 +455,7 @@ IOperationPtr IOperationClient::Map( ::TIntrusivePtr<IMapperBase> mapper, const TOperationOptions& options) { - Y_VERIFY(mapper.Get()); + Y_ABORT_UNLESS(mapper.Get()); return DoMap( spec, @@ -490,7 +490,7 @@ IOperationPtr IOperationClient::Reduce( ::TIntrusivePtr<IReducerBase> reducer, const TOperationOptions& options) { - Y_VERIFY(reducer.Get()); + Y_ABORT_UNLESS(reducer.Get()); return DoReduce( spec, @@ -529,7 +529,7 @@ IOperationPtr IOperationClient::JoinReduce( ::TIntrusivePtr<IReducerBase> reducer, const TOperationOptions& options) { - Y_VERIFY(reducer.Get()); + Y_ABORT_UNLESS(reducer.Get()); return DoJoinReduce( spec, @@ -543,7 +543,7 @@ IOperationPtr IOperationClient::MapReduce( ::TIntrusivePtr<IReducerBase> reducer, const TOperationOptions& options) { - Y_VERIFY(reducer.Get()); + Y_ABORT_UNLESS(reducer.Get()); return DoMapReduce( spec, @@ -560,7 +560,7 @@ IOperationPtr IOperationClient::MapReduce( ::TIntrusivePtr<IReducerBase> reducer, const TOperationOptions& options) { - Y_VERIFY(reducer.Get()); + Y_ABORT_UNLESS(reducer.Get()); return DoMapReduce( spec, diff --git a/yt/cpp/mapreduce/interface/operation.h b/yt/cpp/mapreduce/interface/operation.h index e7f1efc25b..6841bf9ee7 100644 --- a/yt/cpp/mapreduce/interface/operation.h +++ b/yt/cpp/mapreduce/interface/operation.h @@ -1943,7 +1943,7 @@ public: /// @brief Get number of output tables. i64 GetOutputTableCount() const { - Y_VERIFY(NDetail::OutputTableCount > 0); + Y_ABORT_UNLESS(NDetail::OutputTableCount > 0); return NDetail::OutputTableCount; } diff --git a/yt/cpp/mapreduce/interface/protobuf_format.cpp b/yt/cpp/mapreduce/interface/protobuf_format.cpp index 3d57ed2797..0f6895966e 100644 --- a/yt/cpp/mapreduce/interface/protobuf_format.cpp +++ b/yt/cpp/mapreduce/interface/protobuf_format.cpp @@ -478,7 +478,7 @@ public: [[nodiscard]] TGuard Enter(const Descriptor* descriptor) { if (ActiveVertices_.contains(descriptor)) { - Y_VERIFY(!Stack_.empty()); + Y_ABORT_UNLESS(!Stack_.empty()); ythrow TApiUsageError() << "Cyclic reference found for protobuf messages. " << "Consider removing " << EWrapperFieldFlag::SERIALIZATION_YT << " flag " << "somewhere on the cycle containing " << @@ -627,7 +627,7 @@ TNode MakeMapFieldsConfig( const TProtobufFieldOptions& fieldOptions, TCycleChecker& cycleChecker) { - Y_VERIFY(fieldDescriptor->is_map()); + Y_ABORT_UNLESS(fieldDescriptor->is_map()); auto message = fieldDescriptor->message_type(); switch (fieldOptions.MapMode) { case EProtobufMapMode::ListOfStructsLegacy: @@ -1306,7 +1306,7 @@ NTi::TTypePtr TTableSchemaInferrer::GetMessageType( const FieldDescriptor& fieldDescriptor, TProtobufFieldOptions defaultFieldOptions) { - Y_VERIFY(fieldDescriptor.message_type()); + Y_ABORT_UNLESS(fieldDescriptor.message_type()); const auto& messageDescriptor = *fieldDescriptor.message_type(); auto members = GetMessageMembers( fieldDescriptor.full_name(), @@ -1320,7 +1320,7 @@ NTi::TTypePtr TTableSchemaInferrer::GetMapType( const FieldDescriptor& fieldDescriptor, const TProtobufFieldOptions& fieldOptions) { - Y_VERIFY(fieldDescriptor.is_map()); + Y_ABORT_UNLESS(fieldDescriptor.is_map()); switch (fieldOptions.MapMode) { case EProtobufMapMode::ListOfStructsLegacy: case EProtobufMapMode::ListOfStructs: { @@ -1340,16 +1340,16 @@ NTi::TTypePtr TTableSchemaInferrer::GetMapType( case EProtobufMapMode::Dict: case EProtobufMapMode::OptionalDict: { auto message = fieldDescriptor.message_type(); - Y_VERIFY(message->field_count() == 2); + Y_ABORT_UNLESS(message->field_count() == 2); auto keyVariant = GetScalarFieldType(*message->field(0), TProtobufFieldOptions{}); - Y_VERIFY(std::holds_alternative<EValueType>(keyVariant)); + Y_ABORT_UNLESS(std::holds_alternative<EValueType>(keyVariant)); auto key = std::get<EValueType>(keyVariant); TProtobufFieldOptions embeddedOptions; embeddedOptions.SerializationMode = EProtobufSerializationMode::Yt; auto valueVariant = GetFieldType(*message->field(1), embeddedOptions); - Y_VERIFY(std::holds_alternative<NTi::TTypePtr>(valueVariant)); + Y_ABORT_UNLESS(std::holds_alternative<NTi::TTypePtr>(valueVariant)); auto value = std::get<NTi::TTypePtr>(valueVariant); - Y_VERIFY(value->IsOptional()); + Y_ABORT_UNLESS(value->IsOptional()); value = value->AsOptional()->GetItemType(); auto dict = NTi::Dict(ToTypeV3(key, true), value); if (fieldOptions.MapMode == EProtobufMapMode::OptionalDict) { diff --git a/yt/cpp/mapreduce/interface/serialize.cpp b/yt/cpp/mapreduce/interface/serialize.cpp index ae05d9f50d..8557985069 100644 --- a/yt/cpp/mapreduce/interface/serialize.cpp +++ b/yt/cpp/mapreduce/interface/serialize.cpp @@ -196,7 +196,7 @@ void Serialize(const TColumnSchema& columnSchema, NYson::IYsonConsumer* consumer if (typeV3.IsString()) { result = typeV3.AsString(); } else if (typeV3.IsMap() && typeV3.Size() == 1) { - Y_VERIFY(typeV3["type_name"].IsString(), "invalid type is passed"); + Y_ABORT_UNLESS(typeV3["type_name"].IsString(), "invalid type is passed"); result = typeV3["type_name"].AsString(); } if (result) { diff --git a/yt/cpp/mapreduce/io/proto_table_writer.cpp b/yt/cpp/mapreduce/io/proto_table_writer.cpp index 160ea78f50..955bba26e1 100644 --- a/yt/cpp/mapreduce/io/proto_table_writer.cpp +++ b/yt/cpp/mapreduce/io/proto_table_writer.cpp @@ -167,7 +167,7 @@ void TLenvalProtoTableWriter::AddRow(const Message& row, size_t tableIndex) { ValidateProtoDescriptor(row, tableIndex, Descriptors_, false); - Y_VERIFY(row.GetReflection()->GetUnknownFields(row).empty(), + Y_ABORT_UNLESS(row.GetReflection()->GetUnknownFields(row).empty(), "Message has unknown fields. This probably means bug in client code.\n" "Message: %s", row.DebugString().data()); diff --git a/yt/cpp/mapreduce/raw_client/raw_batch_request.cpp b/yt/cpp/mapreduce/raw_client/raw_batch_request.cpp index 8ede410c38..1568c3d85e 100644 --- a/yt/cpp/mapreduce/raw_client/raw_batch_request.cpp +++ b/yt/cpp/mapreduce/raw_client/raw_batch_request.cpp @@ -592,8 +592,8 @@ TFuture<TMultiTablePartitions> TRawBatchRequest::GetTablePartitions( void TRawBatchRequest::FillParameterList(size_t maxSize, TNode* result, TInstant* nextTry) const { - Y_VERIFY(result); - Y_VERIFY(nextTry); + Y_ABORT_UNLESS(result); + Y_ABORT_UNLESS(nextTry); *nextTry = TInstant(); maxSize = Min(maxSize, BatchItemList_.size()); @@ -626,7 +626,7 @@ void TRawBatchRequest::ParseResponse( TRawBatchRequest* retryBatch, TInstant now) { - Y_VERIFY(retryBatch); + Y_ABORT_UNLESS(retryBatch); EnsureType(node, TNode::List); auto& responseList = node.AsList(); |