diff options
author | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-17 16:00:27 +0300 |
---|---|---|
committer | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-17 16:52:11 +0300 |
commit | 370361b9e5649ee21ee34d73fec19194657629e0 (patch) | |
tree | 1d4b80f794a3dc9592d5a98385ceb5ceccdc83c3 | |
parent | 75a44bce0d6f80863c71b1f16a97f85daf56bb93 (diff) | |
download | ydb-370361b9e5649ee21ee34d73fec19194657629e0.tar.gz |
Y_VERIFY_DEBUG->Y_DEBUG_ABORT_UNLESS at '^y'
https://clubs.at.yandex-team.ru/arcadia/29404
27 files changed, 202 insertions, 202 deletions
diff --git a/ydb/core/blobstorage/base/utility.h b/ydb/core/blobstorage/base/utility.h index afb519dcb8..7643f43fd4 100644 --- a/ydb/core/blobstorage/base/utility.h +++ b/ydb/core/blobstorage/base/utility.h @@ -88,7 +88,7 @@ namespace NKikimr { } void DecrementUndertakerCounter(const TActorContext &ctx) { - Y_VERIFY_DEBUG(UndertakerCounter > 0); + Y_DEBUG_ABORT_UNLESS(UndertakerCounter > 0); --UndertakerCounter; UndertakerCheckToDie(ctx); } diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_sector.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_sector.h index 45369a7a34..f0e7ad323c 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_sector.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_sector.h @@ -49,17 +49,17 @@ public: } TDataSectorFooter *GetDataFooter() { - Y_VERIFY_DEBUG(Size() >= sizeof(TDataSectorFooter)); + Y_DEBUG_ABORT_UNLESS(Size() >= sizeof(TDataSectorFooter)); return (TDataSectorFooter*) (End() - sizeof(TDataSectorFooter)); } ui64 GetCanary() const { - Y_VERIFY_DEBUG(Size() >= sizeof(TDataSectorFooter) + CanarySize); + Y_DEBUG_ABORT_UNLESS(Size() >= sizeof(TDataSectorFooter) + CanarySize); return ReadUnaligned<ui64>(End() - sizeof(TDataSectorFooter) - CanarySize); } void SetCanary(ui64 canary = NPDisk::Canary) { - Y_VERIFY_DEBUG(Size() >= sizeof(TDataSectorFooter) + CanarySize); + Y_DEBUG_ABORT_UNLESS(Size() >= sizeof(TDataSectorFooter) + CanarySize); WriteUnaligned<ui64>(End() - sizeof(TDataSectorFooter) - CanarySize, canary); } diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp index 9fe732040d..5bbe4c38a6 100644 --- a/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp @@ -914,7 +914,7 @@ protected: } bool GetCachedConfig(NKikimrConfig::TAppConfig &appConfig) { - Y_VERIFY_DEBUG(RunConfig.PathToConfigCacheFile, "GetCachedConfig called with a cms config cache file set"); + Y_DEBUG_ABORT_UNLESS(RunConfig.PathToConfigCacheFile, "GetCachedConfig called with a cms config cache file set"); try { auto cacheFile = TFileInput(RunConfig.PathToConfigCacheFile); @@ -1281,7 +1281,7 @@ protected: } bool SaveConfigForNodeToCache(const NKikimrConfig::TAppConfig &appConfig) { - Y_VERIFY_DEBUG(RunConfig.PathToConfigCacheFile, "SaveConfigForNodeToCache called without a cms config cache file set"); + Y_DEBUG_ABORT_UNLESS(RunConfig.PathToConfigCacheFile, "SaveConfigForNodeToCache called without a cms config cache file set"); // Ensure "atomicity" by writing to temp file and renaming it const TString pathToTempFile = RunConfig.PathToConfigCacheFile + ".tmp"; diff --git a/ydb/core/tablet_flat/util_fmt_cell.h b/ydb/core/tablet_flat/util_fmt_cell.h index f530b06d36..e4dcddab1f 100644 --- a/ydb/core/tablet_flat/util_fmt_cell.h +++ b/ydb/core/tablet_flat/util_fmt_cell.h @@ -13,7 +13,7 @@ public: : Cells(cells) , Types(types) { - Y_VERIFY_DEBUG(Cells.size() <= Types.size()); + Y_DEBUG_ABORT_UNLESS(Cells.size() <= Types.size()); } friend IOutputStream& operator<<(IOutputStream& out, const TPrintableTypedCells& v) { diff --git a/ydb/core/tablet_flat/util_pool.h b/ydb/core/tablet_flat/util_pool.h index eb939fb6d0..fa763e4769 100644 --- a/ydb/core/tablet_flat/util_pool.h +++ b/ydb/core/tablet_flat/util_pool.h @@ -25,8 +25,8 @@ namespace NKikimr::NUtil { TChunk(size_t size) noexcept : Next(nullptr) { - Y_VERIFY_DEBUG((((uintptr_t)this) % PLATFORM_DATA_ALIGN) == 0); - Y_VERIFY_DEBUG(size >= ChunkHeaderSize()); + Y_DEBUG_ABORT_UNLESS((((uintptr_t)this) % PLATFORM_DATA_ALIGN) == 0); + Y_DEBUG_ABORT_UNLESS(size >= ChunkHeaderSize()); Ptr = DataStart(); Left = size - ChunkHeaderSize(); } @@ -209,7 +209,7 @@ namespace NKikimr::NUtil { Used_ += Current->Used(); Wasted_ += Current->Wasted(); Current = Current->Next; - Y_VERIFY_DEBUG(Current->Ptr == Current->DataStart()); + Y_DEBUG_ABORT_UNLESS(Current->Ptr == Current->DataStart()); Wasted_ -= Current->ChunkSize(); Available_ -= Current->Left; return true; diff --git a/ydb/core/tablet_flat/util_store.h b/ydb/core/tablet_flat/util_store.h index ae7694c1b2..fe5f1378c4 100644 --- a/ydb/core/tablet_flat/util_store.h +++ b/ydb/core/tablet_flat/util_store.h @@ -76,7 +76,7 @@ namespace NUtil { Head = Head->Next.load(std::memory_order_acquire); } - Y_VERIFY_DEBUG(Head && Head->Offset <= Offset && Offset < Head->EndOffset(), + Y_DEBUG_ABORT_UNLESS(Head && Head->Offset <= Offset && Offset < Head->EndOffset(), "Unexpected failure to find chunk for offset %" PRISZT, Offset); return true; @@ -92,8 +92,8 @@ namespace NUtil { private: const T* GetPtr() const noexcept { - Y_VERIFY_DEBUG(IsValid()); - Y_VERIFY_DEBUG(Head->Offset <= Offset && Offset < Head->EndOffset()); + Y_DEBUG_ABORT_UNLESS(IsValid()); + Y_DEBUG_ABORT_UNLESS(Head->Offset <= Offset && Offset < Head->EndOffset()); return Head->Values() + (Offset - Head->Offset); } @@ -205,7 +205,7 @@ namespace NUtil { * Returns non thread-safe mutable reference, complexity is O(logN) */ T& operator[](size_t index) { - Y_VERIFY_DEBUG(index < Count.load(std::memory_order_relaxed)); + Y_DEBUG_ABORT_UNLESS(index < Count.load(std::memory_order_relaxed)); return *FindPtr(Tail.load(std::memory_order_relaxed), index); } @@ -214,7 +214,7 @@ namespace NUtil { * Returns a thread-safe immutable reference, complexity is O(logN) */ const T& operator[](size_t index) const { - Y_VERIFY_DEBUG(index < size()); + Y_DEBUG_ABORT_UNLESS(index < size()); return *FindPtr(Tail.load(std::memory_order_acquire), index); } @@ -238,9 +238,9 @@ namespace NUtil { } do { - Y_VERIFY_DEBUG(tail); + Y_DEBUG_ABORT_UNLESS(tail); auto endOffset = tail->EndOffset(); - Y_VERIFY_DEBUG(tail->Offset <= index && index < endOffset); + Y_DEBUG_ABORT_UNLESS(tail->Offset <= index && index < endOffset); T* values = tail->Values() + (index - tail->Offset); while (index < endOffset && index < endIndex) { callback(index, *values); @@ -260,7 +260,7 @@ namespace NUtil { tail = tail->Prev; } - Y_VERIFY_DEBUG(tail && index < tail->EndOffset()); + Y_DEBUG_ABORT_UNLESS(tail && index < tail->EndOffset()); return tail->Values() + (index - tail->Offset); } diff --git a/ydb/core/util/btree.h b/ydb/core/util/btree.h index 2e87d3d358..96c99b4ebd 100644 --- a/ydb/core/util/btree.h +++ b/ydb/core/util/btree.h @@ -47,7 +47,7 @@ namespace NKikimr { TTag(TInnerPage* page) : Value(uintptr_t(page) | uintptr_t(1)) { - Y_VERIFY_DEBUG(page, "Inner page cannot be null"); + Y_DEBUG_ABORT_UNLESS(page, "Inner page cannot be null"); } explicit operator bool() const { @@ -83,12 +83,12 @@ namespace NKikimr { } TLeafPage* ToLeafPage() const { - Y_VERIFY_DEBUG(!Value || IsLeafPage()); + Y_DEBUG_ABORT_UNLESS(!Value || IsLeafPage()); return (TLeafPage*)(Value & ~uintptr_t(1)); } TInnerPage* ToInnerPage() const { - Y_VERIFY_DEBUG(!Value || IsInnerPage()); + Y_DEBUG_ABORT_UNLESS(!Value || IsInnerPage()); return (TInnerPage*)(Value & ~uintptr_t(1)); } @@ -250,10 +250,10 @@ namespace NKikimr { void* raw = Allocator.Allocate(PageSize); FreeRawPage(raw); ++TotalPagesCount; - Y_VERIFY_DEBUG(FreePages); + Y_DEBUG_ABORT_UNLESS(FreePages); } - Y_VERIFY_DEBUG(FreePagesCount > 0); + Y_DEBUG_ABORT_UNLESS(FreePagesCount > 0); --FreePagesCount; TFreePage* page = FreePages; FreePages = page->Next; @@ -267,7 +267,7 @@ namespace NKikimr { } void FreeLeafPage(TLeafPage* leaf) noexcept { - Y_VERIFY_DEBUG(leaf->RefCount == 0); + Y_DEBUG_ABORT_UNLESS(leaf->RefCount == 0); auto count = leaf->UnsafeCount(); if (!TTypeTraits<TKey>::IsPod) { auto* keys = leaf->Keys(); @@ -293,7 +293,7 @@ namespace NKikimr { } void FreeInnerPage(TInnerPage* inner) noexcept { - Y_VERIFY_DEBUG(inner->RefCount == 0); + Y_DEBUG_ABORT_UNLESS(inner->RefCount == 0); auto count = inner->Count; if (!TTypeTraits<TKey>::IsPod) { auto* keys = inner->Keys(); @@ -322,7 +322,7 @@ namespace NKikimr { void UnRefTag(TTag tag) { if (tag) { auto* page = tag.ToPage(); - Y_VERIFY_DEBUG(page->RefCount > 0); + Y_DEBUG_ABORT_UNLESS(page->RefCount > 0); if (--page->RefCount == 0) { RetireList.push_back(tag); MoreGarbage = true; @@ -379,14 +379,14 @@ namespace NKikimr { // N.B. by the MaxGarbage invariant we should have freed at least 25% of the retire list if (MoreGarbage) { - Y_VERIFY_DEBUG(RetireList.size() > endPos); + Y_DEBUG_ABORT_UNLESS(RetireList.size() > endPos); if (Y_LIKELY(writePos != readPos)) { while (readPos != RetireList.size()) { RetireList[writePos++] = RetireList[readPos++]; } } } else { - Y_VERIFY_DEBUG(RetireList.size() == endPos); + Y_DEBUG_ABORT_UNLESS(RetireList.size() == endPos); } RetireList.resize(writePos); @@ -546,7 +546,7 @@ namespace NKikimr { Y_ABORT_UNLESS(Tree, "Uninitialized iterator"); auto* page = Tree->First.Follow(CurrentPointer).ToLeafPage(); - Y_VERIFY_DEBUG(page, "Tree is missing the first page"); + Y_DEBUG_ABORT_UNLESS(page, "Tree is missing the first page"); auto count = page->SafeCount(); if (count == 0) { // The tree is empty @@ -565,7 +565,7 @@ namespace NKikimr { Y_ABORT_UNLESS(Tree, "Uninitialized iterator"); auto* page = Tree->Last.Follow(CurrentPointer).ToLeafPage(); - Y_VERIFY_DEBUG(page, "Tree is missing the last page"); + Y_DEBUG_ABORT_UNLESS(page, "Tree is missing the last page"); auto count = page->SafeCount(); if (count == 0) { // The tree is empty @@ -701,7 +701,7 @@ namespace NKikimr { } bool Prev() { - Y_VERIFY_DEBUG(IsValid()); + Y_DEBUG_ABORT_UNLESS(IsValid()); if (CurrentIndex > 0) { // We have more keys on the current page @@ -713,7 +713,7 @@ namespace NKikimr { } bool Next() { - Y_VERIFY_DEBUG(IsValid()); + Y_DEBUG_ABORT_UNLESS(IsValid()); if (++CurrentIndex < CurrentCount) { // We have more keys on the current page @@ -728,13 +728,13 @@ namespace NKikimr { } const TKey& GetKey() const { - Y_VERIFY_DEBUG(IsValid()); + Y_DEBUG_ABORT_UNLESS(IsValid()); return CurrentPage->Keys()[CurrentIndex]; } const TValue& GetValue() const { - Y_VERIFY_DEBUG(IsValid()); + Y_DEBUG_ABORT_UNLESS(IsValid()); return CurrentPage->Values()[CurrentIndex]; } @@ -752,7 +752,7 @@ namespace NKikimr { return false; } index = count = page->SafeCount(); - Y_VERIFY_DEBUG(count > 0, "Unexpected empty prev page"); + Y_DEBUG_ABORT_UNLESS(count > 0, "Unexpected empty prev page"); CurrentPointer = std::move(prevPointer); } CurrentPage = page; @@ -774,7 +774,7 @@ namespace NKikimr { } index = 0; count = page->SafeCount(); - Y_VERIFY_DEBUG(count > 0, "Unexpected empty next page"); + Y_DEBUG_ABORT_UNLESS(count > 0, "Unexpected empty next page"); CurrentPointer = std::move(nextPointer); } CurrentPage = page; @@ -838,11 +838,11 @@ namespace NKikimr { TValue* FindPtr(TKeyArg&& key) { InsertPath.clear(); auto current = Root.GetUnsafe(); - Y_VERIFY_DEBUG(current); + Y_DEBUG_ABORT_UNLESS(current); while (current.IsInnerPage()) { auto* inner = current.ToInnerPage(); auto count = inner->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); auto* keysBegin = inner->Keys(); auto* keysEnd = keysBegin + count; size_t index = std::upper_bound(keysBegin, keysEnd, key, key_comp()) - keysBegin; @@ -887,7 +887,7 @@ namespace NKikimr { // in the future without adjusting inner keys accordingly, then // this code path should produce correct results. count = leaf->UnsafeCount(); - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); index = count - 1; } @@ -953,7 +953,7 @@ namespace NKikimr { if (!newInner.Left) { // Insert has been performed inplace, that means we have no readers // Publish new leaf nodes, which is safe to do out of order - Y_VERIFY_DEBUG(!threadSafe); + Y_DEBUG_ABORT_UNLESS(!threadSafe); ReplaceLeafNode(leaf, newLeaf.Left, newLeaf.Right); InsertPath.clear(); CollectGarbage(); @@ -966,7 +966,7 @@ namespace NKikimr { } } - Y_VERIFY_DEBUG(currentLeft == currentRight); + Y_DEBUG_ABORT_UNLESS(currentLeft == currentRight); // Publish new leaf nodes first, so it becomes available in sequential iteration ReplaceLeafNode(leaf, newLeaf.Left, newLeaf.Right); @@ -1012,7 +1012,7 @@ namespace NKikimr { auto current = Root.GetUnsafe(); while (current.IsInnerPage()) { auto* page = current.ToInnerPage(); - Y_VERIFY_DEBUG(page->Count > 0); + Y_DEBUG_ABORT_UNLESS(page->Count > 0); current = page->Edges()[0].GetUnsafe(); ++height; } @@ -1033,7 +1033,7 @@ namespace NKikimr { bool threadSafe) { const size_t count = leaf->UnsafeCount(); - Y_VERIFY_DEBUG(index <= count); + Y_DEBUG_ABORT_UNLESS(index <= count); const size_t newCount = count + 1; // We don't expect any split @@ -1103,7 +1103,7 @@ namespace NKikimr { const size_t rightCount = newCount / 2; // we want less on the right leaf const size_t leftCount = newCount - rightCount; // we want more on the left leaf - Y_VERIFY_DEBUG(leftCount > 0 && rightCount > 0); + Y_DEBUG_ABORT_UNLESS(leftCount > 0 && rightCount > 0); auto* newLeft = AllocateLeafPage(); auto* newRight = AllocateLeafPage(); @@ -1184,7 +1184,7 @@ namespace NKikimr { return Middle; } } - Y_VERIFY_DEBUG(Current != End); + Y_DEBUG_ABORT_UNLESS(Current != End); return Current++; } @@ -1205,7 +1205,7 @@ namespace NKikimr { , Replacements{ left, right } , NextReplacement(0) { - Y_VERIFY_DEBUG(Skipped != End); + Y_DEBUG_ABORT_UNLESS(Skipped != End); } TTag Read() { @@ -1215,7 +1215,7 @@ namespace NKikimr { } ++Current; } - Y_VERIFY_DEBUG(Current != End); + Y_DEBUG_ABORT_UNLESS(Current != End); return (Current++)->GetUnsafe(); } @@ -1228,7 +1228,7 @@ namespace NKikimr { }; const size_t count = inner->Count; - Y_VERIFY_DEBUG(index <= count); + Y_DEBUG_ABORT_UNLESS(index <= count); const size_t newCount = count + 1; if (newCount <= InnerPageCapacity && !threadSafe) { @@ -1350,7 +1350,7 @@ namespace NKikimr { UnRefTag(Last.SwapUnsafe({ })); CollectGarbage(true); - Y_VERIFY_DEBUG(FreePagesCount == TotalPagesCount, + Y_DEBUG_ABORT_UNLESS(FreePagesCount == TotalPagesCount, "BTree has %" PRISZT " out of %" PRISZT " pages leaked", TotalPagesCount - FreePagesCount, TotalPagesCount); } diff --git a/ydb/core/util/btree_cow.h b/ydb/core/util/btree_cow.h index 78f1aa9f7c..70831ee6e1 100644 --- a/ydb/core/util/btree_cow.h +++ b/ydb/core/util/btree_cow.h @@ -111,12 +111,12 @@ namespace NKikimr { } static TLeafPage* From(TPage* page) { - Y_VERIFY_DEBUG(page && page->GetTag() == ETag::Leaf); + Y_DEBUG_ABORT_UNLESS(page && page->GetTag() == ETag::Leaf); return static_cast<TLeafPage*>(page); } static const TLeafPage* From(const TPage* page) { - Y_VERIFY_DEBUG(page && page->GetTag() == ETag::Leaf); + Y_DEBUG_ABORT_UNLESS(page && page->GetTag() == ETag::Leaf); return static_cast<const TLeafPage*>(page); } @@ -152,12 +152,12 @@ namespace NKikimr { } static TInnerPage* From(TPage* page) { - Y_VERIFY_DEBUG(page && page->GetTag() == ETag::Inner); + Y_DEBUG_ABORT_UNLESS(page && page->GetTag() == ETag::Inner); return static_cast<TInnerPage*>(page); } static const TInnerPage* From(const TPage* page) { - Y_VERIFY_DEBUG(page && page->GetTag() == ETag::Inner); + Y_DEBUG_ABORT_UNLESS(page && page->GetTag() == ETag::Inner); return static_cast<const TInnerPage*>(page); } @@ -232,10 +232,10 @@ namespace NKikimr { } void LinkAfter(TSnapshotContext* last) { - Y_VERIFY_DEBUG(this != last); - Y_VERIFY_DEBUG(Prev == nullptr && Next == nullptr); + Y_DEBUG_ABORT_UNLESS(this != last); + Y_DEBUG_ABORT_UNLESS(Prev == nullptr && Next == nullptr); if (last) { - Y_VERIFY_DEBUG(last->Next == nullptr); + Y_DEBUG_ABORT_UNLESS(last->Next == nullptr); Prev = last; last->Next = this; } @@ -253,7 +253,7 @@ namespace NKikimr { } void AddDroppedPage(TPage* page) { - Y_VERIFY_DEBUG(page->NextDroppedPage == nullptr); + Y_DEBUG_ABORT_UNLESS(page->NextDroppedPage == nullptr); page->NextDroppedPage = LastDroppedPage; LastDroppedPage = page; } @@ -299,9 +299,9 @@ namespace NKikimr { , Context(context) , GCList(std::move(gcList)) { - Y_VERIFY_DEBUG(Tree && Context && GCList, "Explicit constructor got unexpected values"); + Y_DEBUG_ABORT_UNLESS(Tree && Context && GCList, "Explicit constructor got unexpected values"); const size_t count = Context->Ref(); - Y_VERIFY_DEBUG(count == 1, "Explicit constructor must be the first reference"); + Y_DEBUG_ABORT_UNLESS(count == 1, "Explicit constructor must be the first reference"); } explicit TTreeHandle(const TCowBTree* tree) noexcept @@ -327,9 +327,9 @@ namespace NKikimr { , GCList(rhs.GCList) { if (Tree && Context) { - Y_VERIFY_DEBUG(GCList, "Handle fields are out of sync"); + Y_DEBUG_ABORT_UNLESS(GCList, "Handle fields are out of sync"); const size_t count = Context->Ref(); - Y_VERIFY_DEBUG(count > 1, "Unexpected refcount in copy constructor"); + Y_DEBUG_ABORT_UNLESS(count > 1, "Unexpected refcount in copy constructor"); } } @@ -345,7 +345,7 @@ namespace NKikimr { void Reset() noexcept { if (Tree) { if (Context) { - Y_VERIFY_DEBUG(GCList, "Handle fields are out of sync"); + Y_DEBUG_ABORT_UNLESS(GCList, "Handle fields are out of sync"); TSnapshotContext* context = std::exchange(Context, nullptr); TIntrusivePtr<TSnapshotGCList> gcList = std::move(GCList); if (context->UnRef() == 0) { @@ -363,9 +363,9 @@ namespace NKikimr { Context = rhs.Context; GCList = rhs.GCList; if (Tree && Context) { - Y_VERIFY_DEBUG(GCList, "Handle fields are out of sync"); + Y_DEBUG_ABORT_UNLESS(GCList, "Handle fields are out of sync"); const size_t count = Context->Ref(); - Y_VERIFY_DEBUG(count > 1, "Unexpected refcount in copy assignment"); + Y_DEBUG_ABORT_UNLESS(count > 1, "Unexpected refcount in copy assignment"); } } @@ -445,7 +445,7 @@ namespace NKikimr { const auto* page = FollowLeftMost(Root); const size_t count = page->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); CurrentPage = page; CurrentIndex = 0; @@ -466,7 +466,7 @@ namespace NKikimr { const auto* page = FollowRightMost(Root); const size_t count = page->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); CurrentPage = page; CurrentIndex = count - 1; @@ -495,19 +495,19 @@ namespace NKikimr { while (current->GetTag() == ETag::Inner) { const auto* inner = TInnerPage::From(current); const size_t count = inner->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); auto* keysBegin = inner->Keys(); auto* keysEnd = keysBegin + count; size_t index = std::lower_bound(keysBegin, keysEnd, key, Tree->key_comp()) - keysBegin; // Follow the left edge, which includes keys <= our search key Path.push_back(TEntry{ inner, index }); current = inner->Edges()[index]; - Y_VERIFY_DEBUG(current); + Y_DEBUG_ABORT_UNLESS(current); } const auto* page = TLeafPage::From(current); const size_t count = page->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); auto* keysBegin = page->Keys(); auto* keysEnd = keysBegin + count; @@ -540,19 +540,19 @@ namespace NKikimr { while (current->GetTag() == ETag::Inner) { const auto* inner = TInnerPage::From(current); const size_t count = inner->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); auto* keysBegin = inner->Keys(); auto* keysEnd = keysBegin + count; size_t index = std::upper_bound(keysBegin, keysEnd, key, Tree->key_comp()) - keysBegin; // Follow the left edge, which includes keys >= our search key Path.push_back(TEntry{ inner, index }); current = inner->Edges()[index]; - Y_VERIFY_DEBUG(current); + Y_DEBUG_ABORT_UNLESS(current); } const auto* page = TLeafPage::From(current); const size_t count = page->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); auto* keysBegin = page->Keys(); auto* keysEnd = keysBegin + count; @@ -603,7 +603,7 @@ namespace NKikimr { } bool Prev() { - Y_VERIFY_DEBUG(IsValid()); + Y_DEBUG_ABORT_UNLESS(IsValid()); if (CurrentIndex > 0) { // We have more keys on the current page @@ -615,7 +615,7 @@ namespace NKikimr { } bool Next() { - Y_VERIFY_DEBUG(IsValid()); + Y_DEBUG_ABORT_UNLESS(IsValid()); if (++CurrentIndex < CurrentCount) { // We have more keys on the current page @@ -630,13 +630,13 @@ namespace NKikimr { } const TKey& GetKey() const { - Y_VERIFY_DEBUG(IsValid()); + Y_DEBUG_ABORT_UNLESS(IsValid()); return CurrentPage->Keys()[CurrentIndex]; } const TValue& GetValue() const { - Y_VERIFY_DEBUG(IsValid()); + Y_DEBUG_ABORT_UNLESS(IsValid()); return CurrentPage->Values()[CurrentIndex]; } @@ -652,28 +652,28 @@ namespace NKikimr { private: const TLeafPage* FollowLeftMost(const TPage* current) { - Y_VERIFY_DEBUG(current); + Y_DEBUG_ABORT_UNLESS(current); while (current->GetTag() == ETag::Inner) { const auto* inner = TInnerPage::From(current); const size_t count = inner->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); Path.push_back(TEntry{ inner, 0 }); current = inner->Edges()[0]; - Y_VERIFY_DEBUG(current); + Y_DEBUG_ABORT_UNLESS(current); } return TLeafPage::From(current); } const TLeafPage* FollowRightMost(const TPage* current) { - Y_VERIFY_DEBUG(current); + Y_DEBUG_ABORT_UNLESS(current); while (current->GetTag() == ETag::Inner) { const auto* inner = TInnerPage::From(current); const size_t count = inner->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); Path.push_back(TEntry{ inner, count }); current = inner->Edges()[count]; - Y_VERIFY_DEBUG(current); + Y_DEBUG_ABORT_UNLESS(current); } return TLeafPage::From(current); @@ -719,7 +719,7 @@ namespace NKikimr { return false; } index = count = page->Count; - Y_VERIFY_DEBUG(count > 0, "Unexpected empty prev page"); + Y_DEBUG_ABORT_UNLESS(count > 0, "Unexpected empty prev page"); } CurrentPage = page; CurrentIndex = index - 1; @@ -738,7 +738,7 @@ namespace NKikimr { } index = 0; count = page->Count; - Y_VERIFY_DEBUG(count > 0, "Unexpected empty next page"); + Y_DEBUG_ABORT_UNLESS(count > 0, "Unexpected empty next page"); } CurrentPage = page; CurrentIndex = index; @@ -849,8 +849,8 @@ namespace NKikimr { Root = nullptr; } - Y_VERIFY_DEBUG(DroppedPages_ == 0, "Unexpected dropped pages at destructor"); - Y_VERIFY_DEBUG(AllocatedPages_ == 0, "Unexpected allocated pages at destructor"); + Y_DEBUG_ABORT_UNLESS(DroppedPages_ == 0, "Unexpected dropped pages at destructor"); + Y_DEBUG_ABORT_UNLESS(AllocatedPages_ == 0, "Unexpected allocated pages at destructor"); } const TCompare& key_comp() const { @@ -875,7 +875,7 @@ namespace NKikimr { void CollectGarbage() { if (auto* garbage = GCList->CollectDroppedSnapshots()) { do { - Y_VERIFY_DEBUG(garbage->RefCount() == 0); + Y_DEBUG_ABORT_UNLESS(garbage->RefCount() == 0); THolder<TSnapshotContext> context(garbage); garbage = std::exchange(context->NextDroppedSnapshot, nullptr); DropSnapshot(context.Get()); @@ -945,7 +945,7 @@ namespace NKikimr { while (TPage* page = *nextDropped) { if (page->Epoch <= epoch) { // Remove it from the list of dropped pages - Y_VERIFY_DEBUG(DroppedPages_ > 0); + Y_DEBUG_ABORT_UNLESS(DroppedPages_ > 0); *nextDropped = page->NextDroppedPage; page->NextDroppedPage = nullptr; --DroppedPages_; @@ -1008,19 +1008,19 @@ namespace NKikimr { while (current->GetTag() == ETag::Inner) { auto* inner = TInnerPage::From(current); size_t count = inner->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); auto* keysBegin = inner->Keys(); auto* keysEnd = keysBegin + count; size_t index = std::upper_bound(keysBegin, keysEnd, key, key_comp()) - keysBegin; // We follow the left edge, towards the first entry > search key InsertPath.push_back(TInsertPath{ current, index }); current = inner->Edges()[index]; - Y_VERIFY_DEBUG(current); + Y_DEBUG_ABORT_UNLESS(current); } auto* leaf = TLeafPage::From(current); size_t count = leaf->Count; - Y_VERIFY_DEBUG(count > 0); + Y_DEBUG_ABORT_UNLESS(count > 0); // Insert position is before the upper bound auto* keysBegin = leaf->Keys(); auto* keysEnd = keysBegin + count; @@ -1036,7 +1036,7 @@ namespace NKikimr { // index == 0 on a leaf page, is if search key is less than // all already existing keys. for (const auto& path : InsertPath) { - Y_VERIFY_DEBUG(path.Index == 0); + Y_DEBUG_ABORT_UNLESS(path.Index == 0); } return nullptr; } @@ -1059,8 +1059,8 @@ namespace NKikimr { TValue* UpdateUnsafe() { CollectGarbage(); - Y_VERIFY_DEBUG(PagesToDrop.empty()); - Y_VERIFY_DEBUG(KeysToDrop.empty()); + Y_DEBUG_ABORT_UNLESS(PagesToDrop.empty()); + Y_DEBUG_ABORT_UNLESS(KeysToDrop.empty()); Y_ABORT_UNLESS(!InsertPath.empty() && InsertPath.back().Page->GetTag() == ETag::Leaf); TLeafPage* const leaf = TLeafPage::From(InsertPath.back().Page); @@ -1091,12 +1091,12 @@ namespace NKikimr { TValue* EmplaceUnsafe(TKeyArg&& key, TValueArgs&&... valueArgs) { CollectGarbage(); - Y_VERIFY_DEBUG(PagesToDrop.empty()); - Y_VERIFY_DEBUG(KeysToDrop.empty()); + Y_DEBUG_ABORT_UNLESS(PagesToDrop.empty()); + Y_DEBUG_ABORT_UNLESS(KeysToDrop.empty()); if (!Root) { // First value for an empty tree, create a new leaf page - Y_VERIFY_DEBUG(InsertPath.empty()); + Y_DEBUG_ABORT_UNLESS(InsertPath.empty()); TLeafPage* const newRoot = NewLeafPage(); new (newRoot->Keys()) TKey(std::forward<TKeyArg>(key)); new (newRoot->Values()) TValue(std::forward<TValueArgs>(valueArgs)...); @@ -1156,7 +1156,7 @@ namespace NKikimr { currentMiddle = newInner.Middle; } - Y_VERIFY_DEBUG(currentLeft == currentRight); + Y_DEBUG_ABORT_UNLESS(currentLeft == currentRight); if (currentLeft) { PropagateReplace(currentLeft); @@ -1164,7 +1164,7 @@ namespace NKikimr { PropagateEpoch(); PropagateDrop(); - Y_VERIFY_DEBUG(InsertPath.empty()); + Y_DEBUG_ABORT_UNLESS(InsertPath.empty()); ++Size_; return newLeaf.Value; @@ -1205,7 +1205,7 @@ namespace NKikimr { private: void PropagateReplace(TPage* current) { - Y_VERIFY_DEBUG(current); + Y_DEBUG_ABORT_UNLESS(current); while (!InsertPath.empty()) { TInnerPage* const inner = TInnerPage::From(InsertPath.back().Page); const size_t innerIndex = InsertPath.back().Index; @@ -1232,7 +1232,7 @@ namespace NKikimr { while (!InsertPath.empty()) { TInnerPage* const inner = TInnerPage::From(InsertPath.back().Page); InsertPath.pop_back(); - Y_VERIFY_DEBUG(LastSnapshotEpoch < inner->Epoch); + Y_DEBUG_ABORT_UNLESS(LastSnapshotEpoch < inner->Epoch); inner->Epoch = CurrentEpoch; } } @@ -1301,7 +1301,7 @@ namespace NKikimr { TKeyArg&& key, TValueArgs&&... valueArgs) { const size_t count = leaf->Count; - Y_VERIFY_DEBUG(index <= count); + Y_DEBUG_ABORT_UNLESS(index <= count); const size_t newCount = count + 1; // Case #1: create a new leaf page that has new item inserted @@ -1336,7 +1336,7 @@ namespace NKikimr { // Case #2: we must perform a split const size_t rightCount = newCount / 2; // we want less on the right leaf const size_t leftCount = newCount - rightCount; // we want more on the left leaf - Y_VERIFY_DEBUG(leftCount > 0 && rightCount > 0); + Y_DEBUG_ABORT_UNLESS(leftCount > 0 && rightCount > 0); auto* newLeft = NewLeafPage(); auto* newRight = NewLeafPage(); @@ -1417,7 +1417,7 @@ namespace NKikimr { } const size_t count = leaf->Count; - Y_VERIFY_DEBUG(index <= count); + Y_DEBUG_ABORT_UNLESS(index <= count); const size_t newCount = count + 1; // Case #1: reuse current page and insert inplace @@ -1436,7 +1436,7 @@ namespace NKikimr { // Case #2: we must perform a split const size_t rightCount = newCount / 2; // we want less on the right leaf const size_t leftCount = newCount - rightCount; // we want more on the left leaf - Y_VERIFY_DEBUG(leftCount > 0 && rightCount > 0); + Y_DEBUG_ABORT_UNLESS(leftCount > 0 && rightCount > 0); auto* newRight = NewLeafPage(); TValue* newValue; @@ -1470,7 +1470,7 @@ namespace NKikimr { auto* newValues = newRight->Values(); size_t rightIndex = index - leftCount; - Y_VERIFY_DEBUG(rightIndex < rightCount); + Y_DEBUG_ABORT_UNLESS(rightIndex < rightCount); for (size_t pos = 0; pos < rightCount; ++pos) { if (pos == rightIndex) { new (newKeys++) TKey(std::forward<TKeyArg>(key)); @@ -1521,7 +1521,7 @@ namespace NKikimr { return Middle; } } - Y_VERIFY_DEBUG(Current != End); + Y_DEBUG_ABORT_UNLESS(Current != End); return Current++; } @@ -1542,7 +1542,7 @@ namespace NKikimr { , Replacements{ left, right } , NextReplacement(0) { - Y_VERIFY_DEBUG(Skipped != End); + Y_DEBUG_ABORT_UNLESS(Skipped != End); } TEdge Read() { @@ -1552,7 +1552,7 @@ namespace NKikimr { } ++Current; } - Y_VERIFY_DEBUG(Current != End); + Y_DEBUG_ABORT_UNLESS(Current != End); return *(Current++); } @@ -1565,7 +1565,7 @@ namespace NKikimr { }; const size_t count = inner->Count; - Y_VERIFY_DEBUG(index <= count); + Y_DEBUG_ABORT_UNLESS(index <= count); const size_t newCount = count + 1; TKeysReader keysReader(inner->Keys(), index, count, middle); @@ -1596,7 +1596,7 @@ namespace NKikimr { // Case #2: create two new pages and copy items there const size_t rightCount = (newCount - 1) / 2; // less keys on the right side const size_t leftCount = (newCount - 1) - rightCount; // more keys on the left side - Y_VERIFY_DEBUG(leftCount > 0 && rightCount > 0); + Y_DEBUG_ABORT_UNLESS(leftCount > 0 && rightCount > 0); auto* newLeft = NewInnerPage(); auto* newRight = NewInnerPage(); @@ -1658,7 +1658,7 @@ namespace NKikimr { } const size_t count = inner->Count; - Y_VERIFY_DEBUG(index <= count); + Y_DEBUG_ABORT_UNLESS(index <= count); const size_t newCount = count + 1; // Case #1: reuse current page and insert new key inplace @@ -1680,8 +1680,8 @@ namespace NKikimr { // Case #2: we need to split with some new middle key bubbling up const size_t rightCount = (newCount - 1) / 2; // less keys on the right side const size_t leftCount = (newCount - 1) - rightCount; // more keys on the left side - Y_VERIFY_DEBUG(leftCount > 0 && rightCount > 0); - Y_VERIFY_DEBUG(leftCount < InnerPageCapacity); + Y_DEBUG_ABORT_UNLESS(leftCount > 0 && rightCount > 0); + Y_DEBUG_ABORT_UNLESS(leftCount < InnerPageCapacity); auto* newRight = NewInnerPage(); const TKey* newMiddle; @@ -1727,7 +1727,7 @@ namespace NKikimr { auto* newEdges = newRight->Edges(); size_t rightIndex = index - leftCount - 1; - Y_VERIFY_DEBUG(rightIndex < rightCount); + Y_DEBUG_ABORT_UNLESS(rightIndex < rightCount); for (size_t pos = 0; pos < rightCount; ++pos) { if (pos == rightIndex) { new (newKeys++) TKey(*middle); @@ -1795,11 +1795,11 @@ namespace NKikimr { if (!context->Next) { // This is the last snapshot in our linked list - Y_VERIFY_DEBUG(LastSnapshot == context); + Y_DEBUG_ABORT_UNLESS(LastSnapshot == context); LastSnapshot = context->Prev; LastSnapshotEpoch = LastSnapshot ? LastSnapshot->Epoch : 0; } else { - Y_VERIFY_DEBUG(LastSnapshot != context); + Y_DEBUG_ABORT_UNLESS(LastSnapshot != context); } context->Unlink(); diff --git a/ydb/core/util/cache.h b/ydb/core/util/cache.h index 898aa3673c..7aa6c0f01e 100644 --- a/ydb/core/util/cache.h +++ b/ydb/core/util/cache.h @@ -525,7 +525,7 @@ public: ui64 size = TSelf::Measure(item->Key, item->Value); this->OnEvict(item->Key, item->Value, size); auto itemIt = Index.find(*item); - Y_VERIFY_DEBUG(itemIt != Index.end()); + Y_DEBUG_ABORT_UNLESS(itemIt != Index.end()); Index.erase(itemIt); return true; } @@ -683,14 +683,14 @@ public: ui64 size = TSelf::Measure(inItem->Key, inItem->Value); this->OnEvict(inItem->Key, inItem->Value, size); auto inItemIt = InIndex.find(*inItem); - Y_VERIFY_DEBUG(inItemIt != InIndex.end()); + Y_DEBUG_ABORT_UNLESS(inItemIt != InIndex.end()); InIndex.erase(inItemIt); InSize -= size; if (OutIndex.size() > Config->OutKeyRatio * TSelf::GetCount()) { auto outItem = OutList.PopBack(); auto outItemIt = OutIndex.find(*outItem); - Y_VERIFY_DEBUG(outItemIt != OutIndex.end()); + Y_DEBUG_ABORT_UNLESS(outItemIt != OutIndex.end()); this->OnKeyEvict(outItemIt->Key); OutIndex.erase(outItemIt); } @@ -703,7 +703,7 @@ public: ui64 size = TSelf::Measure(item->Key, item->Value); this->OnEvict(item->Key, item->Value, size); auto mainIndexIt = MainIndex.find(*item); - Y_VERIFY_DEBUG(mainIndexIt != MainIndex.end()); + Y_DEBUG_ABORT_UNLESS(mainIndexIt != MainIndex.end()); MainIndex.erase(mainIndexIt); return true; } diff --git a/ydb/core/util/cache_cache.h b/ydb/core/util/cache_cache.h index d4ac0ce66a..e60d79724a 100644 --- a/ydb/core/util/cache_cache.h +++ b/ydb/core/util/cache_cache.h @@ -122,7 +122,7 @@ public: WarmList.PushFront(xitem); break; default: - Y_VERIFY_DEBUG(false, "unknown/broken cache generation"); + Y_DEBUG_ABORT_UNLESS(false, "unknown/broken cache generation"); break; } @@ -152,7 +152,7 @@ public: *Config.ReportedWarm = WarmWeight; break; default: - Y_VERIFY_DEBUG(false, "unknown cache generaton"); + Y_DEBUG_ABORT_UNLESS(false, "unknown cache generaton"); } } @@ -181,7 +181,7 @@ public: *Config.ReportedWarm = WarmWeight; break; default: - Y_VERIFY_DEBUG(false, "unknown cache generaton"); + Y_DEBUG_ABORT_UNLESS(false, "unknown cache generaton"); } } @@ -197,7 +197,7 @@ private: item->Unlink(); const ui64 elementWeight = WeightOp.Get(item); - Y_VERIFY_DEBUG(elementWeight <= weight); + Y_DEBUG_ABORT_UNLESS(elementWeight <= weight); weight -= elementWeight; } @@ -237,7 +237,7 @@ private: void LimitFresh(TIntrusiveList<TItem>& evictedList) { while (FreshWeight > Config.FreshLimit) { - Y_VERIFY_DEBUG(!FreshList.Empty()); + Y_DEBUG_ABORT_UNLESS(!FreshList.Empty()); TItem *x = FreshList.PopBack(); Y_ABORT_UNLESS(GenerationOp.Get(x) == TCacheCacheConfig::CacheGenFresh, "malformed entry in fresh cache. %" PRIu32, (ui32)GenerationOp.Get(x)); Unlink(x, FreshWeight); @@ -247,7 +247,7 @@ private: void LimitWarm(TIntrusiveList<TItem>& evictedList) { while (WarmWeight > Config.WarmLimit) { - Y_VERIFY_DEBUG(!WarmList.Empty()); + Y_DEBUG_ABORT_UNLESS(!WarmList.Empty()); TItem *x = WarmList.PopBack(); Y_ABORT_UNLESS(GenerationOp.Get(x) == TCacheCacheConfig::CacheGenWarm, "malformed entry in warm cache. %" PRIu32, (ui32)GenerationOp.Get(x)); Unlink(x, WarmWeight); @@ -257,7 +257,7 @@ private: void LimitStaging(TIntrusiveList<TItem>& evictedList) { while (StagingWeight > Config.StagingLimit) { - Y_VERIFY_DEBUG(!StagingList.Empty()); + Y_DEBUG_ABORT_UNLESS(!StagingList.Empty()); TItem *evicted = StagingList.PopBack(); Y_ABORT_UNLESS(GenerationOp.Get(evicted) == TCacheCacheConfig::CacheGenStaging, "malformed entry in staging cache %" PRIu32, (ui32)GenerationOp.Get(evicted)); Unlink(evicted, StagingWeight); @@ -267,7 +267,7 @@ private: } TItem* EvictNext(TIntrusiveList<TItem>& list, ui64& weight) { - Y_VERIFY_DEBUG(!list.Empty()); + Y_DEBUG_ABORT_UNLESS(!list.Empty()); TItem *evicted = list.PopBack(); Unlink(evicted, weight); diff --git a/ydb/core/util/fast_tls.h b/ydb/core/util/fast_tls.h index ef6485a580..7b7cf1a4de 100644 --- a/ydb/core/util/fast_tls.h +++ b/ydb/core/util/fast_tls.h @@ -32,7 +32,7 @@ namespace NKikimr { auto it = Slow.find(key); if (Y_LIKELY(it != Slow.end())) { void* ptr = it->second.load(std::memory_order_acquire); - Y_VERIFY_DEBUG(ptr != nullptr, "Unexpected null current value in a slow slot"); + Y_DEBUG_ABORT_UNLESS(ptr != nullptr, "Unexpected null current value in a slow slot"); return ptr; } diff --git a/ydb/core/util/fragmented_buffer.cpp b/ydb/core/util/fragmented_buffer.cpp index 38e4053054..91a25a48b9 100644 --- a/ydb/core/util/fragmented_buffer.cpp +++ b/ydb/core/util/fragmented_buffer.cpp @@ -51,7 +51,7 @@ void TFragmentedBuffer::Write(ui32 begin, TRope&& data) { auto& [prevOffset, prevRope] = *it++; const ui32 end = prevOffset + prevRope.size(); auto endIt = BufferForOffset.upper_bound(end); - Y_VERIFY_DEBUG(endIt != BufferForOffset.begin()); + Y_DEBUG_ABORT_UNLESS(endIt != BufferForOffset.begin()); auto& [lastOffset, lastRope] = *std::prev(endIt); const ui32 bytesToCut = end - lastOffset; if (bytesToCut < lastRope.size()) { @@ -98,7 +98,7 @@ void TFragmentedBuffer::CopyFrom(const TFragmentedBuffer& from, const TIntervalS TIntervalSet<i32> TFragmentedBuffer::GetIntervalSet() const { TIntervalSet<i32> res; for (auto& [offset, buffer] : BufferForOffset) { - Y_VERIFY_DEBUG(buffer); + Y_DEBUG_ABORT_UNLESS(buffer); res.Add(offset, offset + buffer.size()); } return res; diff --git a/ydb/core/util/hazard.cpp b/ydb/core/util/hazard.cpp index 706d68f430..43c9b313ce 100644 --- a/ydb/core/util/hazard.cpp +++ b/ydb/core/util/hazard.cpp @@ -72,7 +72,7 @@ THazardPointer* THazardDomain::Acquire() { } void THazardDomain::Release(THazardPointer* ptr) noexcept { - Y_VERIFY_DEBUG(ptr->ProtectedPointer.load(std::memory_order_relaxed) == nullptr, + Y_DEBUG_ABORT_UNLESS(ptr->ProtectedPointer.load(std::memory_order_relaxed) == nullptr, "Make sure pointer is cleared before it is released"); auto& cache = LocalCache.Get(); diff --git a/ydb/core/util/hyperlog_counter.cpp b/ydb/core/util/hyperlog_counter.cpp index 02f0b7670d..a3fe2587b1 100644 --- a/ydb/core/util/hyperlog_counter.cpp +++ b/ydb/core/util/hyperlog_counter.cpp @@ -30,7 +30,7 @@ bool THyperLogCounter::Increment(IRandomProvider& randomProvider) { return false; ++Value; - Y_VERIFY_DEBUG(Value < 64); + Y_DEBUG_ABORT_UNLESS(Value < 64); return true; } @@ -76,7 +76,7 @@ bool THyperLogCounter::Add(ui64 addend, IRandomProvider& randomProvider) { remain >>= 1; } - Y_VERIFY_DEBUG(Value < 64); + Y_DEBUG_ABORT_UNLESS(Value < 64); return (oldValue != Value); } diff --git a/ydb/core/util/intrusive_heap.h b/ydb/core/util/intrusive_heap.h index b32f09b025..1c754067a8 100644 --- a/ydb/core/util/intrusive_heap.h +++ b/ydb/core/util/intrusive_heap.h @@ -62,7 +62,7 @@ public: } T* cvalue = Data[child]; - Y_VERIFY_DEBUG(HeapIndex(cvalue) == child, "Heap index is out of sync"); + Y_DEBUG_ABORT_UNLESS(HeapIndex(cvalue) == child, "Heap index is out of sync"); // Move the smallest Data[child] up Data[index] = cvalue; @@ -72,7 +72,7 @@ public: if (size_t last = Data.size() - 1; index != last) { T* lvalue = Data[last]; - Y_VERIFY_DEBUG(HeapIndex(lvalue) == last, "Heap index is out of sync"); + Y_DEBUG_ABORT_UNLESS(HeapIndex(lvalue) == last, "Heap index is out of sync"); // Move the last item to the vacant slot Data[index] = lvalue; HeapIndex(lvalue) = index; @@ -100,7 +100,7 @@ public: } T* cvalue = Data[child]; - Y_VERIFY_DEBUG(HeapIndex(cvalue) == child, "Heap index is out of sync"); + Y_DEBUG_ABORT_UNLESS(HeapIndex(cvalue) == child, "Heap index is out of sync"); if (!Compare(cvalue, value)) { break; // already correct @@ -130,7 +130,7 @@ public: while (index > 0) { size_t parent = (index - 1) >> 1; T* pvalue = Data[parent]; - Y_VERIFY_DEBUG(HeapIndex(pvalue) == parent, "Heap index is out of sync"); + Y_DEBUG_ABORT_UNLESS(HeapIndex(pvalue) == parent, "Heap index is out of sync"); if (!Compare(value, pvalue)) { break; // already correct diff --git a/ydb/core/util/lf_stack.h b/ydb/core/util/lf_stack.h index 0391f3d061..7a6e6787b0 100644 --- a/ydb/core/util/lf_stack.h +++ b/ydb/core/util/lf_stack.h @@ -41,7 +41,7 @@ namespace NKikimr { // The item we push is guaranteed to have flag not set // N.B. release here synchronizes with fast path acquire during refcount decrement auto count = item->RefCount.fetch_add(FlagAddingToStack, std::memory_order_release); - Y_VERIFY_DEBUG((count & FlagAddingToStack) == 0, "Flag invariant failure during push"); + Y_DEBUG_ABORT_UNLESS((count & FlagAddingToStack) == 0, "Flag invariant failure during push"); if (count == 0) { DoPush(item); @@ -63,7 +63,7 @@ namespace NKikimr { // No other thread may change RefCount until this store succeeds // N.B. release here synchronizes the store to Next above with refcount increment auto count = item->RefCount.exchange(RefCountInc, std::memory_order_release); - Y_VERIFY_DEBUG(count == FlagAddingToStack, "Flag invariant failure during push"); + Y_DEBUG_ABORT_UNLESS(count == FlagAddingToStack, "Flag invariant failure during push"); // N.B. release here synchronizes item state with acquire on successful Pop if (Head.compare_exchange_strong(head, item, std::memory_order_release)) { @@ -74,8 +74,8 @@ namespace NKikimr { // Attempt to restart push, taking back RefCount we added above // N.B. release here synchronizes with fast path acquire during refcount decrement count = item->RefCount.fetch_add(FlagAddingToStack - RefCountInc, std::memory_order_release); - Y_VERIFY_DEBUG(count >= RefCountInc, "RefCount underflow"); - Y_VERIFY_DEBUG((count & FlagAddingToStack) == 0, "Flag invariant failure during push"); + Y_DEBUG_ABORT_UNLESS(count >= RefCountInc, "RefCount underflow"); + Y_DEBUG_ABORT_UNLESS((count & FlagAddingToStack) == 0, "Flag invariant failure during push"); if (count != RefCountInc) { // Some other thread is currently holding a reference @@ -111,8 +111,8 @@ namespace NKikimr { // remove 2 previously added references, one from us // and one from the stack itself. count = item->RefCount.fetch_add(-RefCountInc2, std::memory_order_relaxed); - Y_VERIFY_DEBUG(count >= RefCountInc2, "RefCount underflow"); - Y_VERIFY_DEBUG((count & FlagAddingToStack) == 0, "Flag invariant failure during pop"); + Y_DEBUG_ABORT_UNLESS(count >= RefCountInc2, "RefCount underflow"); + Y_DEBUG_ABORT_UNLESS((count & FlagAddingToStack) == 0, "Flag invariant failure during pop"); // We are the owner, should be safe to change the Next pointer however we want TItem* marker = item->Next.exchange((TItem*)-1, std::memory_order_relaxed); Y_ABORT_UNLESS(marker != (TItem*)-1, "Popped item that is already marked exclusive"); @@ -132,7 +132,7 @@ namespace NKikimr { // may not change neither RefCount nor Next until // RefCount becomes above zero again. count = item->RefCount.exchange(0, std::memory_order_relaxed); - Y_VERIFY_DEBUG(count == FlagAddingToStack, "Flag invariant failure during pop"); + Y_DEBUG_ABORT_UNLESS(count == FlagAddingToStack, "Flag invariant failure during pop"); // We are the owner, should be safe to change the Next pointer however we want TItem* marker = item->Next.exchange((TItem*)-1, std::memory_order_relaxed); Y_ABORT_UNLESS(marker != (TItem*)-1, "Popped item that is already marked exclusive"); diff --git a/ydb/core/util/lz4_data_generator.h b/ydb/core/util/lz4_data_generator.h index dd0ecbecae..8e1689cab3 100644 --- a/ydb/core/util/lz4_data_generator.h +++ b/ydb/core/util/lz4_data_generator.h @@ -38,7 +38,7 @@ inline TString FastGenDataForLZ4(size_t size, ui64 seed) { for (i = 0; i < runLen; i += sizeof(ui32)) { reinterpret_cast<ui32&>(i[run]) = rng(); } - Y_VERIFY_DEBUG(i == runLen); + Y_DEBUG_ABORT_UNLESS(i == runLen); char *ptr = data.Detach(); for (; size >= runLen; size -= runLen, ptr += runLen) { diff --git a/ydb/core/util/page_map.h b/ydb/core/util/page_map.h index acac3b72a6..7cf2be8909 100644 --- a/ydb/core/util/page_map.h +++ b/ydb/core/util/page_map.h @@ -65,14 +65,14 @@ namespace NKikimr { reference operator*() const { if (Self->Mask) { - Y_VERIFY_DEBUG(Index < Self->Entries.size()); + Y_DEBUG_ABORT_UNLESS(Index < Self->Entries.size()); const auto& entry = Self->Entries[Index]; - Y_VERIFY_DEBUG(entry.Page != InvalidPageId); + Y_DEBUG_ABORT_UNLESS(entry.Page != InvalidPageId); return { entry.Page, entry.Value }; } else { - Y_VERIFY_DEBUG(Index < Self->Pages.size()); + Y_DEBUG_ABORT_UNLESS(Index < Self->Pages.size()); const auto& value = Self->Pages[Index]; - Y_VERIFY_DEBUG(value); + Y_DEBUG_ABORT_UNLESS(value); return { Index, value }; } } @@ -143,7 +143,7 @@ namespace NKikimr { } const TPointer& operator[](ui32 page) const { - Y_VERIFY_DEBUG(page < MaxPages, + Y_DEBUG_ABORT_UNLESS(page < MaxPages, "Trying to lookup page %" PRIu32 ", size is %" PRISZT, page, MaxPages); @@ -151,11 +151,11 @@ namespace NKikimr { } bool emplace(ui32 page, TPointer value) { - Y_VERIFY_DEBUG(page < MaxPages, + Y_DEBUG_ABORT_UNLESS(page < MaxPages, "Trying to insert page %" PRIu32 ", size is %" PRISZT, page, MaxPages); - Y_VERIFY_DEBUG(value, + Y_DEBUG_ABORT_UNLESS(value, "Trying to insert page %" PRIu32 " with an empty value", page); @@ -170,7 +170,7 @@ namespace NKikimr { } bool erase(ui32 page) { - Y_VERIFY_DEBUG(page < MaxPages, + Y_DEBUG_ABORT_UNLESS(page < MaxPages, "Trying to erase page %" PRIu32 ", size is %" PRISZT, page, MaxPages); @@ -198,7 +198,7 @@ namespace NKikimr { "Decreasing virtual size from %" PRISZT " to %" PRISZT " not supported", MaxPages, max_pages); - Y_VERIFY_DEBUG(max_pages < InvalidPageId, + Y_DEBUG_ABORT_UNLESS(max_pages < InvalidPageId, "Cannot resize to %" PRISZT " pages (must be less than %" PRIu32 ")", max_pages, InvalidPageId); @@ -248,7 +248,7 @@ namespace NKikimr { size_t index = ExpectedIndex(page); ui32 distance = 0; for (;;) { - Y_VERIFY_DEBUG(index < Entries.size()); + Y_DEBUG_ABORT_UNLESS(index < Entries.size()); auto& entry = Entries[index]; if (entry.Page == page) { return entry.Value; // found @@ -263,7 +263,7 @@ namespace NKikimr { bool EmplacePage(ui32 page, TPointer value) { if (!Mask) { - Y_VERIFY_DEBUG(page < Pages.size()); + Y_DEBUG_ABORT_UNLESS(page < Pages.size()); if (!Pages[page]) { Pages[page] = std::move(value); return true; @@ -275,7 +275,7 @@ namespace NKikimr { size_t index = ExpectedIndex(page); ui32 distance = 0; for (;;) { - Y_VERIFY_DEBUG(index < Entries.size()); + Y_DEBUG_ABORT_UNLESS(index < Entries.size()); auto& entry = Entries[index]; if (entry.Page == page) { // Found existing page, cannot emplace @@ -303,7 +303,7 @@ namespace NKikimr { for (;;) { index = (index + 1) & Mask; ++distance; - Y_VERIFY_DEBUG(index < Entries.size()); + Y_DEBUG_ABORT_UNLESS(index < Entries.size()); auto& entry = Entries[index]; if (entry.Page == InvalidPageId) { entry.Page = page; @@ -334,7 +334,7 @@ namespace NKikimr { size_t index = ExpectedIndex(page); size_t distance = 0; for (;;) { - Y_VERIFY_DEBUG(index < Entries.size()); + Y_DEBUG_ABORT_UNLESS(index < Entries.size()); auto& entry = Entries[index]; if (entry.Page == page) { entry.Page = InvalidPageId; @@ -350,11 +350,11 @@ namespace NKikimr { // We now have a hole at index, move stuff up for (;;) { - Y_VERIFY_DEBUG(index < Entries.size()); + Y_DEBUG_ABORT_UNLESS(index < Entries.size()); auto& entry = Entries[index]; - Y_VERIFY_DEBUG(entry.Page == InvalidPageId); + Y_DEBUG_ABORT_UNLESS(entry.Page == InvalidPageId); index = (index + 1) & Mask; - Y_VERIFY_DEBUG(index < Entries.size()); + Y_DEBUG_ABORT_UNLESS(index < Entries.size()); auto& next = Entries[index]; if (next.Page == InvalidPageId || !next.Distance) { break; @@ -397,7 +397,7 @@ namespace NKikimr { size_t entries = FastClp2(min_entries); if (entries && entries <= MaxEntries) { - Y_VERIFY_DEBUG(entries >= 2); + Y_DEBUG_ABORT_UNLESS(entries >= 2); Mask = entries - 1; Entries.resize(entries); } else { @@ -419,12 +419,12 @@ namespace NKikimr { Init(min_entries); for (auto& entry : entries) { if (entry.Page != InvalidPageId) { - Y_VERIFY_DEBUG(Used < min_entries); + Y_DEBUG_ABORT_UNLESS(Used < min_entries); Y_ABORT_UNLESS(EmplacePage(entry.Page, std::move(entry.Value))); ++Used; } } - Y_VERIFY_DEBUG(Used == prevUsed); + Y_DEBUG_ABORT_UNLESS(Used == prevUsed); } void Rehash(size_t min_entries, TVector<TPointer> pages) { @@ -433,13 +433,13 @@ namespace NKikimr { ui32 page = 0; for (auto& value : pages) { if (value) { - Y_VERIFY_DEBUG(Used < min_entries); + Y_DEBUG_ABORT_UNLESS(Used < min_entries); Y_ABORT_UNLESS(EmplacePage(page, std::move(value))); ++Used; } ++page; } - Y_VERIFY_DEBUG(Used == prevUsed); + Y_DEBUG_ABORT_UNLESS(Used == prevUsed); } template<class T> diff --git a/ydb/core/util/queue_inplace.h b/ydb/core/util/queue_inplace.h index e0a5803e1e..3d2cd472ff 100644 --- a/ydb/core/util/queue_inplace.h +++ b/ydb/core/util/queue_inplace.h @@ -33,7 +33,7 @@ public: {} ~TQueueInplace() { - Y_VERIFY_DEBUG(Head() == nullptr && Size == 0); + Y_DEBUG_ABORT_UNLESS(Head() == nullptr && Size == 0); delete ReadFrom; } diff --git a/ydb/library/yql/core/yql_opt_utils.cpp b/ydb/library/yql/core/yql_opt_utils.cpp index 094d3f765e..111f063c9a 100644 --- a/ydb/library/yql/core/yql_opt_utils.cpp +++ b/ydb/library/yql/core/yql_opt_utils.cpp @@ -728,7 +728,7 @@ TExprNode::TPtr MakeSingleGroupRow(const TExprNode& aggregateNode, TExprNode::TP bool UpdateStructMembers(TExprContext& ctx, const TExprNode::TPtr& node, const TStringBuf& goal, TExprNode::TListType& members, MemberUpdaterFunc updaterFunc, const TTypeAnnotationNode* nodeType) { if (!nodeType) { nodeType = node->GetTypeAnn(); - Y_VERIFY_DEBUG(nodeType || !"Unset node type for UpdateStructMembers"); + Y_DEBUG_ABORT_UNLESS(nodeType || !"Unset node type for UpdateStructMembers"); } bool filtered = false; if (node->IsCallable("AsStruct")) { diff --git a/ydb/library/yql/minikql/mkql_utils.h b/ydb/library/yql/minikql/mkql_utils.h index 18e85abcf6..c6741502e4 100644 --- a/ydb/library/yql/minikql/mkql_utils.h +++ b/ydb/library/yql/minikql/mkql_utils.h @@ -15,12 +15,12 @@ public: } inline static TStatus Error(const TStringBuf& error) { - Y_VERIFY_DEBUG(!error.empty()); + Y_DEBUG_ABORT_UNLESS(!error.empty()); return TStatus(TString(error)); } inline static TStatus Error(TString&& error) { - Y_VERIFY_DEBUG(!error.empty()); + Y_DEBUG_ABORT_UNLESS(!error.empty()); return TStatus(std::move(error)); } diff --git a/ydb/library/yql/public/udf/arrow/util.h b/ydb/library/yql/public/udf/arrow/util.h index a082a4d785..4b6fcb196b 100644 --- a/ydb/library/yql/public/udf/arrow/util.h +++ b/ydb/library/yql/public/udf/arrow/util.h @@ -90,20 +90,20 @@ public: } inline void UnsafeAppend(const T* values, size_t count) { - Y_VERIFY_DEBUG(count + Length() <= Buffer->capacity() / sizeof(T)); + Y_DEBUG_ABORT_UNLESS(count + Length() <= Buffer->capacity() / sizeof(T)); std::memcpy(End(), values, count * sizeof(T)); UnsafeAdvance(count); } inline void UnsafeAppend(size_t count, const T& value) { - Y_VERIFY_DEBUG(count + Length() <= Buffer->capacity() / sizeof(T)); + Y_DEBUG_ABORT_UNLESS(count + Length() <= Buffer->capacity() / sizeof(T)); T* target = End(); std::fill(target, target + count, value); UnsafeAdvance(count); } inline void UnsafeAppend(T&& value) { - Y_VERIFY_DEBUG(1 + Length() <= Buffer->capacity() / sizeof(T)); + Y_DEBUG_ABORT_UNLESS(1 + Length() <= Buffer->capacity() / sizeof(T)); *End() = std::move(value); UnsafeAdvance(1); } diff --git a/ydb/library/yql/utils/log/context.h b/ydb/library/yql/utils/log/context.h index 6ef0946c03..75f2e28364 100644 --- a/ydb/library/yql/utils/log/context.h +++ b/ydb/library/yql/utils/log/context.h @@ -84,7 +84,7 @@ public: } void LinkBefore(TLogContextListItem* item) { - Y_VERIFY_DEBUG(!HasNext()); + Y_DEBUG_ABORT_UNLESS(!HasNext()); Next = item; Prev = item->Prev; Prev->Next = this; diff --git a/ydb/library/yql/utils/log/tls_backend.h b/ydb/library/yql/utils/log/tls_backend.h index 69a0955432..802a73aae9 100644 --- a/ydb/library/yql/utils/log/tls_backend.h +++ b/ydb/library/yql/utils/log/tls_backend.h @@ -20,7 +20,7 @@ public: TTlsLogBackend(TAutoPtr<TLogBackend> defaultBackend) : DefaultBackend_(defaultBackend) { - Y_VERIFY_DEBUG(DefaultBackend_, "default backend is not set"); + Y_DEBUG_ABORT_UNLESS(DefaultBackend_, "default backend is not set"); } void WriteData(const TLogRecord& rec) override; diff --git a/yt/yt/library/numeric/double_array.h b/yt/yt/library/numeric/double_array.h index c3a5ec19d9..d8e81f9850 100644 --- a/yt/yt/library/numeric/double_array.h +++ b/yt/yt/library/numeric/double_array.h @@ -40,7 +40,7 @@ public: constexpr TDoubleArrayBase(std::initializer_list<double> values) { - Y_VERIFY_DEBUG(values.size() == Size); + Y_DEBUG_ABORT_UNLESS(values.size() == Size); std::copy(std::begin(values), std::end(values), std::begin(Values_)); } diff --git a/yt/yt/library/numeric/piecewise_linear_function-inl.h b/yt/yt/library/numeric/piecewise_linear_function-inl.h index c5bf1d587b..35133278ed 100644 --- a/yt/yt/library/numeric/piecewise_linear_function-inl.h +++ b/yt/yt/library/numeric/piecewise_linear_function-inl.h @@ -146,14 +146,14 @@ TPiecewiseSegment<TValue> TPiecewiseSegment<TValue>::Shift(double deltaBound, co template <class TValue> TValue TPiecewiseSegment<TValue>::InterpolateAt(double x) const { - Y_VERIFY_DEBUG(IsDefinedAt(x)); - Y_VERIFY_DEBUG(LeftBound_ != RightBound_); + Y_DEBUG_ABORT_UNLESS(IsDefinedAt(x)); + Y_DEBUG_ABORT_UNLESS(LeftBound_ != RightBound_); // The value of t is monotonic and is exact at bounds. double t = (x - LeftBound()) / (RightBound() - LeftBound()); - Y_VERIFY_DEBUG(x != LeftBound() || t == 0); - Y_VERIFY_DEBUG(x != RightBound() || t == 1); + Y_DEBUG_ABORT_UNLESS(x != LeftBound() || t == 0); + Y_DEBUG_ABORT_UNLESS(x != RightBound() || t == 1); return InterpolateNormalized(t); } @@ -408,8 +408,8 @@ TPiecewiseLinearFunction<TValue> TPiecewiseLinearFunction<TValue>::Create( TSelf result = builder.Finish(); - Y_VERIFY_DEBUG(result.LeftFunctionBound() == leftBound); - Y_VERIFY_DEBUG(result.RightFunctionBound() == rightBound); + Y_DEBUG_ABORT_UNLESS(result.LeftFunctionBound() == leftBound); + Y_DEBUG_ABORT_UNLESS(result.RightFunctionBound() == rightBound); return result; } @@ -542,7 +542,7 @@ bool TPiecewiseLinearFunction<TValue>::IsTrimmedRight() const template <class TValue> const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::LeftSegmentAt(double x, int* segmentIndex) const { - Y_VERIFY_DEBUG(IsDefinedAt(x)); + Y_DEBUG_ABORT_UNLESS(IsDefinedAt(x)); // Finds first element with |RightBound() >= x|. auto it = LowerBoundBy( @@ -550,7 +550,7 @@ const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::LeftSegmentAt end(Segments_), /* value */ x, [] (const auto& segment) { return segment.RightBound(); }); - Y_VERIFY_DEBUG(it != end(Segments_)); + Y_DEBUG_ABORT_UNLESS(it != end(Segments_)); if (segmentIndex != nullptr) { *segmentIndex = it - begin(Segments_); @@ -561,7 +561,7 @@ const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::LeftSegmentAt template <class TValue> const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::RightSegmentAt(double x, int* segmentIndex) const { - Y_VERIFY_DEBUG(IsDefinedAt(x)); + Y_DEBUG_ABORT_UNLESS(IsDefinedAt(x)); // Returns first element with LeftBound() > x. auto it = UpperBoundBy( @@ -582,7 +582,7 @@ const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::RightSegmentA template <class TValue> const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::SegmentAt(double x, int* segmentIndex) const { - Y_VERIFY_DEBUG(IsDefinedAt(x)); + Y_DEBUG_ABORT_UNLESS(IsDefinedAt(x)); // Finds first element with |RightBound() >= x|. auto it = LowerBoundBy( @@ -590,11 +590,11 @@ const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::SegmentAt(dou end(Segments_), /* value */ x, [] (const auto& segment) { return segment.RightBound(); }); - Y_VERIFY_DEBUG(it != end(Segments_)); + Y_DEBUG_ABORT_UNLESS(it != end(Segments_)); auto next = it + 1; if (it->RightBound() == x && next != end(Segments_) && next->IsVertical()) { - Y_VERIFY_DEBUG(next->LeftBound() == x); + Y_DEBUG_ABORT_UNLESS(next->LeftBound() == x); it = next; } @@ -950,8 +950,8 @@ TPiecewiseLinearFunction<TValue> TPiecewiseLinearFunction<TValue>::Compose(const } Sort(begin(criticalPoints), end(criticalPoints)); - Y_VERIFY_DEBUG(IsSortedBy(begin(criticalPoints), end(criticalPoints), [] (const auto& pair) { return pair.second; })); - Y_VERIFY_DEBUG(Unique(begin(criticalPoints), end(criticalPoints)) == end(criticalPoints)); + Y_DEBUG_ABORT_UNLESS(IsSortedBy(begin(criticalPoints), end(criticalPoints), [] (const auto& pair) { return pair.second; })); + Y_DEBUG_ABORT_UNLESS(Unique(begin(criticalPoints), end(criticalPoints)) == end(criticalPoints)); // Finally, build the resulting function. TBuilder builder; @@ -1040,14 +1040,14 @@ TPiecewiseLinearFunction<TValue>::TLeftToRightTraverser::TLeftToRightTraverser( , Cur_(Function_->Segments().begin() + segmentIndex) , End_(Function_->Segments().end()) { - Y_VERIFY_DEBUG(segmentIndex < std::ssize(Function_->Segments())); + Y_DEBUG_ABORT_UNLESS(segmentIndex < std::ssize(Function_->Segments())); } template <class TValue> const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::TLeftToRightTraverser::LeftSegmentAt(double x) { - Y_VERIFY_DEBUG(Function_->IsDefinedAt(x)); - Y_VERIFY_DEBUG(Cur_ == Function_->Segments().begin() || (Cur_ - 1)->RightBound() < x); + Y_DEBUG_ABORT_UNLESS(Function_->IsDefinedAt(x)); + Y_DEBUG_ABORT_UNLESS(Cur_ == Function_->Segments().begin() || (Cur_ - 1)->RightBound() < x); // Note that since |Function_->IsDefinedAt(x)| holds, we do not need to check that |Cur_ != End_|. while (Cur_->RightBound() < x) { @@ -1061,8 +1061,8 @@ const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::TLeftToRightT template <class TValue> const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::TLeftToRightTraverser::RightSegmentAt(double x) { - Y_VERIFY_DEBUG(Function_->IsDefinedAt(x)); - Y_VERIFY_DEBUG(Cur_->LeftBound() <= x); + Y_DEBUG_ABORT_UNLESS(Function_->IsDefinedAt(x)); + Y_DEBUG_ABORT_UNLESS(Cur_->LeftBound() <= x); while (true) { auto next = Cur_ + 1; @@ -1081,8 +1081,8 @@ const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::TLeftToRightT template <class TValue> const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::TLeftToRightTraverser::SegmentAt(double x) { - Y_VERIFY_DEBUG(Function_->IsDefinedAt(x)); - Y_VERIFY_DEBUG(Cur_->LeftBound() <= x); + Y_DEBUG_ABORT_UNLESS(Function_->IsDefinedAt(x)); + Y_DEBUG_ABORT_UNLESS(Cur_->LeftBound() <= x); // Note that since |Function_->IsDefinedAt(x)| holds, we do not need to check that |Cur_ != End_|. while (Cur_->RightBound() < x) { ++Cur_; @@ -1091,7 +1091,7 @@ const TPiecewiseSegment<TValue>& TPiecewiseLinearFunction<TValue>::TLeftToRightT auto next = Cur_ + 1; if (Cur_->RightBound() == x && next != End_ && next->IsVertical()) { - Y_VERIFY_DEBUG(next->LeftBound() == x); + Y_DEBUG_ABORT_UNLESS(next->LeftBound() == x); Cur_ = next; } diff --git a/yt/yt/library/numeric/piecewise_linear_function.cpp b/yt/yt/library/numeric/piecewise_linear_function.cpp index 3b175bc235..b1b29b1e5d 100644 --- a/yt/yt/library/numeric/piecewise_linear_function.cpp +++ b/yt/yt/library/numeric/piecewise_linear_function.cpp @@ -93,7 +93,7 @@ void SortOrMerge(std::vector<double>* vec) TPivotsVector pivotsBuffer; SortOrMergeImpl(vec, &mergeBuffer, &mergePivots, &pivotsBuffer); - Y_VERIFY_DEBUG(std::is_sorted(begin(*vec), end(*vec))); + Y_DEBUG_ABORT_UNLESS(std::is_sorted(begin(*vec), end(*vec))); } } // namespace NDetail |