aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/unified_agent_client
diff options
context:
space:
mode:
authorilnurkh <ilnurkh@yandex-team.com>2023-10-09 23:39:40 +0300
committerilnurkh <ilnurkh@yandex-team.com>2023-10-09 23:57:14 +0300
commite601ca03f859335d57ecff2e5aa6af234b6052ed (patch)
treede519a847e58a1b3993fcbfe05ff44cc946a3e24 /library/cpp/unified_agent_client
parentbbf2b6878af3854815a2c0ecb07a687071787639 (diff)
downloadydb-e601ca03f859335d57ecff2e5aa6af234b6052ed.tar.gz
Y_VERIFY->Y_ABORT_UNLESS at ^l
https://clubs.at.yandex-team.ru/arcadia/29404
Diffstat (limited to 'library/cpp/unified_agent_client')
-rw-r--r--library/cpp/unified_agent_client/async_joiner.h4
-rw-r--r--library/cpp/unified_agent_client/client_impl.cpp44
-rw-r--r--library/cpp/unified_agent_client/clock.cpp8
-rw-r--r--library/cpp/unified_agent_client/enum.h2
-rw-r--r--library/cpp/unified_agent_client/examples/ua_grpc_client/main.cpp2
-rw-r--r--library/cpp/unified_agent_client/grpc_io.cpp6
6 files changed, 33 insertions, 33 deletions
diff --git a/library/cpp/unified_agent_client/async_joiner.h b/library/cpp/unified_agent_client/async_joiner.h
index ce392ef7bc..23494cc6f7 100644
--- a/library/cpp/unified_agent_client/async_joiner.h
+++ b/library/cpp/unified_agent_client/async_joiner.h
@@ -13,13 +13,13 @@ namespace NUnifiedAgent {
inline i64 Ref(i64 count = 1) noexcept {
const auto result = Refs.fetch_add(count);
- Y_VERIFY(result >= 1, "already joined");
+ Y_ABORT_UNLESS(result >= 1, "already joined");
return result;
}
inline i64 UnRef() noexcept {
const auto prev = Refs.fetch_sub(1);
- Y_VERIFY(prev >= 1);
+ Y_ABORT_UNLESS(prev >= 1);
if (prev == 1) {
auto p = Promise;
p.SetValue();
diff --git a/library/cpp/unified_agent_client/client_impl.cpp b/library/cpp/unified_agent_client/client_impl.cpp
index 31845fab61..17e2cd6b9d 100644
--- a/library/cpp/unified_agent_client/client_impl.cpp
+++ b/library/cpp/unified_agent_client/client_impl.cpp
@@ -67,7 +67,7 @@ namespace NUnifiedAgent::NPrivate {
TClient::~TClient() {
with_lock(Lock) {
- Y_VERIFY(ActiveSessions.empty(), "active sessions found");
+ Y_ABORT_UNLESS(ActiveSessions.empty(), "active sessions found");
EnsureStoppedNoLock();
@@ -106,7 +106,7 @@ namespace NUnifiedAgent::NPrivate {
void TClient::UnregisterSession(TClientSession* session) {
with_lock(Lock) {
const auto it = Find(ActiveSessions, session);
- Y_VERIFY(it != ActiveSessions.end());
+ Y_ABORT_UNLESS(it != ActiveSessions.end());
ActiveSessions.erase(it);
}
}
@@ -213,8 +213,8 @@ namespace NUnifiedAgent::NPrivate {
return;
}
- Y_VERIFY(grpc_is_initialized());
- Y_VERIFY(grpc_core::Fork::Enabled());
+ Y_ABORT_UNLESS(grpc_is_initialized());
+ Y_ABORT_UNLESS(grpc_core::Fork::Enabled());
with_lock(Lock) {
Clients.push_back(&client);
@@ -228,7 +228,7 @@ namespace NUnifiedAgent::NPrivate {
with_lock(Lock) {
const auto it = Find(Clients, &client);
- Y_VERIFY(it != Clients.end());
+ Y_ABORT_UNLESS(it != Clients.end());
Clients.erase(it);
}
}
@@ -418,7 +418,7 @@ namespace NUnifiedAgent::NPrivate {
void TClientSession::DoStart() {
// Lock must be held
- Y_VERIFY(!Started);
+ Y_ABORT_UNLESS(!Started);
YLOG_DEBUG("starting");
Client->EnsureStarted();
@@ -447,7 +447,7 @@ namespace NUnifiedAgent::NPrivate {
}, &AsyncJoiner));
EventNotification = MakeHolder<TGrpcNotification>(Client->GetCompletionQueue(),
MakeIOCallback([this](EIOStatus status) {
- Y_VERIFY(status == EIOStatus::Ok);
+ Y_ABORT_UNLESS(status == EIOStatus::Ok);
Poll();
}, &AsyncJoiner));
@@ -471,8 +471,8 @@ namespace NUnifiedAgent::NPrivate {
YLOG_INFO("MakeGrpcCall, session already closed");
return;
}
- Y_VERIFY(!ForcedCloseStarted);
- Y_VERIFY(!ActiveGrpcCall);
+ Y_ABORT_UNLESS(!ForcedCloseStarted);
+ Y_ABORT_UNLESS(!ActiveGrpcCall);
ActiveGrpcCall = MakeIntrusive<TGrpcCall>(*this);
ActiveGrpcCall->Start();
++Counters->GrpcCalls;
@@ -655,7 +655,7 @@ namespace NUnifiedAgent::NPrivate {
});
if (auto it = begin(batch); it != closeIt) {
- Y_VERIFY(!CloseStarted);
+ Y_ABORT_UNLESS(!CloseStarted);
do {
auto& e = std::get<TMessageReceivedEvent>(*it++);
WriteQueue.push_back({std::move(e.Message), e.Size, false});
@@ -715,7 +715,7 @@ namespace NUnifiedAgent::NPrivate {
TClientSession::TRequestBuilder::TAddResult TClientSession::TRequestBuilder::TryAddMessage(
const TPendingMessage& message, size_t seqNo) {
- Y_VERIFY(!CountersInvalid);
+ Y_ABORT_UNLESS(!CountersInvalid);
{
// add item to pwRequest to increase calculated size
PwTarget->DataBatch.SeqNo.Add(seqNo);
@@ -768,7 +768,7 @@ namespace NUnifiedAgent::NPrivate {
if (it == MetaItems.end()) {
batch.AddMeta()->SetKey(m.first);
auto insertResult = MetaItems.insert({m.first, {batch.MetaSize() - 1}});
- Y_VERIFY(insertResult.second);
+ Y_ABORT_UNLESS(insertResult.second);
metaItemBuilder = &insertResult.first->second;
} else {
metaItemBuilder = &it->second;
@@ -792,7 +792,7 @@ namespace NUnifiedAgent::NPrivate {
}
void TClientSession::PrepareWriteBatchRequest(NUnifiedAgentProto::Request& target) {
- Y_VERIFY(AckSeqNo.Defined());
+ Y_ABORT_UNLESS(AckSeqNo.Defined());
TRequestBuilder requestBuilder(target, Client->GetParameters().GrpcMaxMessageSize, AgentMaxReceiveMessage);
const auto startIndex = NextIndex - TrimmedCount;
for (size_t i = startIndex; i < WriteQueue.size(); ++i) {
@@ -830,7 +830,7 @@ namespace NUnifiedAgent::NPrivate {
if (messagesCount == 0) {
return;
}
- Y_VERIFY(requestBuilder.GetSerializedRequestSize() == target.ByteSizeLong(),
+ Y_ABORT_UNLESS(requestBuilder.GetSerializedRequestSize() == target.ByteSizeLong(),
"failed to calculate size for message [%s]", target.ShortDebugString().c_str());
GrpcInflightMessages += messagesCount;
GrpcInflightBytes += requestBuilder.GetRequestPayloadSize();
@@ -893,8 +893,8 @@ namespace NUnifiedAgent::NPrivate {
}
void TClientSession::OnGrpcCallFinished() {
- Y_VERIFY(!Closed);
- Y_VERIFY(ActiveGrpcCall);
+ Y_ABORT_UNLESS(!Closed);
+ Y_ABORT_UNLESS(ActiveGrpcCall);
ActiveGrpcCall = nullptr;
if (CloseStarted && (ForcedCloseStarted || WriteQueue.empty())) {
DoClose();
@@ -928,9 +928,9 @@ namespace NUnifiedAgent::NPrivate {
}
void TClientSession::DoClose() {
- Y_VERIFY(CloseStarted);
- Y_VERIFY(!Closed);
- Y_VERIFY(!ClosePromise.HasValue());
+ Y_ABORT_UNLESS(CloseStarted);
+ Y_ABORT_UNLESS(!Closed);
+ Y_ABORT_UNLESS(!ClosePromise.HasValue());
MakeGrpcCallTimer->Cancel();
ForceCloseTimer->Cancel();
PollTimer->Cancel();
@@ -1091,7 +1091,7 @@ namespace NUnifiedAgent::NPrivate {
}
void TGrpcCall::EndAccept(EIOStatus status) {
- Y_VERIFY(AcceptPending);
+ Y_ABORT_UNLESS(AcceptPending);
AcceptPending = false;
if (CheckHasError(status, "EndAccept")) {
return;
@@ -1109,7 +1109,7 @@ namespace NUnifiedAgent::NPrivate {
return;
}
if (!ErrorOccured && status == EIOStatus::Error && WritesBlocked) {
- Y_VERIFY(!WritePending);
+ Y_ABORT_UNLESS(!WritePending);
YLOG_DEBUG("EndRead ReadsDone");
ReadsDone = true;
if (WritesDone) {
@@ -1189,7 +1189,7 @@ namespace NUnifiedAgent::NPrivate {
void TGrpcCall::EndWritesDone(EIOStatus status) {
YLOG_DEBUG(Sprintf("EndWritesDone [%s]", ToString(status).c_str()));
- Y_VERIFY(!WritePending && !WritesDone && WritesDonePending);
+ Y_ABORT_UNLESS(!WritePending && !WritesDone && WritesDonePending);
WritesDonePending = false;
WritesDone = true;
if (CheckHasError(status, "EndWriteDone")) {
diff --git a/library/cpp/unified_agent_client/clock.cpp b/library/cpp/unified_agent_client/clock.cpp
index 192c998a02..9c0e59c20e 100644
--- a/library/cpp/unified_agent_client/clock.cpp
+++ b/library/cpp/unified_agent_client/clock.cpp
@@ -2,13 +2,13 @@
namespace NUnifiedAgent {
void TClock::Configure() {
- Y_VERIFY(!Configured_);
+ Y_ABORT_UNLESS(!Configured_);
Configured_ = true;
}
void TClock::SetBase(TInstant value) {
- Y_VERIFY(Configured_);
+ Y_ABORT_UNLESS(Configured_);
Base_.store(value.GetValue());
}
@@ -18,13 +18,13 @@ namespace NUnifiedAgent {
}
void TClock::ResetBaseWithShift() {
- Y_VERIFY(Configured_);
+ Y_ABORT_UNLESS(Configured_);
Shift_.store(static_cast<i64>(Base_.exchange(0)) - static_cast<i64>(::Now().GetValue()));
}
void TClock::SetShift(TDuration value) {
- Y_VERIFY(Configured_);
+ Y_ABORT_UNLESS(Configured_);
Shift_.fetch_add(value.GetValue());
}
diff --git a/library/cpp/unified_agent_client/enum.h b/library/cpp/unified_agent_client/enum.h
index ad08efb723..1eef790819 100644
--- a/library/cpp/unified_agent_client/enum.h
+++ b/library/cpp/unified_agent_client/enum.h
@@ -13,7 +13,7 @@ namespace NUnifiedAgent {
TEnumNames* result = new TEnumNames(names.size());
size_t index = 0;
for (const auto& p: names) {
- Y_VERIFY(static_cast<size_t>(p.first) == index);
+ Y_ABORT_UNLESS(static_cast<size_t>(p.first) == index);
(*result)[index++] = &p.second;
}
return result;
diff --git a/library/cpp/unified_agent_client/examples/ua_grpc_client/main.cpp b/library/cpp/unified_agent_client/examples/ua_grpc_client/main.cpp
index a9eb423d13..8f247cf9ad 100644
--- a/library/cpp/unified_agent_client/examples/ua_grpc_client/main.cpp
+++ b/library/cpp/unified_agent_client/examples/ua_grpc_client/main.cpp
@@ -59,7 +59,7 @@ bool TryParseMeta(const TString& s, THashMap<TString, TString>& meta) {
bool TryParseLine(const TString& line, TVector<TString>& lineItems) {
lineItems = StringSplitter(line).Split('|').ToList<TString>();
- Y_VERIFY(lineItems.size() >= 1);
+ Y_ABORT_UNLESS(lineItems.size() >= 1);
if (lineItems.size() > 2) {
Cout << "invalid line format, expected 'k1=v1,k2=v2|payload' or just 'payload'" << Endl;
return false;
diff --git a/library/cpp/unified_agent_client/grpc_io.cpp b/library/cpp/unified_agent_client/grpc_io.cpp
index b59cfb674a..569e04dde8 100644
--- a/library/cpp/unified_agent_client/grpc_io.cpp
+++ b/library/cpp/unified_agent_client/grpc_io.cpp
@@ -36,10 +36,10 @@ namespace NUnifiedAgent {
grpc_core::ApplicationCallbackExecCtx callbackExecCtx;
grpc_core::ExecCtx execCtx;
IOCallback->Ref();
- Y_VERIFY(grpc_cq_begin_op(CompletionQueue.cq(), this));
+ Y_ABORT_UNLESS(grpc_cq_begin_op(CompletionQueue.cq(), this));
grpc_cq_end_op(CompletionQueue.cq(), this, y_absl::OkStatus(),
[](void* self, grpc_cq_completion*) {
- Y_VERIFY(static_cast<TGrpcNotification*>(self)->InQueue.exchange(false));
+ Y_ABORT_UNLESS(static_cast<TGrpcNotification*>(self)->InQueue.exchange(false));
},
this, Completion.Get());
}
@@ -81,7 +81,7 @@ namespace NUnifiedAgent {
}
void TGrpcTimer::OnIOCompleted(EIOStatus status) {
- Y_VERIFY(AlarmIsSet);
+ Y_ABORT_UNLESS(AlarmIsSet);
if (NextTriggerTime) {
Alarm.Set(&CompletionQueue, InstantToTimespec(*NextTriggerTime), this);
NextTriggerTime.Clear();