diff options
author | innokentii <innokentii@yandex-team.com> | 2022-12-09 10:17:25 +0300 |
---|---|---|
committer | innokentii <innokentii@yandex-team.com> | 2022-12-09 10:17:25 +0300 |
commit | 216e087ea762ae7e4f19e219a18360a93adf8ae6 (patch) | |
tree | 7c8da8e9b298f1cc9307fabdb896404db757f0b3 | |
parent | 9323fe28059355bafc517301a3e7a00fc0367f08 (diff) | |
download | ydb-216e087ea762ae7e4f19e219a18360a93adf8ae6.tar.gz |
Rename TContiguousData to TRcBuf
rename TContiguousData to TRcBuf
54 files changed, 352 insertions, 352 deletions
diff --git a/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp b/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp index 5a4df9d736..a8c505d94d 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp +++ b/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp @@ -428,7 +428,7 @@ namespace NActors { Y_VERIFY(!Buffers.empty()); auto& buffer = Buffers.front(); const size_t bytes = Min<size_t>(recvres, buffer->GetCapacity() - FirstBufferOffset); - IncomingData.Insert(IncomingData.End(), TContiguousData{buffer, {buffer->GetBuffer() + FirstBufferOffset, bytes}}); + IncomingData.Insert(IncomingData.End(), TRcBuf{buffer, {buffer->GetBuffer() + FirstBufferOffset, bytes}}); recvres -= bytes; FirstBufferOffset += bytes; if (FirstBufferOffset == buffer->GetCapacity()) { diff --git a/library/cpp/actors/util/contiguous_data.h b/library/cpp/actors/util/rc_buf.h index 22b28d3c46..ac770e1f00 100644 --- a/library/cpp/actors/util/contiguous_data.h +++ b/library/cpp/actors/util/rc_buf.h @@ -14,7 +14,7 @@ #include <util/system/sys_alloc.h> #include "shared_data.h" -#include "contiguous_data_backend.h" +#include "rc_buf_backend.h" #ifdef KIKIMR_TRACE_CONTIGUOUS_DATA_GROW #include "shared_data_backtracing_owner.h" @@ -289,11 +289,11 @@ struct IContiguousChunk : TThrRefBase { class TRope; class TRopeArena; -class TContiguousData { +class TRcBuf { friend class TRope; friend class TRopeArena; - using TInternalBackend = NDetail::TContiguousDataInternalBackend; + using TInternalBackend = NDetail::TRcBufInternalBackend; class TBackend { enum class EType : uintptr_t { @@ -694,7 +694,7 @@ class TContiguousData { const char *Begin; // data start const char *End; // data end - explicit TContiguousData(TInternalBackend s, const char *data, size_t size) + explicit TRcBuf(TInternalBackend s, const char *data, size_t size) : Backend(std::move(s)) { Y_VERIFY(Backend.GetData().data() == nullptr || @@ -703,7 +703,7 @@ class TContiguousData { End = data + size; } - explicit TContiguousData(TInternalBackend s) + explicit TRcBuf(TInternalBackend s) : Backend(std::move(s)) { auto span = Backend.GetData(); @@ -711,8 +711,8 @@ class TContiguousData { End = Begin + span.size(); } - TContiguousData(TOwnedSlice, const char *data, size_t size, const TContiguousData& from) - : TContiguousData(from.Backend, {data, size}) + TRcBuf(TOwnedSlice, const char *data, size_t size, const TRcBuf& from) + : TRcBuf(from.Backend, {data, size}) { Y_VERIFY(data >= from.GetData()); Y_VERIFY(data < from.GetData() + from.GetSize()); @@ -720,8 +720,8 @@ class TContiguousData { Backend.UpdateCookiesUnsafe(Begin, End); } - TContiguousData(TOwnedSlice, const char *begin, const char *end, const TContiguousData& from) - : TContiguousData(OwnedSlice, begin, end - begin, from) + TRcBuf(TOwnedSlice, const char *begin, const char *end, const TRcBuf& from) + : TRcBuf(OwnedSlice, begin, end - begin, from) {} public: @@ -738,19 +738,19 @@ public: // SaveAllocs, // Move data if there is enough space in (headroom + size + tailroom) }; - TContiguousData() + TRcBuf() : Begin(nullptr) , End(nullptr) {} template<typename T> - TContiguousData(T&& backend, const TContiguousSpan& data) + TRcBuf(T&& backend, const TContiguousSpan& data) : Backend(std::forward<T>(backend)) , Begin(data.data()) , End(Begin + data.size()) {} - explicit TContiguousData(TString s) + explicit TRcBuf(TString s) : Backend(std::move(s)) { auto span = Backend.GetData(); @@ -758,7 +758,7 @@ public: End = Begin + span.size(); } - explicit TContiguousData(NActors::TSharedData s) + explicit TRcBuf(NActors::TSharedData s) : Backend(std::move(s)) { auto span = Backend.GetData(); @@ -766,63 +766,63 @@ public: End = Begin + span.size(); } - TContiguousData(IContiguousChunk::TPtr backend) - : TContiguousData(backend, backend->GetData()) + TRcBuf(IContiguousChunk::TPtr backend) + : TRcBuf(backend, backend->GetData()) {} - TContiguousData(TSlice, const char *data, size_t size, const TContiguousData& from) - : TContiguousData(from.Backend, {data, size}) + TRcBuf(TSlice, const char *data, size_t size, const TRcBuf& from) + : TRcBuf(from.Backend, {data, size}) { Y_VERIFY(data >= from.GetData()); Y_VERIFY(data < from.GetData() + from.GetSize()); Y_VERIFY(data + size <= from.GetData() + from.GetSize()); } - TContiguousData(TSlice, const char *begin, const char *end, const TContiguousData& from) - : TContiguousData(Slice, begin, end - begin, from) + TRcBuf(TSlice, const char *begin, const char *end, const TRcBuf& from) + : TRcBuf(Slice, begin, end - begin, from) {} - TContiguousData(const TContiguousData& other) + TRcBuf(const TRcBuf& other) : Backend(other.Backend) , Begin(other.Begin) , End(other.End) {} - TContiguousData(TContiguousData&& other) + TRcBuf(TRcBuf&& other) : Backend(std::move(other.Backend)) , Begin(other.Begin) , End(other.End) {} - TContiguousData& operator =(const TContiguousData&) = default; - TContiguousData& operator =(TContiguousData&&) = default; + TRcBuf& operator =(const TRcBuf&) = default; + TRcBuf& operator =(TRcBuf&&) = default; - static TContiguousData Uninitialized(size_t size, size_t headroom = 0, size_t tailroom = 0) + static TRcBuf Uninitialized(size_t size, size_t headroom = 0, size_t tailroom = 0) { if (size == 0) { - return TContiguousData(); + return TRcBuf(); } if (headroom == 0 && tailroom == 0) { TInternalBackend res = TInternalBackend::Uninitialized(size); - return TContiguousData( + return TRcBuf( OwnedSlice, res.data(), res.data() + res.size(), - TContiguousData(res)); + TRcBuf(res)); } TInternalBackend res = TInternalBackend::Uninitialized(size, headroom, tailroom); - return TContiguousData(res, res.data() + headroom, size); + return TRcBuf(res, res.data() + headroom, size); } - static TContiguousData Copy(TContiguousSpan data, size_t headroom = 0, size_t tailroom = 0) { - TContiguousData res = Uninitialized(data.size(), headroom, tailroom); + static TRcBuf Copy(TContiguousSpan data, size_t headroom = 0, size_t tailroom = 0) { + TRcBuf res = Uninitialized(data.size(), headroom, tailroom); std::memcpy(res.UnsafeGetDataMut(), data.GetData(), data.GetSize()); return res; } - static TContiguousData Copy(const char* data, size_t size, size_t headroom = 0, size_t tailroom = 0) { + static TRcBuf Copy(const char* data, size_t size, size_t headroom = 0, size_t tailroom = 0) { return Copy({data, size}, headroom, tailroom); } @@ -970,7 +970,7 @@ public: if (Headroom() >= size) { return; } - auto newData = TContiguousData::Uninitialized(GetSize(), size, UnsafeTailroom()); + auto newData = TRcBuf::Uninitialized(GetSize(), size, UnsafeTailroom()); if (auto data = GetData(); data) { std::memcpy(newData.UnsafeGetDataMut(), GetData(), GetSize()); } @@ -981,7 +981,7 @@ public: if (Tailroom() >= size) { return; } - auto newData = TContiguousData::Uninitialized(GetSize(), UnsafeHeadroom(), size); + auto newData = TRcBuf::Uninitialized(GetSize(), UnsafeHeadroom(), size); if (auto data = GetData(); data) { std::memcpy(newData.UnsafeGetDataMut(), GetData(), GetSize()); } @@ -992,7 +992,7 @@ public: if (Headroom() >= headroom && Tailroom() >= tailroom) { return; } - auto newData = TContiguousData::Uninitialized( + auto newData = TRcBuf::Uninitialized( GetSize(), std::max(UnsafeHeadroom(), headroom), std::max(UnsafeTailroom(), tailroom)); @@ -1010,7 +1010,7 @@ public: if (strategy == EResizeStrategy::FailOnCopy && static_cast<bool>(Backend)) { Y_FAIL("Fail on grow"); } - auto newData = TContiguousData::Uninitialized(size + GetSize(), UnsafeHeadroom() > size ? UnsafeHeadroom() - size : 0, UnsafeTailroom()); + auto newData = TRcBuf::Uninitialized(size + GetSize(), UnsafeHeadroom() > size ? UnsafeHeadroom() - size : 0, UnsafeTailroom()); if (auto data = GetData(); data) { std::memcpy(newData.UnsafeGetDataMut() + size, GetData(), GetSize()); } @@ -1027,7 +1027,7 @@ public: if (strategy == EResizeStrategy::FailOnCopy && static_cast<bool>(Backend)) { Y_FAIL("Fail on grow"); } - auto newData = TContiguousData::Uninitialized(size + GetSize(), UnsafeHeadroom(), UnsafeTailroom() > size ? UnsafeTailroom() - size : 0); + auto newData = TRcBuf::Uninitialized(size + GetSize(), UnsafeHeadroom(), UnsafeTailroom() > size ? UnsafeTailroom() - size : 0); if (auto data = GetData(); data) { std::memcpy(newData.UnsafeGetDataMut(), GetData(), GetSize()); } diff --git a/library/cpp/actors/util/contiguous_data_backend.h b/library/cpp/actors/util/rc_buf_backend.h index 9f97906114..f7089a302c 100644 --- a/library/cpp/actors/util/contiguous_data_backend.h +++ b/library/cpp/actors/util/rc_buf_backend.h @@ -11,7 +11,7 @@ namespace NDetail { -struct TContiguousDataInternalBackend { +struct TRcBufInternalBackend { public: struct TCookies { using TSelf = TCookies; @@ -41,23 +41,23 @@ private: }; public: - TContiguousDataInternalBackend() noexcept + TRcBufInternalBackend() noexcept : Data_(nullptr) , Size_(0) { } - ~TContiguousDataInternalBackend() noexcept { + ~TRcBufInternalBackend() noexcept { Release(); } - TContiguousDataInternalBackend(const TContiguousDataInternalBackend& other) noexcept + TRcBufInternalBackend(const TRcBufInternalBackend& other) noexcept : Data_(other.Data_) , Size_(other.Size_) { AddRef(); } - TContiguousDataInternalBackend(TContiguousDataInternalBackend&& other) noexcept + TRcBufInternalBackend(TRcBufInternalBackend&& other) noexcept : Data_(other.Data_) , Size_(other.Size_) { @@ -65,7 +65,7 @@ public: other.Size_ = 0; } - TContiguousDataInternalBackend& operator=(const TContiguousDataInternalBackend& other) noexcept { + TRcBufInternalBackend& operator=(const TRcBufInternalBackend& other) noexcept { if (this != &other) { Release(); Data_ = other.Data_; @@ -75,7 +75,7 @@ public: return *this; } - TContiguousDataInternalBackend& operator=(TContiguousDataInternalBackend&& other) noexcept { + TRcBufInternalBackend& operator=(TRcBufInternalBackend&& other) noexcept { if (this != &other) { Release(); Data_ = other.Data_; @@ -105,7 +105,7 @@ public: */ char* Detach() { if (IsShared()) { - *this = TContiguousDataInternalBackend::Copy(data(), size()); + *this = TRcBufInternalBackend::Copy(data(), size()); } return Data_; } @@ -129,8 +129,8 @@ public: /** * Attach to pre-allocated data with a preceding THeader */ - static TContiguousDataInternalBackend AttachUnsafe(char* data, size_t size) noexcept { - TContiguousDataInternalBackend result; + static TRcBufInternalBackend AttachUnsafe(char* data, size_t size) noexcept { + TRcBufInternalBackend result; result.Data_ = data; result.Size_ = size; return result; @@ -139,7 +139,7 @@ public: /** * Make uninitialized buffer of the specified size */ - static TContiguousDataInternalBackend Uninitialized(size_t size, size_t headroom = 0, size_t tailroom = 0) { + static TRcBufInternalBackend Uninitialized(size_t size, size_t headroom = 0, size_t tailroom = 0) { size_t fullSize = checkedSum(size, checkedSum(headroom, tailroom)); return AttachUnsafe(Allocate(size, headroom, tailroom), fullSize); } @@ -147,8 +147,8 @@ public: /** * Make a copy of the specified data */ - static TContiguousDataInternalBackend Copy(const void* data, size_t size) { - TContiguousDataInternalBackend result = Uninitialized(size); + static TRcBufInternalBackend Copy(const void* data, size_t size) { + TRcBufInternalBackend result = Uninitialized(size); if (size) { ::memcpy(result.Data(), data, size); } diff --git a/library/cpp/actors/util/contiguous_data_ut.cpp b/library/cpp/actors/util/rc_buf_ut.cpp index 6d7c698879..9b8af6421d 100644 --- a/library/cpp/actors/util/contiguous_data_ut.cpp +++ b/library/cpp/actors/util/rc_buf_ut.cpp @@ -1,13 +1,13 @@ -#include "contiguous_data.h" +#include "rc_buf.h" #include "ut_helpers.h" #include "rope.h" #include <library/cpp/testing/unittest/registar.h> #include <util/random/random.h> -Y_UNIT_TEST_SUITE(TContiguousData) { +Y_UNIT_TEST_SUITE(TRcBuf) { Y_UNIT_TEST(TypeSize) { - UNIT_ASSERT_EQUAL(sizeof(TContiguousData), 4 * sizeof(uintptr_t)); + UNIT_ASSERT_EQUAL(sizeof(TRcBuf), 4 * sizeof(uintptr_t)); } Y_UNIT_TEST(CrossCompare) { @@ -19,8 +19,8 @@ Y_UNIT_TEST_SUITE(TContiguousData) { const TContiguousSpan constSpan(str); TMutableContiguousSpan mutableSpan(const_cast<char*>(str.data()), str.size()); const TMutableContiguousSpan constMutableSpan(const_cast<char*>(str.data()), str.size()); - TContiguousData data(str); - const TContiguousData constData(str); + TRcBuf data(str); + const TRcBuf constData(str); TArrayRef<char> arrRef(const_cast<char*>(str.data()), str.size()); const TArrayRef<char> constArrRef(const_cast<char*>(str.data()), str.size()); TArrayRef<const char> arrConstRef(const_cast<char*>(str.data()), str.size()); @@ -51,8 +51,8 @@ Y_UNIT_TEST_SUITE(TContiguousData) { } Y_UNIT_TEST(Detach) { - TContiguousData data = TContiguousData::Copy(TString("test")); - TContiguousData data2 = data; + TRcBuf data = TRcBuf::Copy(TString("test")); + TRcBuf data2 = data; char* res = data2.Detach(); UNIT_ASSERT_UNEQUAL(data.GetData(), data2.GetData()); UNIT_ASSERT_EQUAL(res, data2.GetData()); @@ -61,7 +61,7 @@ Y_UNIT_TEST_SUITE(TContiguousData) { } Y_UNIT_TEST(Resize) { - TContiguousData data = TContiguousData::Uninitialized(10, 20, 30); + TRcBuf data = TRcBuf::Uninitialized(10, 20, 30); UNIT_ASSERT_EQUAL(data.size(), 10); UNIT_ASSERT_EQUAL(data.Headroom(), 20); UNIT_ASSERT_EQUAL(data.Tailroom(), 30); @@ -94,8 +94,8 @@ Y_UNIT_TEST_SUITE(TContiguousData) { } Y_UNIT_TEST(ResizeUnshare) { - TContiguousData data = TContiguousData::Uninitialized(10, 20, 30); - TContiguousData otherData(data); + TRcBuf data = TRcBuf::Uninitialized(10, 20, 30); + TRcBuf otherData(data); UNIT_ASSERT_EQUAL(data.data(), otherData.data()); UNIT_ASSERT_EQUAL(data.size(), 10); UNIT_ASSERT_EQUAL(data.Headroom(), 20); @@ -127,13 +127,13 @@ Y_UNIT_TEST_SUITE(TContiguousData) { } Y_UNIT_TEST(Trim) { - TContiguousData data = TContiguousData::Uninitialized(10, 20, 30); - TContiguousData otherData(data); + TRcBuf data = TRcBuf::Uninitialized(10, 20, 30); + TRcBuf otherData(data); otherData.TrimBack(5); UNIT_ASSERT_EQUAL(data.data(), otherData.data()); UNIT_ASSERT_EQUAL(otherData.Headroom(), 20); UNIT_ASSERT_EQUAL(otherData.Tailroom(), 0); - TContiguousData otherData2(data); + TRcBuf otherData2(data); otherData2.TrimBack(2); otherData2.TrimFront(1); UNIT_ASSERT_EQUAL(data.data() + 1, otherData2.data()); @@ -150,7 +150,7 @@ Y_UNIT_TEST_SUITE(TContiguousData) { UNIT_ASSERT_UNEQUAL(data.data() + 7, otherData.data()); otherData2.GrowBack(1); UNIT_ASSERT_UNEQUAL(data.data() + 6, otherData2.data()); - data = TContiguousData::Uninitialized(10); + data = TRcBuf::Uninitialized(10); otherData = data; data.TrimBack(5); UNIT_ASSERT_EQUAL(data.data(), otherData.data()); @@ -158,15 +158,15 @@ Y_UNIT_TEST_SUITE(TContiguousData) { } Y_UNIT_TEST(SliceUnshare) { - TContiguousData data = TContiguousData::Uninitialized(10, 20, 30); - TContiguousData otherData(TContiguousData::Slice, data.data() + 1, data.size() - 2, data); + TRcBuf data = TRcBuf::Uninitialized(10, 20, 30); + TRcBuf otherData(TRcBuf::Slice, data.data() + 1, data.size() - 2, data); UNIT_ASSERT_EQUAL(otherData.Headroom(), 0); UNIT_ASSERT_EQUAL(otherData.Tailroom(), 0); } Y_UNIT_TEST(Reserve) { - TContiguousData data = TContiguousData::Copy("test", 4, 5, 6); - TContiguousData data2 = data; + TRcBuf data = TRcBuf::Copy("test", 4, 5, 6); + TRcBuf data2 = data; data.reserve(1); data.ReserveTailroom(6); UNIT_ASSERT_EQUAL(data.GetData(), data2.GetData()); diff --git a/library/cpp/actors/util/rope.h b/library/cpp/actors/util/rope.h index 2b2b2df19d..a0e38535a6 100644 --- a/library/cpp/actors/util/rope.h +++ b/library/cpp/actors/util/rope.h @@ -13,7 +13,7 @@ //#include "rope_cont_list.h" //#include "rope_cont_deque.h" -#include "contiguous_data.h" +#include "rc_buf.h" class TRopeAlignedBuffer : public IContiguousChunk { static constexpr size_t Alignment = 16; @@ -102,7 +102,7 @@ struct always_false : std::false_type {}; class TRope { friend class TRopeArena; - using TChunkList = NRopeDetails::TChunkList<TContiguousData>; + using TChunkList = NRopeDetails::TChunkList<TRcBuf>; private: // we use list here to store chain items as we have to keep valid iterators when erase/insert operations are invoked; @@ -310,13 +310,13 @@ private: return Iter; } - const TContiguousData& GetChunk() const { + const TRcBuf& GetChunk() const { CheckValid(); return *Iter; } template<bool Mut = !IsConst, std::enable_if_t<Mut, bool> = true> - TContiguousData& GetChunk() { + TRcBuf& GetChunk() { CheckValid(); return *Iter; } @@ -354,7 +354,7 @@ public: TRope() = default; TRope(const TRope& rope) = default; - TRope(const TContiguousData& data) { + TRope(const TRcBuf& data) { if(!data.HasBuffer()) { return; } @@ -362,7 +362,7 @@ public: Chain.PutToEnd(data); } - TRope(TContiguousData&& data) { + TRope(TRcBuf&& data) { if(!data.HasBuffer()) { return; } @@ -407,13 +407,13 @@ public: while (begin.Iter != end.Iter) { const size_t size = begin.ContiguousSize(); - Chain.PutToEnd(TContiguousData::Slice, begin.ContiguousData(), size, begin.GetChunk()); + Chain.PutToEnd(TRcBuf::Slice, begin.ContiguousData(), size, begin.GetChunk()); begin.AdvanceToNextContiguousBlock(); Size += size; } if (begin != end && end.PointsToChunkMiddle()) { - Chain.PutToEnd(TContiguousData::Slice, begin.Ptr, end.Ptr, begin.GetChunk()); + Chain.PutToEnd(TRcBuf::Slice, begin.Ptr, end.Ptr, begin.GetChunk()); Size += end.Ptr - begin.Ptr; } } @@ -534,7 +534,7 @@ public: return; } } - dest->Chain.PutToEnd(TContiguousData::Slice, first->Begin, first->Begin + num, *first); + dest->Chain.PutToEnd(TRcBuf::Slice, first->Begin, first->Begin + num, *first); first->Begin += num; } } @@ -552,14 +552,14 @@ public: // check if we have to split the block if (pos.PointsToChunkMiddle()) { - pos.Iter = Chain.InsertBefore(pos.Iter, TContiguousData::Slice, pos->Begin, pos.Ptr, pos.GetChunk()); + pos.Iter = Chain.InsertBefore(pos.Iter, TRcBuf::Slice, pos->Begin, pos.Ptr, pos.GetChunk()); ++pos.Iter; pos->Begin = pos.Ptr; } // perform glueing if possible - TContiguousData *ropeLeft = &rope.Chain.GetFirstChunk(); - TContiguousData *ropeRight = &rope.Chain.GetLastChunk(); + TRcBuf *ropeLeft = &rope.Chain.GetFirstChunk(); + TRcBuf *ropeRight = &rope.Chain.GetLastChunk(); bool gluedLeft = false, gluedRight = false; if (pos.Iter != Chain.begin()) { // glue left part whenever possible // obtain iterator to previous chunk @@ -600,7 +600,7 @@ public: while (len) { Y_VERIFY_DEBUG(Chain); - TContiguousData& item = Chain.GetFirstChunk(); + TRcBuf& item = Chain.GetFirstChunk(); const size_t itemSize = item.GetSize(); if (len >= itemSize) { Chain.EraseFront(); @@ -620,7 +620,7 @@ public: while (len) { Y_VERIFY_DEBUG(Chain); - TContiguousData& item = Chain.GetLastChunk(); + TRcBuf& item = Chain.GetLastChunk(); const size_t itemSize = item.GetSize(); if (len >= itemSize) { Chain.EraseBack(); @@ -734,7 +734,7 @@ public: void Compact(size_t headroom = 0, size_t tailroom = 0) { if(!IsContiguous()) { // TODO(innokentii): use better container, when most outer users stop use TString - TContiguousData res = TContiguousData::Uninitialized(GetSize(), headroom, tailroom); + TRcBuf res = TRcBuf::Uninitialized(GetSize(), headroom, tailroom); Begin().ExtractPlainDataAndAdvance(res.UnsafeGetDataMut(), res.size()); Erase(Begin(), End()); Insert(End(), TRope(res)); @@ -743,7 +743,7 @@ public: static TRope Uninitialized(size_t size) { - TContiguousData res = TContiguousData::Uninitialized(size); + TRcBuf res = TRcBuf::Uninitialized(size); return TRope(res); } @@ -796,12 +796,12 @@ public: return s.Str(); } - explicit operator TContiguousData() { + explicit operator TRcBuf() { if(GetSize() == 0) { - return TContiguousData(); + return TRcBuf(); } Compact(); - return TContiguousData(Begin().GetChunk()); + return TRcBuf(Begin().GetChunk()); } friend bool operator==(const TRope& x, const TRope& y) { return Compare(x, y) == 0; } @@ -826,19 +826,19 @@ public: friend bool operator>=(const TContiguousSpan& x, const TRope& y) { return Compare(x, y) >= 0; } // FIXME(innokentii) temporary hack - friend bool operator==(const TRope& x, const TContiguousData& y) { return Compare(x, y.GetContiguousSpan()) == 0; } - friend bool operator!=(const TRope& x, const TContiguousData& y) { return Compare(x, y.GetContiguousSpan()) != 0; } - friend bool operator< (const TRope& x, const TContiguousData& y) { return Compare(x, y.GetContiguousSpan()) < 0; } - friend bool operator<=(const TRope& x, const TContiguousData& y) { return Compare(x, y.GetContiguousSpan()) <= 0; } - friend bool operator> (const TRope& x, const TContiguousData& y) { return Compare(x, y.GetContiguousSpan()) > 0; } - friend bool operator>=(const TRope& x, const TContiguousData& y) { return Compare(x, y.GetContiguousSpan()) >= 0; } + friend bool operator==(const TRope& x, const TRcBuf& y) { return Compare(x, y.GetContiguousSpan()) == 0; } + friend bool operator!=(const TRope& x, const TRcBuf& y) { return Compare(x, y.GetContiguousSpan()) != 0; } + friend bool operator< (const TRope& x, const TRcBuf& y) { return Compare(x, y.GetContiguousSpan()) < 0; } + friend bool operator<=(const TRope& x, const TRcBuf& y) { return Compare(x, y.GetContiguousSpan()) <= 0; } + friend bool operator> (const TRope& x, const TRcBuf& y) { return Compare(x, y.GetContiguousSpan()) > 0; } + friend bool operator>=(const TRope& x, const TRcBuf& y) { return Compare(x, y.GetContiguousSpan()) >= 0; } - friend bool operator==(const TContiguousData& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) == 0; } - friend bool operator!=(const TContiguousData& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) != 0; } - friend bool operator< (const TContiguousData& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) < 0; } - friend bool operator<=(const TContiguousData& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) <= 0; } - friend bool operator> (const TContiguousData& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) > 0; } - friend bool operator>=(const TContiguousData& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) >= 0; } + friend bool operator==(const TRcBuf& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) == 0; } + friend bool operator!=(const TRcBuf& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) != 0; } + friend bool operator< (const TRcBuf& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) < 0; } + friend bool operator<=(const TRcBuf& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) <= 0; } + friend bool operator> (const TRcBuf& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) > 0; } + friend bool operator>=(const TRcBuf& x, const TRope& y) { return Compare(x.GetContiguousSpan(), y) >= 0; } private: @@ -852,9 +852,9 @@ private: return; } - auto addBlock = [&](const TContiguousData& from, const char *begin, const char *end) { + auto addBlock = [&](const TRcBuf& from, const char *begin, const char *end) { if (target) { - target->Chain.PutToEnd(TContiguousData::Slice, begin, end, from); + target->Chain.PutToEnd(TRcBuf::Slice, begin, end, from); target->Size += end - begin; } Size -= end - begin; @@ -863,12 +863,12 @@ private: // consider special case -- when begin and end point to the same block; in this case we have to split up this // block into two parts if (begin.Iter == end.Iter) { - TContiguousData chunkToSplit = begin.GetChunk(); + TRcBuf chunkToSplit = begin.GetChunk(); addBlock(chunkToSplit, begin.Ptr, end.Ptr); const char *firstChunkBegin = begin.PointsToChunkMiddle() ? begin->Begin : nullptr; begin->Begin = end.Ptr; // this affects both begin and end iterator pointed values if (firstChunkBegin) { - Chain.InsertBefore(begin.Iter, TContiguousData::Slice, firstChunkBegin, begin.Ptr, chunkToSplit); + Chain.InsertBefore(begin.Iter, TRcBuf::Slice, firstChunkBegin, begin.Ptr, chunkToSplit); } } else { // check the first iterator -- if it starts not from the begin of the block, we have to adjust end of the @@ -950,7 +950,7 @@ public: return Size; } - void AccountChunk(const TContiguousData& chunk) { + void AccountChunk(const TRcBuf& chunk) { if (AccountedBuffers.insert(chunk.Backend.UniqueId()).second) { Size += chunk.GetOccupiedMemorySize(); } @@ -1083,7 +1083,7 @@ public: inline TRope TRope::CopySpaceOptimized(TRope&& origin, size_t worstRatioPer1k, TRopeArena& arena) { TRope res; - for (TContiguousData& chunk : origin.Chain) { + for (TRcBuf& chunk : origin.Chain) { size_t ratio = chunk.GetSize() * 1024 / chunk.GetOccupiedMemorySize(); if (ratio < 1024 - worstRatioPer1k) { res.Insert(res.End(), arena.CreateRope(chunk.Begin, chunk.GetSize())); @@ -1093,7 +1093,7 @@ inline TRope TRope::CopySpaceOptimized(TRope&& origin, size_t worstRatioPer1k, T } res.Size = origin.Size; origin = TRope(); - for (const TContiguousData& chunk : res.Chain) { + for (const TRcBuf& chunk : res.Chain) { arena.AccountChunk(chunk); } return res; diff --git a/library/cpp/actors/util/rope_ut.cpp b/library/cpp/actors/util/rope_ut.cpp index 5ca02d8043..ba7c38044f 100644 --- a/library/cpp/actors/util/rope_ut.cpp +++ b/library/cpp/actors/util/rope_ut.cpp @@ -140,11 +140,11 @@ Y_UNIT_TEST_SUITE(TRope) { Y_UNIT_TEST(ContiguousDataInterop) { TString string = "Some long-long text needed for not sharing data and testing"; - TContiguousData data(string); + TRcBuf data(string); UNIT_ASSERT_EQUAL(data.UnsafeGetDataMut(), &(*string.cbegin())); TRope rope(data); // check operator TRope UNIT_ASSERT_EQUAL(rope.UnsafeGetContiguousSpanMut().data(), &(*string.cbegin())); - TContiguousData otherData(rope); + TRcBuf otherData(rope); UNIT_ASSERT_EQUAL(otherData.UnsafeGetDataMut(), &(*string.cbegin())); TString extractedBack = otherData.ExtractUnderlyingContainerOrCopy<TString>(); UNIT_ASSERT_EQUAL(extractedBack.data(), &(*string.cbegin())); @@ -159,8 +159,8 @@ Y_UNIT_TEST_SUITE(TRope) { const TContiguousSpan constSpan(str); TMutableContiguousSpan mutableSpan(const_cast<char*>(str.data()), str.size()); const TMutableContiguousSpan constMutableSpan(const_cast<char*>(str.data()), str.size()); - TContiguousData data(str); - const TContiguousData constData(str); + TRcBuf data(str); + const TRcBuf constData(str); TArrayRef<char> arrRef(const_cast<char*>(str.data()), str.size()); const TArrayRef<char> constArrRef(const_cast<char*>(str.data()), str.size()); TArrayRef<const char> arrConstRef(const_cast<char*>(str.data()), str.size()); diff --git a/library/cpp/actors/util/shared_data_rope_backend.h b/library/cpp/actors/util/shared_data_rope_backend.h index f6f2b2a49a..2abfcf5584 100644 --- a/library/cpp/actors/util/shared_data_rope_backend.h +++ b/library/cpp/actors/util/shared_data_rope_backend.h @@ -1,6 +1,6 @@ #pragma once -#include <library/cpp/actors/util/contiguous_data.h> +#include <library/cpp/actors/util/rc_buf.h> #include "shared_data.h" diff --git a/ydb/core/base/blobstorage.h b/ydb/core/base/blobstorage.h index 727d35b279..a0f89f3970 100644 --- a/ydb/core/base/blobstorage.h +++ b/ydb/core/base/blobstorage.h @@ -910,7 +910,7 @@ struct TEvBlobStorage { }; const TLogoBlobID Id; - const TContiguousData Buffer; //FIXME(innokentii) const members prevent usage of move-semantics elsewhere + const TRcBuf Buffer; //FIXME(innokentii) const members prevent usage of move-semantics elsewhere const TInstant Deadline; const NKikimrBlobStorage::EPutHandleClass HandleClass; const ETactic Tactic; @@ -919,7 +919,7 @@ struct TEvBlobStorage { std::vector<std::pair<ui64, ui32>> ExtraBlockChecks; // (TabletId, Generation) pairs bool Decommission = false; // is it generated by decommission and should bypass all block checks? - TEvPut(const TLogoBlobID &id, TContiguousData &&buffer, TInstant deadline, + TEvPut(const TLogoBlobID &id, TRcBuf &&buffer, TInstant deadline, NKikimrBlobStorage::EPutHandleClass handleClass = NKikimrBlobStorage::TabletLog, ETactic tactic = TacticDefault) : Id(id) @@ -945,14 +945,14 @@ struct TEvBlobStorage { TEvPut(const TLogoBlobID &id, const TString &buffer, TInstant deadline, NKikimrBlobStorage::EPutHandleClass handleClass = NKikimrBlobStorage::TabletLog, ETactic tactic = TacticDefault) - : TEvPut(id, TContiguousData(buffer), deadline, handleClass, tactic) + : TEvPut(id, TRcBuf(buffer), deadline, handleClass, tactic) {} TEvPut(const TLogoBlobID &id, const TSharedData &buffer, TInstant deadline, NKikimrBlobStorage::EPutHandleClass handleClass = NKikimrBlobStorage::TabletLog, ETactic tactic = TacticDefault) - : TEvPut(id, TContiguousData(buffer), deadline, handleClass, tactic) + : TEvPut(id, TRcBuf(buffer), deadline, handleClass, tactic) {} TString Print(bool isFull) const { @@ -1343,7 +1343,7 @@ struct TEvBlobStorage { public: struct TDiff { - TContiguousData Buffer; + TRcBuf Buffer; ui32 Offset; TDiff() @@ -1352,12 +1352,12 @@ struct TEvBlobStorage { } void Set(const TString &buffer, ui32 offset) { - Buffer = TContiguousData(buffer); + Buffer = TRcBuf(buffer); Offset = offset; Y_VERIFY_S(buffer.Size(), "EvPatchDiff invalid: Diff size must be non-zero"); } - void Set(const TContiguousData &buffer, ui32 offset) { + void Set(const TRcBuf &buffer, ui32 offset) { Buffer = buffer; Offset = offset; Y_VERIFY_S(buffer.Size(), "EvPatchDiff invalid: Diff size must be non-zero"); diff --git a/ydb/core/blob_depot/agent/storage_put.cpp b/ydb/core/blob_depot/agent/storage_put.cpp index ffb4412747..2773274476 100644 --- a/ydb/core/blob_depot/agent/storage_put.cpp +++ b/ydb/core/blob_depot/agent/storage_put.cpp @@ -108,15 +108,15 @@ namespace NKikimr::NBlobDepot { locator->SetFooterLen(sizeof(TVirtualGroupBlobFooter)); } - TContiguousData footerData; + TRcBuf footerData; if (!SuppressFooter) { - footerData = TContiguousData::Uninitialized(sizeof(TVirtualGroupBlobFooter)); + footerData = TRcBuf::Uninitialized(sizeof(TVirtualGroupBlobFooter)); auto& footer = *reinterpret_cast<TVirtualGroupBlobFooter*>(footerData.UnsafeGetDataMut()); memset(&footer, 0, sizeof(footer)); footer.StoredBlobId = Request.Id; } - auto put = [&](EBlobType type, TContiguousData&& buffer) { + auto put = [&](EBlobType type, TRcBuf&& buffer) { const auto& [id, groupId] = kind.MakeBlobId(Agent, BlobSeqId, type, 0, buffer.size()); Y_VERIFY(!locator->HasGroupId() || locator->GetGroupId() == groupId); locator->SetGroupId(groupId); @@ -132,17 +132,17 @@ namespace NKikimr::NBlobDepot { if (SuppressFooter) { // write the blob as is, we don't need footer for this kind - put(EBlobType::VG_DATA_BLOB, TContiguousData(std::move(Request.Buffer))); + put(EBlobType::VG_DATA_BLOB, TRcBuf(std::move(Request.Buffer))); } else if (Request.Buffer.size() + sizeof(TVirtualGroupBlobFooter) <= MaxBlobSize) { // write single blob with footer TRope buffer = TRope(std::move(Request.Buffer)); buffer.Insert(buffer.End(), std::move(footerData)); buffer.Compact(); - put(EBlobType::VG_COMPOSITE_BLOB, TContiguousData(std::move(buffer))); + put(EBlobType::VG_COMPOSITE_BLOB, TRcBuf(std::move(buffer))); } else { // write data blob and blob with footer - put(EBlobType::VG_DATA_BLOB, TContiguousData(std::move(Request.Buffer))); - put(EBlobType::VG_FOOTER_BLOB, TContiguousData(std::move(footerData))); + put(EBlobType::VG_DATA_BLOB, TRcBuf(std::move(Request.Buffer))); + put(EBlobType::VG_FOOTER_BLOB, TRcBuf(std::move(footerData))); } if (IssueUncertainWrites) { diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.cpp index c2deb50e6e..e69b245aa0 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.cpp @@ -364,7 +364,7 @@ void TGetImpl::PrepareVPuts(TLogContext &logCtx, } bytes += put.Buffer.size(); lastItemCount++; - vMultiPut->AddVPut(put.Id, TContiguousData(TRope(put.Buffer)), &cookie, put.ExtraBlockChecks, NWilson::TTraceId()); + vMultiPut->AddVPut(put.Id, TRcBuf(TRope(put.Buffer)), &cookie, put.ExtraBlockChecks, NWilson::TTraceId()); } vMultiPut->Record.SetCookie(TVMultiPutCookie(diskOrderNumber, lastItemCount, VMultiPutRequests)); ++VMultiPutRequests; diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp index c2638c0d6e..57f9c320a3 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp @@ -387,7 +387,7 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor<TBlobSt } TEvBlobStorage::TEvPut *put; - TContiguousData buffer = TContiguousData(item.Buffer); //TODO(innokentii) prevent compaction + TRcBuf buffer = TRcBuf(item.Buffer); //TODO(innokentii) prevent compaction char* data = buffer.GetContiguousSpanMut().data(); Decrypt(data, data, 0, buffer.size(), item.BlobId, *Info); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_put_impl.h b/ydb/core/blobstorage/dsproxy/dsproxy_put_impl.h index cdda2d5715..8622f50e67 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_put_impl.h +++ b/ydb/core/blobstorage/dsproxy/dsproxy_put_impl.h @@ -496,7 +496,7 @@ protected: } else if constexpr (isVMultiPut) { // this request MUST originate from the TEvPut, so the Span field must be filled in Y_VERIFY(put.Span); - outVPutEvents.back()->AddVPut(put.Id, TContiguousData(TRope(put.Buffer)), &cookie, put.ExtraBlockChecks, put.Span->GetTraceId()); + outVPutEvents.back()->AddVPut(put.Id, TRcBuf(TRope(put.Buffer)), &cookie, put.ExtraBlockChecks, put.Span->GetTraceId()); } if (put.IsHandoff) { diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.cpp b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.cpp index 52255a86b2..92c9e98a8e 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.cpp +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.cpp @@ -422,7 +422,7 @@ namespace NKikimr { TChunkQueueItem& item = ChunkQueue.back(); // serialize it into string - TContiguousData data = TContiguousData(std::visit([](const auto& content) { return TChunkRecordMerger::Serialize(content); }, item.Content)); + TRcBuf data = TRcBuf(std::visit([](const auto& content) { return TChunkRecordMerger::Serialize(content); }, item.Content)); // generate LSN item.Lsn = Lsn++; @@ -650,7 +650,7 @@ namespace NKikimr { }; // serialize it into string, depending on its type - TContiguousData data = TContiguousData(std::visit([](const auto& content) { return TDeleteRecordMerger::Serialize(content); }, item.Content)); + TRcBuf data = TRcBuf(std::visit([](const auto& content) { return TDeleteRecordMerger::Serialize(content); }, item.Content)); // format commit record NPDisk::TCommitRecord commit; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk.h index 8692fcf926..8a01a34752 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk.h @@ -94,10 +94,10 @@ struct TCommitRecord { class TLogRecord { public: TLogSignature Signature; - TContiguousData Data; + TRcBuf Data; ui64 Lsn; - TLogRecord(TLogSignature signature, const TContiguousData &data, ui64 lsn) + TLogRecord(TLogSignature signature, const TRcBuf &data, ui64 lsn) : Signature(signature) , Data(data) , Lsn(lsn) @@ -248,7 +248,7 @@ struct TEvLog : public TEventLocal<TEvLog, TEvBlobStorage::EvLog> { using TCallback = std::unique_ptr<ICallback>; explicit TEvLog(TOwner owner, TOwnerRound ownerRound, TLogSignature signature, - const TContiguousData &data, TLsnSeg seg, void *cookie, TCallback &&cb = TCallback()) + const TRcBuf &data, TLsnSeg seg, void *cookie, TCallback &&cb = TCallback()) : Owner(owner) , OwnerRound(ownerRound) , Signature(signature) @@ -269,7 +269,7 @@ struct TEvLog : public TEventLocal<TEvLog, TEvBlobStorage::EvLog> { explicit TEvLog(TOwner owner, TOwnerRound ownerRound, TLogSignature signature, const TCommitRecord &commitRecord, - const TContiguousData &data, TLsnSeg seg, void *cookie, TCallback &&cb = TCallback()) + const TRcBuf &data, TLsnSeg seg, void *cookie, TCallback &&cb = TCallback()) : Owner(owner) , OwnerRound(ownerRound) , Signature(signature, /*commitRecord*/ true) @@ -315,7 +315,7 @@ struct TEvLog : public TEventLocal<TEvLog, TEvBlobStorage::EvLog> { TOwner Owner; TOwnerRound OwnerRound; TLogSignature Signature; - TContiguousData Data; + TRcBuf Data; ui64 LsnSegmentStart; // we may write a log record for diapason of lsns [LsnSegmentStart, Lsn]; // usually LsnSegmentStart=Lsn and this diapason is a single point ui64 Lsn; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.h index 8da5dcd578..02108aa19b 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.h @@ -196,7 +196,7 @@ public: void ReadSysLog(const TActorId &pDiskActor); // Called by actor void ProcessChunk0(const TEvReadLogResult &readLogResult); void PrintChunksDebugInfo(); - TContiguousData ProcessReadSysLogResult(ui64 &outWritePosition, ui64 &outLsn, const TEvReadLogResult &readLogResult); + TRcBuf ProcessReadSysLogResult(ui64 &outWritePosition, ui64 &outLsn, const TEvReadLogResult &readLogResult); void ReadAndParseMainLog(const TActorId &pDiskActor); void WriteFormatAsync(TDiskFormat format, const TKey &mainKey); // Called by the log reader on success with the current chunkOwnerMap. diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp index 3ce5c470e0..9b3a66786b 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp @@ -174,7 +174,7 @@ void TPDisk::ProcessChunk0(const NPDisk::TEvReadLogResult &readLogResult) { TGuard<TMutex> guard(StateMutex); ui64 writePosition = 0; ui64 lastLsn = 0; - TContiguousData lastSysLogRecord = ProcessReadSysLogResult(writePosition, lastLsn, readLogResult); + TRcBuf lastSysLogRecord = ProcessReadSysLogResult(writePosition, lastLsn, readLogResult); if (lastSysLogRecord.size() == 0) { LOG_ERROR_S(*ActorSystem, NKikimrServices::BS_PDISK, "PDiskId# " << (ui32)PDiskId << " lastSysLogRecord.Size()# 0 writePosition# " << writePosition @@ -386,7 +386,7 @@ void TPDisk::PrintChunksDebugInfo() { LOG_INFO_S(*ActorSystem, NKikimrServices::BS_PDISK, print()); } -TContiguousData TPDisk::ProcessReadSysLogResult(ui64 &outWritePosition, ui64 &outLsn, +TRcBuf TPDisk::ProcessReadSysLogResult(ui64 &outWritePosition, ui64 &outLsn, const NPDisk::TEvReadLogResult &readLogResult) { ui64 sectorIdx = (readLogResult.NextPosition.OffsetInChunk + Format.SectorSize - 1) / Format.SectorSize; ui64 firstSysLogSectorIdx = Format.FirstSysLogSectorIdx(); @@ -401,11 +401,11 @@ TContiguousData TPDisk::ProcessReadSysLogResult(ui64 &outWritePosition, ui64 &ou << " ProcessReadSysLogResult Results.size()# 0" << " Marker# BPD54"); outLsn = 0; - TContiguousData data; + TRcBuf data; return data; } ui64 lastSysLogLsn = readLogResult.Results[0].Lsn; - TContiguousData data = readLogResult.Results[0].Data; + TRcBuf data = readLogResult.Results[0].Data; for (ui32 i = 1; i < readLogResult.Results.size(); ++i) { if (lastSysLogLsn < readLogResult.Results[i].Lsn) { lastSysLogLsn = readLogResult.Results[i].Lsn; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_logreader.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_logreader.cpp index 05a22e0a53..841b89a756 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_logreader.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_logreader.cpp @@ -146,7 +146,7 @@ void TPDisk::ProcessReadLogRecord(TLogRecordHeader &header, TString &data, NPDis TOwnerData &ownerData = OwnerData[header.OwnerId]; if (ownerData.VDiskId != TVDiskID::InvalidId) { TLogSignature unmasked = header.Signature.GetUnmasked(); - ownerData.StartingPoints[unmasked] = NPDisk::TLogRecord(unmasked, TContiguousData(data), header.OwnerLsn); + ownerData.StartingPoints[unmasked] = NPDisk::TLogRecord(unmasked, TRcBuf(data), header.OwnerLsn); } } } else { @@ -180,7 +180,7 @@ void TPDisk::ProcessReadLogRecord(TLogRecordHeader &header, TString &data, NPDis ownerData.LastSeenLsn = header.OwnerLsn; } } - result->Results.push_back(NPDisk::TLogRecord(header.Signature.GetUnmasked(), TContiguousData(data), header.OwnerLsn)); + result->Results.push_back(NPDisk::TLogRecord(header.Signature.GetUnmasked(), TRcBuf(data), header.OwnerLsn)); } } } diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_requestimpl.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_requestimpl.h index 7e981933fb..e9a731d46a 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_requestimpl.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_requestimpl.h @@ -255,7 +255,7 @@ public: TLogSignature Signature; ui32 EstimatedChunkIdx; - TContiguousData Data; + TRcBuf Data; ui64 LsnSegmentStart; // Additional data, for sanity checks only. ui64 Lsn; // Log sequence number void *Cookie; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_syslogreader.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_syslogreader.cpp index 9c93ef0599..9d6df85ab2 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_syslogreader.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_syslogreader.cpp @@ -357,7 +357,7 @@ void TSysLogReader::FindMaxNonce() { void TSysLogReader::PrepareResult() { TSectorSetInfo &info = SectorSetInfo[BestRecordFirstOffset % SectorSetInfo.size()]; - TContiguousData payload(TContiguousData::Uninitialized(info.FullPayloadSize)); + TRcBuf payload(TRcBuf::Uninitialized(info.FullPayloadSize)); VerboseCheck(info.FullPayloadSize >= info.PayloadPartSize, "First payload part too large. Marker# BPS04"); if (IsReplied) { return; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut.cpp index 5e082d5848..534a82ceea 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut.cpp @@ -54,7 +54,7 @@ Y_UNIT_TEST_SUITE(TPDiskTest) { new NPDisk::TEvCheckSpace(1, 1), NKikimrProto::CORRUPTED); testCtx.TestResponse<NPDisk::TEvLogResult>( - new NPDisk::TEvLog(1, 1, 0, TContiguousData(TString()), TLsnSeg(1, 1), nullptr), + new NPDisk::TEvLog(1, 1, 0, TRcBuf(TString()), TLsnSeg(1, 1), nullptr), NKikimrProto::CORRUPTED); testCtx.TestResponse<NPDisk::TEvReadLogResult>( new NPDisk::TEvReadLog(1, 1, NPDisk::TLogPosition{0, 0}), @@ -338,7 +338,7 @@ Y_UNIT_TEST_SUITE(TPDiskTest) { ui32 lsn = 2; for (ui32 i = 0; i < 100'000; ++i) { testCtx.Send(new NPDisk::TEvLog(evInitRes->PDiskParams->Owner, evInitRes->PDiskParams->OwnerRound, 0, - TContiguousData(TString("abc")), TLsnSeg(lsn, lsn), nullptr)); + TRcBuf(TString("abc")), TLsnSeg(lsn, lsn), nullptr)); ++lsn; const auto logRes = testCtx.Recv<NPDisk::TEvLogResult>(); if (logRes->Status != NKikimrProto::OK) { @@ -466,7 +466,7 @@ Y_UNIT_TEST_SUITE(TPDiskTest) { //ui32 errors = 0; ui32 lsn = 2; - TContiguousData logData = TContiguousData(PrepareData(4096)); + TRcBuf logData = TRcBuf(PrepareData(4096)); for (ui32 i = 0; i < 1000; ++i) { testCtx.Send(new NPDisk::TEvLog(evInitRes->PDiskParams->Owner, evInitRes->PDiskParams->OwnerRound, 0, logData, TLsnSeg(lsn, lsn), nullptr)); diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp index c5db676a90..f864150b43 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp @@ -72,7 +72,7 @@ void TTestInitOwner::TestFSM(const TActorContext &ctx) { } void TTestLogStartingPoint::TestFSM(const TActorContext &ctx) { - TContiguousData data(TString("testdata")); + TRcBuf data(TString("testdata")); VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: @@ -120,7 +120,7 @@ void TTestIncorrectRequests::TestFSM(const TActorContext &ctx) { ChunkSize = LastResponse.ChunkSize; VERBOSE_COUT(" Sending TEvLog"); auto lsn = NextLsn(); - ctx.Send(Yard, new NPDisk::TEvLog(Owner+1, OwnerRound, 0, TContiguousData(), TLsnSeg(lsn, lsn), (void*)456)); + ctx.Send(Yard, new NPDisk::TEvLog(Owner+1, OwnerRound, 0, TRcBuf(), TLsnSeg(lsn, lsn), (void*)456)); break; } case 20: @@ -155,7 +155,7 @@ void TTestIncorrectRequests::TestFSM(const TActorContext &ctx) { NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks.push_back(1); auto lsn = NextLsn(); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TContiguousData(), TLsnSeg(lsn, lsn), + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TRcBuf(), TLsnSeg(lsn, lsn), (void*)43)); break; } @@ -181,7 +181,7 @@ void TTestIncorrectRequests::TestFSM(const TActorContext &ctx) { NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks.push_back(1); auto lsn = NextLsn(); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TContiguousData(), TLsnSeg(lsn, lsn), + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TRcBuf(), TLsnSeg(lsn, lsn), (void*)43)); break; } @@ -192,7 +192,7 @@ void TTestIncorrectRequests::TestFSM(const TActorContext &ctx) { NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks.push_back(3); auto lsn = NextLsn(); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TContiguousData(), TLsnSeg(lsn, lsn), + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TRcBuf(), TLsnSeg(lsn, lsn), (void*)43)); break; } @@ -203,7 +203,7 @@ void TTestIncorrectRequests::TestFSM(const TActorContext &ctx) { NPDisk::TCommitRecord commitRecord; commitRecord.DeleteChunks.push_back(0); auto lsn = NextLsn(); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TContiguousData(), TLsnSeg(lsn, lsn), + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TRcBuf(), TLsnSeg(lsn, lsn), (void*)43)); break; } @@ -214,7 +214,7 @@ void TTestIncorrectRequests::TestFSM(const TActorContext &ctx) { NPDisk::TCommitRecord commitRecord; commitRecord.DeleteChunks.push_back(1); auto lsn = NextLsn(); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TContiguousData(), TLsnSeg(lsn, lsn), + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TRcBuf(), TLsnSeg(lsn, lsn), (void*)43)); break; } @@ -225,7 +225,7 @@ void TTestIncorrectRequests::TestFSM(const TActorContext &ctx) { NPDisk::TCommitRecord commitRecord; commitRecord.DeleteChunks.push_back(3); auto lsn = NextLsn(); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TContiguousData(), TLsnSeg(lsn, lsn), + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TRcBuf(), TLsnSeg(lsn, lsn), (void*)43)); break; } @@ -236,7 +236,7 @@ void TTestIncorrectRequests::TestFSM(const TActorContext &ctx) { NPDisk::TCommitRecord commitRecord; commitRecord.DeleteChunks.push_back((ui32)-1); auto lsn = NextLsn(); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TContiguousData(), TLsnSeg(lsn, lsn), + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TRcBuf(), TLsnSeg(lsn, lsn), (void*)43)); break; } @@ -328,7 +328,7 @@ void TTestEmptyLogRead::TestFSM(const TActorContext &ctx) { void TTestChunkWriteReadWhole::TestFSM(const TActorContext &ctx) { - TContiguousData data2(TString("testdata2")); + TRcBuf data2(TString("testdata2")); VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: @@ -422,7 +422,7 @@ void TTestChunkWrite20Read02::TestFSM(const TActorContext &ctx) { for (ui32 i = 0; i < ReservedChunks.size(); ++i) { VERBOSE_COUT(" id = " << ReservedChunks[i]); } - CommitData = TContiguousData::Uninitialized(sizeof(ui32) * ReservedChunks.size()); + CommitData = TRcBuf::Uninitialized(sizeof(ui32) * ReservedChunks.size()); memcpy((void*)CommitData.data(), &(ReservedChunks[0]), sizeof(ui32) * ReservedChunks.size()); NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks = ReservedChunks; @@ -528,8 +528,8 @@ void TTestChunkRecommit::TestFSM(const TActorContext &ctx) { VERBOSE_COUT(" Sending TEvChunkWrite"); ChunkWriteData1 = PrepareData(BlockSize * 2); ChunkWriteData2 = PrepareData(BlockSize); - Commit1Data = TContiguousData(PrepareData(5030)); - Commit2Data = TContiguousData(PrepareData(5030)); + Commit1Data = TRcBuf(PrepareData(5030)); + Commit2Data = TRcBuf(PrepareData(5030)); ChunkData = ChunkWriteData1 + ChunkWriteData2; ChunkWriteParts.Reset(new NPDisk::TEvChunkWrite::TPart[1]); ChunkWriteParts[0].Data = ChunkWriteData1.data(); @@ -612,7 +612,7 @@ void TTestChunkRestartRecommit1::TestFSM(const TActorContext &ctx) { ASSERT_YTHROW(LastResponse.ChunkIds.size() == 1, "Unexpected ChunkIds.size() == " << LastResponse.ChunkIds.size()); ChunkIdx = LastResponse.ChunkIds[0]; - Commit1Data = TContiguousData(PrepareData(5030)); + Commit1Data = TRcBuf(PrepareData(5030)); VERBOSE_COUT(" Sending TEvChunkWrite"); ChunkWriteParts.Reset(new NPDisk::TEvChunkWrite::TPart[1]); ChunkWriteParts[0].Data = ChunkWriteData1.data(); @@ -626,7 +626,7 @@ void TTestChunkRestartRecommit1::TestFSM(const TActorContext &ctx) { TEST_RESPONSE(EvChunkWriteResult, OK); ASSERT_YTHROW(LastResponse.Cookie == (void*)42, "Unexpected cookie=" << LastResponse.Cookie); VERBOSE_COUT(" Sending TEvLog to commit ChunkIdx=" << ChunkIdx); - Commit1Data = TContiguousData::Uninitialized(sizeof(ChunkIdx)); + Commit1Data = TRcBuf::Uninitialized(sizeof(ChunkIdx)); *(ui32*)Commit1Data.data() = ChunkIdx; NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks.push_back(ChunkIdx); @@ -672,7 +672,7 @@ void TTestChunkRestartRecommit2::TestFSM(const TActorContext &ctx) { OwnerRound = LastResponse.OwnerRound; ChunkWriteData1 = PrepareData(LastResponse.AppendBlockSize); ChunkWriteData2 = PrepareData(LastResponse.AppendBlockSize); - Commit2Data = TContiguousData(PrepareData(5030)); + Commit2Data = TRcBuf(PrepareData(5030)); ChunkData = ChunkWriteData1 + ChunkWriteData2; VERBOSE_COUT(" Sending TEvChunkWrite ChunkIdx=" << ChunkIdx); ChunkWriteParts.Reset(new NPDisk::TEvChunkWrite::TPart[1]); @@ -737,7 +737,7 @@ void TTestChunkDelete1::TestFSM(const TActorContext &ctx) { for (ui32 i = 0; i < ReservedChunks.size(); ++i) { VERBOSE_COUT(" id = " << ReservedChunks[i]); } - CommitData = TContiguousData::Uninitialized(sizeof(ui32) * ReservedChunks.size()); + CommitData = TRcBuf::Uninitialized(sizeof(ui32) * ReservedChunks.size()); memcpy((void*)CommitData.data(), &(ReservedChunks[0]), sizeof(ui32) * ReservedChunks.size()); NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks = ReservedChunks; @@ -750,7 +750,7 @@ void TTestChunkDelete1::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog to commit Chunks"); - CommitData = TContiguousData::Uninitialized(sizeof(ui32) * (ReservedChunks.size() - 3)); + CommitData = TRcBuf::Uninitialized(sizeof(ui32) * (ReservedChunks.size() - 3)); memcpy((void*)CommitData.data(), &(ReservedChunks[3]), sizeof(ui32) * (ReservedChunks.size()-3)); NPDisk::TCommitRecord commitRecord; for (int i = 0; i < 3; ++i) { @@ -841,7 +841,7 @@ void TTestChunkForget1::TestFSM(const TActorContext &ctx) { for (ui32 i = 0; i < ReservedChunks.size(); ++i) { VERBOSE_COUT(" id = " << ReservedChunks[i]); } - CommitData = TContiguousData::Uninitialized(sizeof(ui32) * ReservedChunks.size()); + CommitData = TRcBuf::Uninitialized(sizeof(ui32) * ReservedChunks.size()); memcpy((void*)CommitData.data(), &(ReservedChunks[0]), sizeof(ui32) * ReservedChunks.size()); NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks = ReservedChunks; @@ -858,7 +858,7 @@ void TTestChunkForget1::TestFSM(const TActorContext &ctx) { case 40: TEST_RESPONSE(EvChunkReserveResult, OUT_OF_SPACE); VERBOSE_COUT(" Sending TEvLog to delete Chunks"); - CommitData = TContiguousData(); + CommitData = TRcBuf(); { NPDisk::TCommitRecord commitRecord; commitRecord.DeleteChunks = ReservedChunks; @@ -1399,14 +1399,14 @@ void TTestFirstRecordToKeepWriteAB::TestFSM(const TActorContext &ctx) { Owner = LastResponse.Owner; OwnerRound = LastResponse.OwnerRound; VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(67890)); + Data = TRcBuf(PrepareData(67890)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(Lsn, Lsn), (void*)456)); break; case 20: { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(100500)); + Data = TRcBuf(PrepareData(100500)); NPDisk::TCommitRecord commitRecord; ++Lsn; commitRecord.FirstLsnToKeep = Lsn; @@ -1441,7 +1441,7 @@ void TTestFirstRecordToKeepReadB::TestFSM(const TActorContext &ctx) { ctx.Send(Yard, new NPDisk::TEvReadLog(Owner, OwnerRound)); break; case 20: - Data = TContiguousData(PrepareData(100500)); + Data = TRcBuf(PrepareData(100500)); TEST_RESPONSE(EvReadLogResult, OK); ASSERT_YTHROW(LastResponse.LogRecords.size() == 1, "Unexpected LogRecords size == " << LastResponse.LogRecords.size()); @@ -1460,7 +1460,7 @@ void TTestLotsOfTinyAsyncLogLatency::TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: - Data = TContiguousData(PrepareData(1500)); + Data = TRcBuf(PrepareData(1500)); ASSERT_YTHROW(LastResponse.Status == NKikimrProto::OK, StatusToString(LastResponse.Status)); VERBOSE_COUT(" Sending TEvInit"); ctx.Send(Yard, new NPDisk::TEvYardInit(2, VDiskID, *PDiskGuid)); @@ -1550,7 +1550,7 @@ void TTestLogLatency::TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: - Data = TContiguousData(PrepareData(500)); + Data = TRcBuf(PrepareData(500)); ASSERT_YTHROW(LastResponse.Status == NKikimrProto::OK, StatusToString(LastResponse.Status)); VERBOSE_COUT(" Sending TEvInit"); ctx.Send(Yard, new NPDisk::TEvYardInit(2, VDiskID, *PDiskGuid)); @@ -1645,7 +1645,7 @@ void TTestHugeChunkAndLotsOfTinyAsyncLogOrder::TestFSM(const TActorContext &ctx) VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: - Data = TContiguousData(PrepareData(1500)); + Data = TRcBuf(PrepareData(1500)); ASSERT_YTHROW(LastResponse.Status == NKikimrProto::OK, StatusToString(LastResponse.Status)); VERBOSE_COUT(" Sending TEvInit"); ctx.Send(Yard, new NPDisk::TEvYardInit(2, VDiskID, *PDiskGuid)); @@ -1759,7 +1759,7 @@ void TTestHugeChunkAndLotsOfTinyAsyncLogOrder::TestFSM(const TActorContext &ctx) VERBOSE_COUT(" Sending TEvLog to commit"); NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks.push_back(ChunkIdx); - Commit1Data = TContiguousData(PrepareData(302010)); + Commit1Data = TRcBuf(PrepareData(302010)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, Commit1Data, TLsnSeg((ui64)MessagesToSend+1, (ui64)MessagesToSend+1), (void*)43)); @@ -1861,7 +1861,7 @@ void TTestLog2Records3Sectors::TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: - Data = TContiguousData(PrepareData(5500)); + Data = TRcBuf(PrepareData(5500)); ASSERT_YTHROW(LastResponse.Status == NKikimrProto::OK, StatusToString(LastResponse.Status)); VERBOSE_COUT(" Sending TEvInit"); ctx.Send(Yard, new NPDisk::TEvYardInit(2, VDiskID, *PDiskGuid)); @@ -1902,7 +1902,7 @@ void TTestLogDamageSector3Append1::TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: - Data = TContiguousData(PrepareData(5501)); + Data = TRcBuf(PrepareData(5501)); ASSERT_YTHROW(LastResponse.Status == NKikimrProto::OK, StatusToString(LastResponse.Status)); VERBOSE_COUT(" Sending TEvInit"); ctx.Send(Yard, new NPDisk::TEvYardInit(2, VDiskID, *PDiskGuid)); @@ -1957,9 +1957,9 @@ void TTestLogRead2Sectors::TestFSM(const TActorContext &ctx) { TEST_RESPONSE(EvReadLogResult, OK); ASSERT_YTHROW(LastResponse.LogRecords.size() == 2, "Unexpected LogRecords size == " << LastResponse.LogRecords.size()); - TContiguousData expectedData = TContiguousData(PrepareData(5500)); + TRcBuf expectedData = TRcBuf(PrepareData(5500)); TEST_LOG_RECORD(LastResponse.LogRecords[0], 1, 7, expectedData.ExtractUnderlyingContainerOrCopy<TString>()); - expectedData = TContiguousData(PrepareData(5501)); + expectedData = TRcBuf(PrepareData(5501)); TEST_LOG_RECORD(LastResponse.LogRecords[1], 2, 7, expectedData.ExtractUnderlyingContainerOrCopy<TString>()); VERBOSE_COUT("Done"); SignalDoneEvent(); @@ -1987,7 +1987,7 @@ void TTestLogFillChunkPlus1::TestFSM(const TActorContext &ctx) { ChunkSize = LastResponse.ChunkSize; VERBOSE_COUT(" Owner=" << (int)Owner << " ChunkSize=" << ChunkSize); VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(5 << 10)); + Data = TRcBuf(PrepareData(5 << 10)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(1, 1), (void*)456)); break; case 20: @@ -2008,13 +2008,13 @@ void TTestLogFillChunkPlus1::TestFSM(const TActorContext &ctx) { case 40: TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(ChunkSize)); + Data = TRcBuf(PrepareData(ChunkSize)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(4, 4), (void*)456)); break; case 50: TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(5 << 10)); + Data = TRcBuf(PrepareData(5 << 10)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(5, 5), (void*)456)); break; case 60: @@ -2062,7 +2062,7 @@ void TTestLogKeep5Plus1::TestFSM(const TActorContext &ctx) { TEST_LOG_RECORD(LastResponse.LogRecords[3], 5, 7, expectedData); VERBOSE_COUT(" Sending TEvLog commit"); - Data = TContiguousData(PrepareData(12 << 10)); + Data = TRcBuf(PrepareData(12 << 10)); NPDisk::TCommitRecord commitRecord; commitRecord.FirstLsnToKeep = 5; commitRecord.IsStartingPoint = true; @@ -2072,7 +2072,7 @@ void TTestLogKeep5Plus1::TestFSM(const TActorContext &ctx) { case 30: TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(1 << 10)); + Data = TRcBuf(PrepareData(1 << 10)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(7, 7), (void*)456)); break; case 40: @@ -2178,7 +2178,7 @@ void TTestWriteAndReleaseChunk2A::TestFSM(const TActorContext &ctx) { ASSERT_YTHROW(ChunkIdx == 2, "This test is designed to work with chunk 2, but got chunk " << ChunkIdx); VERBOSE_COUT(" Sending TEvLog to commit"); NPDisk::TCommitRecord commitRecord; - commitData = TContiguousData(TString("commit A data")); + commitData = TRcBuf(TString("commit A data")); commitRecord.CommitChunks.push_back(ChunkIdx); commitRecord.IsStartingPoint = true; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, commitData, TLsnSeg(1, 1), @@ -2196,7 +2196,7 @@ void TTestWriteAndReleaseChunk2A::TestFSM(const TActorContext &ctx) { TEST_DATA_EQUALS(LastResponse.Data.ToString(), ChunkWriteData); VERBOSE_COUT(" Sending TEvLog to delete"); NPDisk::TCommitRecord commitRecord; - commitData = TContiguousData(TString("delete A data")); + commitData = TRcBuf(TString("delete A data")); commitRecord.DeleteChunks.push_back(ChunkIdx); commitRecord.IsStartingPoint = true; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, commitData, TLsnSeg(2, 2), @@ -2257,7 +2257,7 @@ void TTestWriteAndCheckChunk2B::TestFSM(const TActorContext &ctx) { VERBOSE_COUT(" Sending TEvLog to commit"); NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks.push_back(ChunkIdx); - Data = TContiguousData(TString("commit B data")); + Data = TRcBuf(TString("commit B data")); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, Data, TLsnSeg(3, 3), (void*)43)); break; } @@ -2377,7 +2377,7 @@ void TTestWriteChunksAndLog::TestFSM(const TActorContext &ctx) { ASSERT_YTHROW(ChunkIdx3 == 3, "This test is designed to work with chunk 2, but got " << ChunkIdx3); VERBOSE_COUT(" Sending TEvLog to commit"); NPDisk::TCommitRecord commitRecord; - commitData = TContiguousData(TString("commit A data")); + commitData = TRcBuf(TString("commit A data")); commitRecord.CommitChunks.push_back(ChunkIdx3); commitRecord.CommitChunks.push_back(ChunkIdx2); commitRecord.IsStartingPoint = true; @@ -2390,7 +2390,7 @@ void TTestWriteChunksAndLog::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending huge TEvLog"); - TContiguousData hugeData = TContiguousData(PrepareData(ChunkSize)); + TRcBuf hugeData = TRcBuf(PrepareData(ChunkSize)); auto lsn = NextLsn(); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, hugeData, TLsnSeg(lsn, lsn), (void*)43)); break; @@ -2401,7 +2401,7 @@ void TTestWriteChunksAndLog::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending large TEvLog"); - TContiguousData largeData = TContiguousData(PrepareData(ChunkSize / 8)); + TRcBuf largeData = TRcBuf(PrepareData(ChunkSize / 8)); auto lsn = NextLsn(); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, largeData, TLsnSeg(lsn, lsn), (void*)43)); break; @@ -2410,7 +2410,7 @@ void TTestWriteChunksAndLog::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending small TEvLogs"); - TContiguousData smallData = TContiguousData(PrepareData(3000)); + TRcBuf smallData = TRcBuf(PrepareData(3000)); ui64 lsn = NextLsn(); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, smallData, TLsnSeg(lsn, lsn), (void*)43)); lsn = NextLsn(); @@ -2438,7 +2438,7 @@ void TTestWriteChunksAndLog::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending medium TEvLog"); - TContiguousData mediumData = TContiguousData(PrepareData(100500)); + TRcBuf mediumData = TRcBuf(PrepareData(100500)); auto lsn = NextLsn(); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, mediumData, TLsnSeg(lsn, lsn), (void*)43)); break; @@ -2493,7 +2493,7 @@ void TTestContinueWriteLogChunk::TestFSM(const TActorContext &ctx) { } Ctest << " Read log done" << Endl; Ctest << " Sending small TEvLogs" << Endl; - TContiguousData smallData = TContiguousData(PrepareData(3000)); + TRcBuf smallData = TRcBuf(PrepareData(3000)); ui64 lsn = NextLsn(); SentSize = smallData.size(); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, smallData, TLsnSeg(lsn, lsn), (void*)43)); @@ -2507,7 +2507,7 @@ void TTestContinueWriteLogChunk::TestFSM(const TActorContext &ctx) { SignalDoneEvent(); break; } else { - TContiguousData smallData = TContiguousData(PrepareData(3000)); + TRcBuf smallData = TRcBuf(PrepareData(3000)); ui64 lsn = NextLsn(); SentSize += smallData.size(); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, smallData, TLsnSeg(lsn, lsn), (void*)43)); @@ -2657,7 +2657,7 @@ void TTestChunkFlush::TestFSM(const TActorContext &ctx) { ASSERT_YTHROW(LastResponse.Cookie == (void*)42, "Unexpected cookie=" << LastResponse.Cookie); VERBOSE_COUT(" Sending TEvLog to set a starting point"); NPDisk::TCommitRecord commitRecord; - commitData = TContiguousData::Uninitialized(sizeof(ui32)); + commitData = TRcBuf::Uninitialized(sizeof(ui32)); *(ui32*)commitData.data() = ChunkIdx; commitRecord.IsStartingPoint = true; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, commitData, TLsnSeg(1, 1), @@ -2751,7 +2751,7 @@ void TTestRedZoneSurvivability::TestFSM(const TActorContext &ctx) { | ui32(NKikimrBlobStorage::StatusDiskSpaceLightYellowMove)); ASSERT_YTHROW(ChunkIds.size() > 0, "Unexpected ChunkIds.size() == " << ChunkIds.size()); VERBOSE_COUT(" Sending large TEvLog"); - TContiguousData tinyData = TContiguousData(PrepareData(1)); + TRcBuf tinyData = TRcBuf(PrepareData(1)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, tinyData, TLsnSeg(1, 1), (void*)43)); break; } @@ -2768,7 +2768,7 @@ void TTestRedZoneSurvivability::TestFSM(const TActorContext &ctx) { | ui32(NKikimrBlobStorage::StatusDiskSpaceLightYellowMove)); VERBOSE_COUT(" Sending TEvLog to delete a chunk"); NPDisk::TCommitRecord commitRecord; - TContiguousData commitData = TContiguousData(TString("hello")); + TRcBuf commitData = TRcBuf(TString("hello")); ui32 count = ChunkIds.size(); for (ui32 i = 0; i < count / 2; ++i) { commitRecord.DeleteChunks.push_back(ChunkIds.back()); @@ -2783,7 +2783,7 @@ void TTestRedZoneSurvivability::TestFSM(const TActorContext &ctx) { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog to log ChunkSize bytes"); - TContiguousData largeData = TContiguousData(PrepareData(ChunkSize * 20)); + TRcBuf largeData = TRcBuf(PrepareData(ChunkSize * 20)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, largeData, TLsnSeg(3, 3), (void*)43)); break; } @@ -2793,7 +2793,7 @@ void TTestRedZoneSurvivability::TestFSM(const TActorContext &ctx) { TEST_PDISK_STATUS(ui32(NKikimrBlobStorage::StatusIsValid)); VERBOSE_COUT(" Sending TEvLog to log 3 * ChunkSize bytes"); - TContiguousData largeData = TContiguousData(PrepareData(ChunkSize * 3)); + TRcBuf largeData = TRcBuf(PrepareData(ChunkSize * 3)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, largeData, TLsnSeg(4, 4), (void*)43)); break; } @@ -2804,7 +2804,7 @@ void TTestRedZoneSurvivability::TestFSM(const TActorContext &ctx) { VERBOSE_COUT(" Sending TEvLog to cut log"); NPDisk::TCommitRecord commitRecord; - TContiguousData commitData = TContiguousData(TString("cut 1")); + TRcBuf commitData = TRcBuf(TString("cut 1")); commitRecord.FirstLsnToKeep = 3; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, commitData, TLsnSeg(5, 5), (void*)43)); @@ -2815,7 +2815,7 @@ void TTestRedZoneSurvivability::TestFSM(const TActorContext &ctx) { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog to cut log"); NPDisk::TCommitRecord commitRecord; - TContiguousData commitData = TContiguousData(TString("cut 2")); + TRcBuf commitData = TRcBuf(TString("cut 2")); commitRecord.FirstLsnToKeep = 4; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, commitData, TLsnSeg(6, 6), (void*)43)); @@ -2826,7 +2826,7 @@ void TTestRedZoneSurvivability::TestFSM(const TActorContext &ctx) { TEST_RESPONSE(EvLogResult, OK); // We don't promise to update status color after cutting the log VERBOSE_COUT(" Sending TEvLog to log ChunkSize bytes"); - TContiguousData largeData = TContiguousData(PrepareData(ChunkSize)); + TRcBuf largeData = TRcBuf(PrepareData(ChunkSize)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, largeData, TLsnSeg(7, 7), (void*)43)); break; } @@ -2864,7 +2864,7 @@ void TTestFillDiskPhase1::TestFSM(const TActorContext &ctx) { OwnerRound = LastResponse.OwnerRound; ChunkSize = LastResponse.ChunkSize; MessageIdx = 0; - Data = TContiguousData(PrepareData(ChunkSize / 8)); + Data = TRcBuf(PrepareData(ChunkSize / 8)); VERBOSE_COUT(" Sending TEvChunkReserve"); ctx.Send(Yard, new NPDisk::TEvChunkReserve(Owner, OwnerRound, 1)); break; @@ -2919,7 +2919,7 @@ void TTestFillDiskPhase2::TestFSM(const TActorContext &ctx) { OwnerRound = LastResponse.OwnerRound; ChunkSize = LastResponse.ChunkSize; MessageIdx = 0; - Data = TContiguousData(PrepareData(ChunkSize / 8)); + Data = TRcBuf(PrepareData(ChunkSize / 8)); VERBOSE_COUT(" Sending TEvLog messages"); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(MessageIdx+1, MessageIdx+1), (void*)456)); @@ -2939,7 +2939,7 @@ void TTestFillDiskPhase2::TestFSM(const TActorContext &ctx) { } //TEST_RESPONSE(EvLogResult, ERROR); if (Data.size() > 2) { - Data = TContiguousData(PrepareData(Data.size() / 2)); + Data = TRcBuf(PrepareData(Data.size() / 2)); VERBOSE_COUT(" Sending TEvLog messages"); ++MessageIdx; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(MessageIdx+1, MessageIdx+1), @@ -3000,7 +3000,7 @@ void TTestHarakiri::TestFSM(const TActorContext &ctx) { // ASSERT_YTHROW(GoodChunkCount == 3, "Unexpedcted good chunk count = " << GoodChunkCount); // TODO: invalidate chunk nonces and thus render them unreadable, pass owner to read requests. VERBOSE_COUT(" Sending TEvLog"); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, TContiguousData(PrepareData(100)), TLsnSeg(123, 123), (void*)456)); + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, TRcBuf(PrepareData(100)), TLsnSeg(123, 123), (void*)456)); break; case 50: TEST_RESPONSE(EvLogResult, INVALID_OWNER); @@ -3075,7 +3075,7 @@ void TTestSlay::TestFSM(const TActorContext &ctx) { case 30: TEST_RESPONSE(EvReadLogResult, INVALID_OWNER); VERBOSE_COUT(" Sending TEvLog"); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, TContiguousData(PrepareData(100)), TLsnSeg(123, 123), (void*)456)); + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, TRcBuf(PrepareData(100)), TLsnSeg(123, 123), (void*)456)); break; case 40: TEST_RESPONSE(EvLogResult, INVALID_OWNER); @@ -3123,7 +3123,7 @@ void TTestSlayRace::TestFSM(const TActorContext &ctx) { case 30: TEST_RESPONSE(EvReadLogResult, OK); VERBOSE_COUT(" Sending TEvLog"); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, TContiguousData(PrepareData(100)), TLsnSeg(123, 123), (void*)456)); + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, TRcBuf(PrepareData(100)), TLsnSeg(123, 123), (void*)456)); break; case 40: TEST_RESPONSE(EvLogResult, OK); @@ -3190,7 +3190,7 @@ void TTestSlayRecreate::TestFSM(const TActorContext &ctx) { case 40: TEST_RESPONSE(EvReadLogResult, INVALID_ROUND); VERBOSE_COUT(" Sending TEvLog"); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, TContiguousData(PrepareData(100)), TLsnSeg(123, 123), (void*)456)); + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, TRcBuf(PrepareData(100)), TLsnSeg(123, 123), (void*)456)); break; case 50: TEST_RESPONSE(EvLogResult, INVALID_ROUND); @@ -3250,7 +3250,7 @@ void TTestDestructionWhileWritingChunk::TestFSM(const TActorContext &ctx) { } void TTestDestructionWhileReadingChunk::TestFSM(const TActorContext &ctx) { - TContiguousData data2(TString("testdata2")); + TRcBuf data2(TString("testdata2")); VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: @@ -3323,7 +3323,7 @@ void TTestDestructionWhileWritingLog::TestFSM(const TActorContext &ctx) { OwnerRound = LastResponse.OwnerRound; ChunkSize = LastResponse.ChunkSize; VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(ChunkSize)); + Data = TRcBuf(PrepareData(ChunkSize)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, Data, TLsnSeg(1, 1), (void*)43)); VERBOSE_COUT("Done"); @@ -3352,7 +3352,7 @@ void TTestDestructionWhileReadingLog::TestFSM(const TActorContext &ctx) { OwnerRound = LastResponse.OwnerRound; ChunkSize = LastResponse.ChunkSize; VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(ChunkSize)); + Data = TRcBuf(PrepareData(ChunkSize)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, Data, TLsnSeg(1, 1), (void*)43)); break; case 20: @@ -3371,7 +3371,7 @@ void TTestDestructionWhileReadingLog::TestFSM(const TActorContext &ctx) { } void TTestChunkDeletionWhileWritingIt::TestFSM(const TActorContext &ctx) { - TContiguousData data2(TString("testdata2")); + TRcBuf data2(TString("testdata2")); VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: @@ -3486,7 +3486,7 @@ void TTestAllocateAllChunks::TestFSM(const TActorContext &ctx) { ++ResponsesExpected; } } - Data = TContiguousData(PrepareData(4096)); + Data = TRcBuf(PrepareData(4096)); for (ui32 logIdx = 0; logIdx < 32; ++logIdx) { ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, Data, TLsnSeg(logIdx+1, logIdx+1), (void*)43)); ++ResponsesExpected; @@ -3510,7 +3510,7 @@ void TTestAllocateAllChunks::TestFSM(const TActorContext &ctx) { } VERBOSE_COUT(" Sending TEvLog to commit"); - Data = TContiguousData(PrepareData(ChunkSize / 4)); + Data = TRcBuf(PrepareData(ChunkSize / 4)); NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks = LastResponse.ChunkIds; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, Data, TLsnSeg(33, 33), (void*)43)); @@ -3520,7 +3520,7 @@ void TTestAllocateAllChunks::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog to delete"); - Data = TContiguousData(PrepareData(ChunkSize / 2)); + Data = TRcBuf(PrepareData(ChunkSize / 2)); NPDisk::TCommitRecord commitRecord; commitRecord.DeleteChunks.push_back(ReservedChunks.back()); ReservedChunks.pop_back(); @@ -3555,20 +3555,20 @@ void TTestCutMultipleLogChunks1::TestFSM(const TActorContext &ctx) { ChunkSize = LastResponse.ChunkSize; VERBOSE_COUT(" Owner=" << (int)Owner << " ChunkSize=" << ChunkSize); VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(ChunkSize / 2)); + Data = TRcBuf(PrepareData(ChunkSize / 2)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(1, 1), (void*)456)); break; case 20: TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(ChunkSize * 3)); + Data = TRcBuf(PrepareData(ChunkSize * 3)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(2, 2), (void*)456)); break; case 30: { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog commit"); - Data = TContiguousData(PrepareData(103)); + Data = TRcBuf(PrepareData(103)); NPDisk::TCommitRecord commitRecord; commitRecord.FirstLsnToKeep = 3; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, commitRecord, Data, TLsnSeg(3, 3), (void*)567)); @@ -3583,7 +3583,7 @@ void TTestCutMultipleLogChunks1::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvCutLog, OK); VERBOSE_COUT(" Sending TEvLog commit"); - Data = TContiguousData(PrepareData(104)); + Data = TRcBuf(PrepareData(104)); NPDisk::TCommitRecord commitRecord; commitRecord.FirstLsnToKeep = 3; commitRecord.IsStartingPoint = true; @@ -3624,7 +3624,7 @@ void TTestCutMultipleLogChunks2::TestFSM(const TActorContext &ctx) { ASSERT_YTHROW(LastResponse.StartingPoints.begin()->second.Data.size() == 104, "Unexpected StartingPoints[0].Data.size() = " << LastResponse.StartingPoints.begin()->second.Data.size()); - Data = TContiguousData(PrepareData(104)); + Data = TRcBuf(PrepareData(104)); TEST_DATA_EQUALS(LastResponse.StartingPoints.begin()->second.Data.ExtractUnderlyingContainerOrCopy<TString>(), Data.ExtractUnderlyingContainerOrCopy<TString>()); VERBOSE_COUT("Done"); @@ -3652,14 +3652,14 @@ void TTestLogOwerwrite1::TestFSM(const TActorContext &ctx) { ChunkSize = LastResponse.ChunkSize; VERBOSE_COUT(" Owner=" << (int)Owner << " ChunkSize=" << ChunkSize); VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(ChunkSize * 2, 1)); + Data = TRcBuf(PrepareData(ChunkSize * 2, 1)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(1, 1), (void*)456)); break; case 20: { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog commit"); - Data = TContiguousData(PrepareData(ChunkSize * 1, 2)); + Data = TRcBuf(PrepareData(ChunkSize * 1, 2)); NPDisk::TCommitRecord commitRecord; commitRecord.FirstLsnToKeep = 2; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, commitRecord, Data, TLsnSeg(2, 2), (void*)567)); @@ -3669,7 +3669,7 @@ void TTestLogOwerwrite1::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog commit"); - Data = TContiguousData(PrepareData(ChunkSize * 1, 3)); + Data = TRcBuf(PrepareData(ChunkSize * 1, 3)); NPDisk::TCommitRecord commitRecord; commitRecord.FirstLsnToKeep = 3; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, commitRecord, Data, TLsnSeg(3, 3), (void*)567)); @@ -3679,7 +3679,7 @@ void TTestLogOwerwrite1::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog commit"); - Data = TContiguousData(PrepareData(ChunkSize * 1, 4)); + Data = TRcBuf(PrepareData(ChunkSize * 1, 4)); NPDisk::TCommitRecord commitRecord; commitRecord.FirstLsnToKeep = 4; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, commitRecord, Data, TLsnSeg(4, 4), (void*)567)); @@ -3689,7 +3689,7 @@ void TTestLogOwerwrite1::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog commit"); - Data = TContiguousData(PrepareData(ChunkSize * 1, 5)); + Data = TRcBuf(PrepareData(ChunkSize * 1, 5)); NPDisk::TCommitRecord commitRecord; commitRecord.FirstLsnToKeep = 4; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, commitRecord, Data, TLsnSeg(5, 5), (void*)567)); @@ -3699,7 +3699,7 @@ void TTestLogOwerwrite1::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog commit"); - Data = TContiguousData(PrepareData(ChunkSize * 1, 6)); + Data = TRcBuf(PrepareData(ChunkSize * 1, 6)); NPDisk::TCommitRecord commitRecord; commitRecord.FirstLsnToKeep = 4; ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, commitRecord, Data, TLsnSeg(6, 6), (void*)567)); @@ -3709,7 +3709,7 @@ void TTestLogOwerwrite1::TestFSM(const TActorContext &ctx) { { TEST_RESPONSE(EvLogResult, OK); VERBOSE_COUT(" Sending TEvLog commit"); - Data = TContiguousData(PrepareData(107)); + Data = TRcBuf(PrepareData(107)); NPDisk::TCommitRecord commitRecord; commitRecord.FirstLsnToKeep = 5; commitRecord.IsStartingPoint = true; @@ -3746,7 +3746,7 @@ void TTestLogOwerwrite2::TestFSM(const TActorContext &ctx) { ASSERT_YTHROW(LastResponse.StartingPoints.begin()->second.Data.size() == 107, "Unexpected StartingPoints[0].Data.size() = " << LastResponse.StartingPoints.begin()->second.Data.size()); - Data = TContiguousData(PrepareData(107)); + Data = TRcBuf(PrepareData(107)); TEST_DATA_EQUALS(LastResponse.StartingPoints.begin()->second.Data.ExtractUnderlyingContainerOrCopy<TString>(), Data.ExtractUnderlyingContainerOrCopy<TString>()); VERBOSE_COUT("Done"); @@ -3772,7 +3772,7 @@ void TTestWriteAndCutLogChunk::TestFSM(const TActorContext &ctx) { Owner = LastResponse.Owner; OwnerRound = LastResponse.OwnerRound; VERBOSE_COUT(" Sending TEvLog"); - Data = TContiguousData(PrepareData(LastResponse.ChunkSize / 4)); + Data = TRcBuf(PrepareData(LastResponse.ChunkSize / 4)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, Data, TLsnSeg(Lsn, Lsn), (void*)456)); break; case 20: @@ -3808,7 +3808,7 @@ void TTestStartingPointRebootsIteration::TestFSM(const TActorContext &ctx) { ASSERT_YTHROW(LastResponse.Status == NKikimrProto::OK, StatusToString(LastResponse.Status)); VERBOSE_COUT(" Sending TEvInit"); ctx.Send(Yard, new NPDisk::TEvYardInit(2, VDiskID, *PDiskGuid)); - Commit1Data = TContiguousData(PrepareData(rand() % 50030 + 10)); + Commit1Data = TRcBuf(PrepareData(rand() % 50030 + 10)); break; case 10: TEST_RESPONSE(EvYardInitResult, OK); diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.h index a4894f1c68..52cd8bef13 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.h @@ -164,7 +164,7 @@ class TTestLogWriteRead : public TBaseTest { NPDisk::TOwnerRound OwnerRound; void TestFSM(const TActorContext &ctx) { - TContiguousData data = TContiguousData(PrepareData(Size)); + TRcBuf data = TRcBuf(PrepareData(Size)); VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: @@ -219,7 +219,7 @@ class TTestLogWrite : public TBaseTest { NPDisk::TOwnerRound OwnerRound; void TestFSM(const TActorContext &ctx) { - TContiguousData data = TContiguousData(PrepareData(Size)); + TRcBuf data = TRcBuf(PrepareData(Size)); VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: @@ -370,7 +370,7 @@ private: "Unexpected ChunkIds.size() == " << ev->ChunkIds.size()); ReservedChunks = std::move(ev->ChunkIds); ui32 logRecordSize = LogRecordSizeMin + RandGen.GenRand() % (LogRecordSizeMax - LogRecordSizeMin); - TContiguousData data = TContiguousData(PrepareData(logRecordSize)); + TRcBuf data = TRcBuf(PrepareData(logRecordSize)); NPDisk::TCommitRecord comRec{}; comRec.FirstLsnToKeep = Lsn; comRec.IsStartingPoint = true; @@ -401,7 +401,7 @@ private: TestStep -= 10; } ui32 logRecordSize = LogRecordSizeMin + RandGen.GenRand() % (LogRecordSizeMax - LogRecordSizeMin); - TContiguousData data = TContiguousData(PrepareData(logRecordSize)); + TRcBuf data = TRcBuf(PrepareData(logRecordSize)); if (Lsn % LogRecordsToKeep == 0) { NPDisk::TCommitRecord comRec{}; comRec.FirstLsnToKeep = Lsn - LogRecordsToKeep; @@ -504,7 +504,7 @@ class TTestLogWriteLsnConsistency : public TBaseTest { void TestFSM(const TActorContext &ctx) { - TContiguousData data = TContiguousData(PrepareData(2000)); + TRcBuf data = TRcBuf(PrepareData(2000)); VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: @@ -607,9 +607,9 @@ class TTestLog3Write : public TBaseTest { ui32 RecordsRemaining; void TestFSM(const TActorContext &ctx) { - TContiguousData data1 = TContiguousData(PrepareData(Size1)); - TContiguousData data2 = TContiguousData(PrepareData(Size2)); - TContiguousData data3 = TContiguousData(PrepareData(Size3)); + TRcBuf data1 = TRcBuf(PrepareData(Size1)); + TRcBuf data2 = TRcBuf(PrepareData(Size2)); + TRcBuf data3 = TRcBuf(PrepareData(Size3)); VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: @@ -705,7 +705,7 @@ class TTestChunkReadRandomOffset : public TBaseTest { VERBOSE_COUT(" Sending TEvLog to commit"); NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks.push_back(ChunkIdx); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TContiguousData(TString("")), TLsnSeg(1, 1), nullptr)); + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TRcBuf(TString("")), TLsnSeg(1, 1), nullptr)); break; } case 30: @@ -753,7 +753,7 @@ class TTestChunkWriteRead : public TBaseTest { TVector<ui32> ReservedChunks; void TestFSM(const TActorContext &ctx) { - TContiguousData data2(TString("testdata2")); + TRcBuf data2(TString("testdata2")); VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: @@ -937,7 +937,7 @@ class TTestChunkWrite20Read02 : public TBaseTest { ui32 ChunkIdx; ui32 BlockSize; TVector<ui32> ReservedChunks; - TContiguousData CommitData; + TRcBuf CommitData; void TestFSM(const TActorContext &ctx); public: @@ -954,8 +954,8 @@ class TTestChunkRecommit : public TBaseTest { NPDisk::TOwnerRound OwnerRound; TString ChunkWriteData1; TString ChunkWriteData2; - TContiguousData Commit1Data; - TContiguousData Commit2Data; + TRcBuf Commit1Data; + TRcBuf Commit2Data; TString ChunkData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; ui32 ChunkIdx; @@ -973,7 +973,7 @@ class TTestChunkRestartRecommit1 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; TString ChunkWriteData1; - TContiguousData Commit1Data; + TRcBuf Commit1Data; TString ChunkData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; ui32 ChunkIdx; @@ -990,7 +990,7 @@ class TTestChunkRestartRecommit2 : public TBaseTest { NPDisk::TOwnerRound OwnerRound; TString ChunkWriteData1; TString ChunkWriteData2; - TContiguousData Commit2Data; + TRcBuf Commit2Data; TString ChunkData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; ui32 ChunkIdx; @@ -1006,7 +1006,7 @@ class TTestChunkDelete1 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; TString ChunkWriteData; - TContiguousData CommitData; + TRcBuf CommitData; TVector<ui32> ReservedChunks; void TestFSM(const TActorContext &ctx); @@ -1019,7 +1019,7 @@ public: class TTestChunkDelete2 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData CommitData; + TRcBuf CommitData; TString ChunkData; TVector<ui32> ReservedChunks; @@ -1034,7 +1034,7 @@ class TTestChunkForget1 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; TString ChunkWriteData; - TContiguousData CommitData; + TRcBuf CommitData; TVector<ui32> ReservedChunks; void TestFSM(const TActorContext &ctx); @@ -1101,7 +1101,7 @@ class TTestChunk3WriteRead : public TBaseTest { VERBOSE_COUT(" Sending TEvLog to commit"); NPDisk::TCommitRecord commitRecord; commitRecord.CommitChunks.push_back(LastResponse.ChunkIdx); - TContiguousData data = TContiguousData(PrepareData(32)); + TRcBuf data = TRcBuf(PrepareData(32)); ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, data, TLsnSeg(1, 1), (void*)43)); break; } @@ -1168,7 +1168,7 @@ class TTestLogMultipleWriteRead : public TBaseTest { TEST_RESPONSE(EvLogResult, OK); } VERBOSE_COUT(" Sending TEvLog Lsn: " << Lsn); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, TContiguousData(PrepareData(CurrentSize)), TLsnSeg(Lsn, Lsn), + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, TRcBuf(PrepareData(CurrentSize)), TLsnSeg(Lsn, Lsn), (void*)456)); ++Lsn; ++CurrentSize; @@ -1362,7 +1362,7 @@ class TTestFirstRecordToKeepWriteAB : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui64 Lsn; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -1376,7 +1376,7 @@ public: class TTestFirstRecordToKeepReadB : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -1388,7 +1388,7 @@ public: class TTestLotsOfTinyAsyncLogLatency : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData Data; + TRcBuf Data; ui32 MessagesToSend; ui32 Responses; TInstant PreviousTime; @@ -1409,7 +1409,7 @@ public: class TTestLogLatency : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData Data; + TRcBuf Data; ui32 MessagesToSend; ui32 Responses; TInstant PreviousTime; @@ -1430,14 +1430,14 @@ public: class TTestHugeChunkAndLotsOfTinyAsyncLogOrder : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData Data; + TRcBuf Data; ui32 MessagesToSend; ui32 Responses; ui32 TotalDataSize; ui32 ChunkIdx; TString ChunkWriteData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; - TContiguousData Commit1Data; + TRcBuf Commit1Data; TInstant PreviousTime; TInstant StartTime; @@ -1474,7 +1474,7 @@ class TTestLog2Records3Sectors : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; TString ChunkWriteData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; @@ -1489,13 +1489,13 @@ template<int Size> class TTestLogMoreSectors : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep); switch (TestStep) { case 0: - Data = TContiguousData(PrepareData(Size)); + Data = TRcBuf(PrepareData(Size)); ASSERT_YTHROW(LastResponse.Status == NKikimrProto::OK, StatusToString(LastResponse.Status)); VERBOSE_COUT(" Sending TEvInit"); ctx.Send(Yard, new NPDisk::TEvYardInit(2, VDiskID, *PDiskGuid)); @@ -1505,7 +1505,7 @@ class TTestLogMoreSectors : public TBaseTest { Owner = LastResponse.Owner; OwnerRound = LastResponse.OwnerRound; VERBOSE_COUT(" Sending 1 TEvLog"); - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, TContiguousData(Data), TLsnSeg((ui64)100500, (ui64)100500), + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 7, TRcBuf(Data), TLsnSeg((ui64)100500, (ui64)100500), (void*)456)); break; case 20: @@ -1528,7 +1528,7 @@ public: class TTestLogDamageSector3Append1 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -1554,7 +1554,7 @@ class TTestLogFillChunkPlus1 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -1568,7 +1568,7 @@ public: class TTestLogKeep5Plus1 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData Data; + TRcBuf Data; ui32 ChunkSize; void TestFSM(const TActorContext &ctx); @@ -1583,7 +1583,7 @@ public: class TTestLogReadRecords2To5 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData Data; + TRcBuf Data; ui32 ChunkSize; void TestFSM(const TActorContext &ctx); @@ -1642,7 +1642,7 @@ private: return {Lsn, Lsn}; } - void SendEvLog(const TActorContext& ctx, TMaybe<NPDisk::TCommitRecord> commit, TContiguousData data) { + void SendEvLog(const TActorContext& ctx, TMaybe<NPDisk::TCommitRecord> commit, TRcBuf data) { if (commit) { ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, *commit, data, GenLsnSeg(), nullptr)); } else { @@ -1691,7 +1691,7 @@ private: ++LogRecordsWritten; if (LogRecordsWritten < LogRecordsToWrite) { - SendEvLog(ctx, {}, TContiguousData(Garbage)); + SendEvLog(ctx, {}, TRcBuf(Garbage)); TestStep -= 10; } else { TLogRecAboutChunks log; @@ -1699,7 +1699,7 @@ private: for (ui32 i = 0; i < CommittedChunks.size(); ++i) { log.Data.CommittedChunks[i] = CommittedChunks[i]; } - TContiguousData commitedChunksList = TContiguousData::Uninitialized(sizeof(log)); + TRcBuf commitedChunksList = TRcBuf::Uninitialized(sizeof(log)); memcpy(commitedChunksList.UnsafeGetDataMut(), &log, sizeof(log)); NPDisk::TCommitRecord commitRecord; commitRecord.IsStartingPoint = true; @@ -1720,7 +1720,7 @@ private: log.Type = EDeleteChunk; log.Data.DeletedChunk = CommittedChunks.back(); Ctest << "MyNum# " << MyNum << " Delete chunk# " << CommittedChunks.back() << Endl; - TContiguousData deleteChunkLog = TContiguousData::Uninitialized(sizeof(log)); + TRcBuf deleteChunkLog = TRcBuf::Uninitialized(sizeof(log)); memcpy(deleteChunkLog.UnsafeGetDataMut(), &log, sizeof(log)); commitRecord.DeleteChunks.push_back(CommittedChunks.back()); CommittedChunks.pop_back(); @@ -1861,7 +1861,7 @@ template <ui32 Size> class TTestCommitChunks : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData Commit1Data; + TRcBuf Commit1Data; TString ChunkData; ui32 ChunkIdx; @@ -1893,7 +1893,7 @@ class TTestCommitChunks : public TBaseTest { commitRecord.CommitChunks.push_back(LastResponse.ChunkIds[i]); } commitRecord.IsStartingPoint = true; - ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TContiguousData(Commit1Data), TLsnSeg(1, 1), + ctx.Send(Yard, new NPDisk::TEvLog(Owner, OwnerRound, 0, commitRecord, TRcBuf(Commit1Data), TLsnSeg(1, 1), (void*)43)); break; } @@ -1922,7 +1922,7 @@ class TTestWriteAndReleaseChunk2A : public TBaseTest { TString ChunkWriteData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; ui32 ChunkIdx; - TContiguousData commitData; + TRcBuf commitData; void TestFSM(const TActorContext &ctx); public: @@ -1939,7 +1939,7 @@ class TTestWriteAndCheckChunk2B : public TBaseTest { TString ChunkWriteData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; ui32 ChunkIdx; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -1973,7 +1973,7 @@ class TTestWriteChunksAndLog : public TBaseTest { TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; ui32 ChunkIdx2; ui32 ChunkIdx3; - TContiguousData commitData; + TRcBuf commitData; ui64 Lsn; ui64 NextLsn() { @@ -2028,7 +2028,7 @@ class TTestCheckLog : public TBaseTest { ui32 ChunkSize; TString ChunkWriteData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; - TContiguousData commitData; + TRcBuf commitData; void TestFSM(const TActorContext &ctx); public: @@ -2044,7 +2044,7 @@ class TTestChunkFlush : public TBaseTest { TString ChunkWriteData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; ui32 ChunkIdx; - TContiguousData commitData; + TRcBuf commitData; void TestFSM(const TActorContext &ctx); public: @@ -2083,7 +2083,7 @@ class TTestFillDiskPhase1 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; ui32 MessageIdx; TString ChunkWriteData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; @@ -2100,7 +2100,7 @@ class TTestFillDiskPhase2 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; ui32 MessageIdx; TString ChunkWriteData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; @@ -2201,7 +2201,7 @@ class TActorTestSlayLogWriteRace final : public TCommonBaseTest { if (i == LogWriteCount - 10) { ctx.Send(Yard, new NPDisk::TEvSlay(VDiskID, OwnerRound + 1, 1, 1)); } - TContiguousData data = TContiguousData(PrepareData(842)); + TRcBuf data = TRcBuf(PrepareData(842)); if (i == 0) { NPDisk::TCommitRecord commit; commit.IsStartingPoint = true; @@ -2288,7 +2288,7 @@ class TTestDestructionWhileWritingChunk : public TBaseTest { ui32 ChunkSize; TString ChunkWriteData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; - TContiguousData commitData; + TRcBuf commitData; void TestFSM(const TActorContext &ctx); public: @@ -2317,7 +2317,7 @@ class TTestDestructionWhileWritingLog : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -2330,7 +2330,7 @@ class TTestDestructionWhileReadingLog : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -2359,7 +2359,7 @@ class TTestAllocateAllChunks : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; ui32 MessageIdx; TString ChunkWriteData; TArrayHolder<NPDisk::TEvChunkWrite::TPart> ChunkWriteParts; @@ -2378,7 +2378,7 @@ class TTestCutMultipleLogChunks1 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -2391,7 +2391,7 @@ class TTestCutMultipleLogChunks2 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -2404,7 +2404,7 @@ class TTestLogOwerwrite1 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -2417,7 +2417,7 @@ class TTestLogOwerwrite2 : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui32 ChunkSize; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -2430,7 +2430,7 @@ class TTestWriteAndCutLogChunk : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; ui64 Lsn; - TContiguousData Data; + TRcBuf Data; void TestFSM(const TActorContext &ctx); public: @@ -2445,7 +2445,7 @@ public: class TTestStartingPointRebootsIteration : public TBaseTest { NPDisk::TOwner Owner; NPDisk::TOwnerRound OwnerRound; - TContiguousData Commit1Data; + TRcBuf Commit1Data; ui64 FirstLsn; ui64 StartingPointLsn; ui64 NextLsn; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_defs.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_defs.h index 0fedd38775..0b98ccdbbc 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_defs.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_defs.h @@ -104,7 +104,7 @@ do { \ do { \ ASSERT_YTHROW((record).Lsn == (lsn), "Unexpected Lsn == " << (record).Lsn << " instead of: " << (lsn)); \ ASSERT_YTHROW((record).Signature == (signature), "Unexpected Signature == " << (ui32)(record).Signature); \ - TEST_DATA_EQUALS(TContiguousData((record).Data).ExtractUnderlyingContainerOrCopy<TString>(), (data)); \ + TEST_DATA_EQUALS(TRcBuf((record).Data).ExtractUnderlyingContainerOrCopy<TString>(), (data)); \ } while(false) #define TEST_PDISK_STATUS(s) \ diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_env.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_env.cpp index e339bb88f6..8fe6ce9009 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_env.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_env.cpp @@ -30,7 +30,7 @@ void TestChunkWriteReleaseRun() { commitRecord.CommitChunks.push_back(reservedChunk); testCtx.TestResponse<NPDisk::TEvLogResult>( new NPDisk::TEvLog(evInitRes->PDiskParams->Owner, evInitRes->PDiskParams->OwnerRound, 0, commitRecord, - TContiguousData(TString()), TLsnSeg(1, 1), nullptr), + TRcBuf(TString()), TLsnSeg(1, 1), nullptr), NKikimrProto::OK); const auto evControlRes = testCtx.TestResponse<NPDisk::TEvYardControlResult>( @@ -43,7 +43,7 @@ void TestChunkWriteReleaseRun() { NPDisk::TCommitRecord commitRecord; commitRecord.DeleteChunks.push_back(reservedChunk); NPDisk::TEvLog ev(evInitRes->PDiskParams->Owner, evInitRes->PDiskParams->OwnerRound, 0, commitRecord, - TContiguousData(TString()), TLsnSeg(2, 2), nullptr); + TRcBuf(TString()), TLsnSeg(2, 2), nullptr); NPDisk::TLogWrite *log = new NPDisk::TLogWrite(ev, testCtx.Sender, 0, {}, {}); bool ok = pDisk->PreprocessRequest(log); UNIT_ASSERT(ok); diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_env.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_env.h index e3093759c4..8211700e83 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_env.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_env.h @@ -289,7 +289,7 @@ struct TVDiskMock { private: void SendEvLogImpl(const ui64 size, TMaybe<NPDisk::TCommitRecord> commitRec) { - auto evLog = MakeHolder<NPDisk::TEvLog>(PDiskParams->Owner, PDiskParams->OwnerRound, 0, TContiguousData(PrepareData(size)), + auto evLog = MakeHolder<NPDisk::TEvLog>(PDiskParams->Owner, PDiskParams->OwnerRound, 0, TRcBuf(PrepareData(size)), GetLsnSeg(), nullptr); if (commitRec) { diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_races.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_races.cpp index 2f104d1c3d..eb80d371ee 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_races.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_races.cpp @@ -19,7 +19,7 @@ Y_UNIT_TEST_SUITE(TPDiskRaces) { const TString data = PrepareData(4096); auto logNoTest = [&](TVDiskMock& mock, NPDisk::TCommitRecord rec) { - auto evLog = MakeHolder<NPDisk::TEvLog>(mock.PDiskParams->Owner, mock.PDiskParams->OwnerRound, 0, TContiguousData(PrepareData(1)), + auto evLog = MakeHolder<NPDisk::TEvLog>(mock.PDiskParams->Owner, mock.PDiskParams->OwnerRound, 0, TRcBuf(PrepareData(1)), mock.GetLsnSeg(), nullptr); evLog->Signature.SetCommitRecord(); evLog->CommitRecord = std::move(rec); @@ -95,7 +95,7 @@ Y_UNIT_TEST_SUITE(TPDiskRaces) { const TString data = PrepareData(4096); auto logNoTest = [&](TVDiskMock& mock, NPDisk::TCommitRecord rec) { - auto evLog = MakeHolder<NPDisk::TEvLog>(mock.PDiskParams->Owner, mock.PDiskParams->OwnerRound, 0, TContiguousData(PrepareData(1)), + auto evLog = MakeHolder<NPDisk::TEvLog>(mock.PDiskParams->Owner, mock.PDiskParams->OwnerRound, 0, TRcBuf(PrepareData(1)), mock.GetLsnSeg(), nullptr); evLog->Signature.SetCommitRecord(); evLog->CommitRecord = std::move(rec); @@ -190,7 +190,7 @@ Y_UNIT_TEST_SUITE(TPDiskRaces) { const TString data = PrepareData(4096); auto logNoTest = [&](TVDiskMock& mock, NPDisk::TCommitRecord rec) { - auto evLog = MakeHolder<NPDisk::TEvLog>(mock.PDiskParams->Owner, mock.PDiskParams->OwnerRound, 0, TContiguousData(PrepareData(1)), + auto evLog = MakeHolder<NPDisk::TEvLog>(mock.PDiskParams->Owner, mock.PDiskParams->OwnerRound, 0, TRcBuf(PrepareData(1)), mock.GetLsnSeg(), nullptr); evLog->Signature.SetCommitRecord(); evLog->CommitRecord = std::move(rec); diff --git a/ydb/core/blobstorage/pdisk/mock/pdisk_mock.cpp b/ydb/core/blobstorage/pdisk/mock/pdisk_mock.cpp index ce4fef136b..44bc4c48f6 100644 --- a/ydb/core/blobstorage/pdisk/mock/pdisk_mock.cpp +++ b/ydb/core/blobstorage/pdisk/mock/pdisk_mock.cpp @@ -492,7 +492,7 @@ public: } isStartingPoint = cr.IsStartingPoint; } - owner.Log.emplace_back(msg->Signature.GetUnmasked(), TContiguousData(msg->Data), msg->Lsn); + owner.Log.emplace_back(msg->Signature.GetUnmasked(), TRcBuf(msg->Data), msg->Lsn); owner.LogDataSize += msg->Data.size(); if (isStartingPoint) { owner.StartingPoints[msg->Signature.GetUnmasked()] = owner.Log.back(); diff --git a/ydb/core/blobstorage/testload/test_load_pdisk_log.cpp b/ydb/core/blobstorage/testload/test_load_pdisk_log.cpp index 2bc899d731..053807a4d8 100644 --- a/ydb/core/blobstorage/testload/test_load_pdisk_log.cpp +++ b/ydb/core/blobstorage/testload/test_load_pdisk_log.cpp @@ -57,7 +57,7 @@ class TWorker { ui64 StartingPoint = 0; ui64 NextStartingPoint = Lsn; - TContiguousData DataBuffer; + TRcBuf DataBuffer; TReallyFastRng32 *Gen; TIntrusivePtr<TPDiskParams> PDiskParams; @@ -86,7 +86,7 @@ public: SizeMin = cmd.GetSizeIntervalMin(); VERIFY_PARAM(SizeIntervalMax); SizeMax = cmd.GetSizeIntervalMax(); - DataBuffer = TContiguousData::Uninitialized(SizeMax); + DataBuffer = TRcBuf::Uninitialized(SizeMax); ::memset(DataBuffer.UnsafeGetDataMut(), 0, SizeMax); VERIFY_PARAM(VDiskId); diff --git a/ydb/core/blobstorage/testload/test_load_pdisk_read.cpp b/ydb/core/blobstorage/testload/test_load_pdisk_read.cpp index 626f0f168f..6715647035 100644 --- a/ydb/core/blobstorage/testload/test_load_pdisk_read.cpp +++ b/ydb/core/blobstorage/testload/test_load_pdisk_read.cpp @@ -442,7 +442,7 @@ public: TLsnSeg seg(Lsn, Lsn); ++Lsn; SendRequest(ctx, std::make_unique<NPDisk::TEvLog>(PDiskParams->Owner, PDiskParams->OwnerRound, - TLogSignature::SignatureHugeLogoBlob, record, TContiguousData(logRecord), seg, + TLogSignature::SignatureHugeLogoBlob, record, TRcBuf(logRecord), seg, reinterpret_cast<void*>(requestIdx))); ++LogInFlight; } diff --git a/ydb/core/blobstorage/testload/test_load_pdisk_write.cpp b/ydb/core/blobstorage/testload/test_load_pdisk_write.cpp index 48d84d68ad..1db02249f8 100644 --- a/ydb/core/blobstorage/testload/test_load_pdisk_write.cpp +++ b/ydb/core/blobstorage/testload/test_load_pdisk_write.cpp @@ -482,7 +482,7 @@ public: TLsnSeg seg(Lsn, Lsn); ++Lsn; SendRequest(ctx, std::make_unique<NPDisk::TEvLog>(PDiskParams->Owner, PDiskParams->OwnerRound, - TLogSignature::SignatureHugeLogoBlob, record, TContiguousData(logRecord), seg, + TLogSignature::SignatureHugeLogoBlob, record, TRcBuf(logRecord), seg, reinterpret_cast<void*>(requestIdx))); ++LogInFlight; } diff --git a/ydb/core/blobstorage/ut_blobstorage/incorrect_queries.cpp b/ydb/core/blobstorage/ut_blobstorage/incorrect_queries.cpp index d5c06f4a71..7e1d7e66c8 100644 --- a/ydb/core/blobstorage/ut_blobstorage/incorrect_queries.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/incorrect_queries.cpp @@ -80,7 +80,7 @@ Y_UNIT_TEST_SUITE(IncorrectQueries) { TInstant::Max(), NKikimrBlobStorage::EPutHandleClass::TabletLog, false, nullptr)); for(auto [blob, data, status] : blobs) { - static_cast<TEvBlobStorage::TEvVMultiPut*>(ev.get())->AddVPut(blob, TContiguousData(data), nullptr, nullptr, NWilson::TTraceId()); + static_cast<TEvBlobStorage::TEvVMultiPut*>(ev.get())->AddVPut(blob, TRcBuf(data), nullptr, nullptr, NWilson::TTraceId()); } static_cast<TEvBlobStorage::TEvVMultiPut*>(ev.get())->Record = proto; @@ -105,7 +105,7 @@ Y_UNIT_TEST_SUITE(IncorrectQueries) { TInstant::Max(), NKikimrBlobStorage::EPutHandleClass::TabletLog, false, nullptr)); for(auto [blob, data, status] : blobs) { - static_cast<TEvBlobStorage::TEvVMultiPut*>(ev.get())->AddVPut(blob, TContiguousData(data), nullptr, nullptr, NWilson::TTraceId()); + static_cast<TEvBlobStorage::TEvVMultiPut*>(ev.get())->AddVPut(blob, TRcBuf(data), nullptr, nullptr, NWilson::TTraceId()); } env.WithQueueId(test.Info->GetVDiskInSubgroup(0, blobs[0].BlobId.Hash()), NKikimrBlobStorage::EVDiskQueueId::PutTabletLog, [&](TActorId queueId) { @@ -528,7 +528,7 @@ Y_UNIT_TEST_SUITE(IncorrectQueries) { if (i % 19 != 18) { ++goodCount; TLogoBlobID blob(i, 1, 0, 0, blobSize, 0, 1); - static_cast<TEvBlobStorage::TEvVMultiPut*>(events[i].get())->AddVPut(blob, TContiguousData(data), nullptr, nullptr, NWilson::TTraceId()); + static_cast<TEvBlobStorage::TEvVMultiPut*>(events[i].get())->AddVPut(blob, TRcBuf(data), nullptr, nullptr, NWilson::TTraceId()); } } diff --git a/ydb/core/blobstorage/ut_mirror3of4/main.cpp b/ydb/core/blobstorage/ut_mirror3of4/main.cpp index a4bb17a46b..7a14985327 100644 --- a/ydb/core/blobstorage/ut_mirror3of4/main.cpp +++ b/ydb/core/blobstorage/ut_mirror3of4/main.cpp @@ -182,7 +182,7 @@ public: } NKikimrProto::EReplyStatus Put(const TVDiskID& vdiskId, const TLogoBlobID& blobId, const TString& data) { - TContiguousData dataWithHeadroom(TContiguousData::Uninitialized(data.size(), 32)); + TRcBuf dataWithHeadroom(TRcBuf::Uninitialized(data.size(), 32)); std::memcpy(dataWithHeadroom.UnsafeGetDataMut(), data.data(), data.size()); Send(GetBackpressureFor(Info->GetOrderNumber(vdiskId)), new TEvBlobStorage::TEvVPut(blobId, TRope(dataWithHeadroom), vdiskId, false, nullptr, TInstant::Max(), NKikimrBlobStorage::EPutHandleClass::TabletLog)); diff --git a/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.cpp b/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.cpp index b99052d54f..22f2813179 100644 --- a/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.cpp +++ b/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.cpp @@ -499,7 +499,7 @@ public: void IssueLogMessage(TLogSignature signature, const TActorContext& ctx) { ui32 size = Params.SizeMin + RandomNumber<ui32>(Params.SizeMax - Params.SizeMin + 1); - TContiguousData data = TContiguousData(GenerateRandomDataBuffer(size)); + TRcBuf data = TRcBuf(GenerateRandomDataBuffer(size)); auto *info = new TLogRecord; info->Signature = signature; diff --git a/ydb/core/blobstorage/ut_vdisk/lib/helpers.cpp b/ydb/core/blobstorage/ut_vdisk/lib/helpers.cpp index 420ef098dd..d83bc66157 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/helpers.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/helpers.cpp @@ -448,7 +448,7 @@ class TManyMultiPuts : public TActorBootstrapped<TManyMultiPuts> { TVDiskIdShort mainVDiskId = TIngress::GetMainReplica(&Conf->GroupInfo->GetTopology(), logoBlobID); if (mainVDiskId == VDiskInfo.VDiskID) { ui64 cookieValue = Step; - vMultiPut->AddVPut(logoBlobID, TContiguousData(MsgData), &cookieValue, nullptr, NWilson::TTraceId()); + vMultiPut->AddVPut(logoBlobID, TRcBuf(MsgData), &cookieValue, nullptr, NWilson::TTraceId()); putCount++; Step++; diff --git a/ydb/core/blobstorage/ut_vdisk/lib/test_huge.cpp b/ydb/core/blobstorage/ut_vdisk/lib/test_huge.cpp index 6d21514b2a..c3f9c9ded0 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/test_huge.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/test_huge.cpp @@ -158,7 +158,7 @@ class THugeModuleRecoveryActor : public TActorBootstrapped<THugeModuleRecoveryAc } else { // read existing one const ui64 lsn = it->second.Lsn; - const TContiguousData &entryPoint = it->second.Data; + const TRcBuf &entryPoint = it->second.Data; if (!THullHugeKeeperPersState::CheckEntryPoint(entryPoint)) { return false; } diff --git a/ydb/core/blobstorage/ut_vdisk/lib/test_synclog.cpp b/ydb/core/blobstorage/ut_vdisk/lib/test_synclog.cpp index 6ea42fdb47..04a821a497 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/test_synclog.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/test_synclog.cpp @@ -68,7 +68,7 @@ class TDataWriterActor : public TActorBootstrapped<TDataWriterActor> { TIntrusivePtr<TEventSerializedData> buffers = serializer.Release(logCmd.IsExtendedFormat()); ctx.Send(TestCtx->LoggerId, new NPDisk::TEvLog(TestCtx->PDiskCtx->Dsk->Owner, TestCtx->PDiskCtx->Dsk->OwnerRound, - TLogSignature::SignatureBlock, TContiguousData(buffers->GetString()), seg, nullptr)); + TLogSignature::SignatureBlock, TRcBuf(buffers->GetString()), seg, nullptr)); // FIXME: problems on reboot ctx.Send(TestCtx->SyncLogId, new NSyncLog::TEvSyncLogPut(seg.Point(), tabletId, Generation, 0)); } diff --git a/ydb/core/blobstorage/vdisk/common/blobstorage_dblogcutter.cpp b/ydb/core/blobstorage/vdisk/common/blobstorage_dblogcutter.cpp index 12c9e6d6c3..1b59c4b386 100644 --- a/ydb/core/blobstorage/vdisk/common/blobstorage_dblogcutter.cpp +++ b/ydb/core/blobstorage/vdisk/common/blobstorage_dblogcutter.cpp @@ -133,7 +133,7 @@ namespace NKikimr { ui8 signature = TLogSignature::SignatureHullCutLog; ctx.Send(LogCutterCtx.LoggerId, new NPDisk::TEvLog(LogCutterCtx.PDiskCtx->Dsk->Owner, - LogCutterCtx.PDiskCtx->Dsk->OwnerRound, signature, commitRec, TContiguousData(), seg, nullptr)); + LogCutterCtx.PDiskCtx->Dsk->OwnerRound, signature, commitRec, TRcBuf(), seg, nullptr)); WriteInProgress = true; FreeUpToLsnLastWritten = *freeUpToLsn; diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_events.cpp b/ydb/core/blobstorage/vdisk/common/vdisk_events.cpp index 128d4eb116..fdcc002b4b 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_events.cpp +++ b/ydb/core/blobstorage/vdisk/common/vdisk_events.cpp @@ -39,7 +39,7 @@ namespace NKikimr { AddPayload(std::move(buffer)); } - void TEvBlobStorage::TEvVMultiPut::StorePayload(NKikimrBlobStorage::TVMultiPutItem &item, const TContiguousData& buffer) { + void TEvBlobStorage::TEvVMultiPut::StorePayload(NKikimrBlobStorage::TVMultiPutItem &item, const TRcBuf& buffer) { if (KIKIMR_USE_PROTOBUF_WITH_PAYLOAD) { AddPayload(TRope(buffer)); Y_VERIFY_DEBUG(Record.ItemsSize() == GetPayloadCount()); diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_events.h b/ydb/core/blobstorage/vdisk/common/vdisk_events.h index 0e6e6368fd..e017225c5e 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_events.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_events.h @@ -815,12 +815,12 @@ namespace NKikimr { return sum; } - void StorePayload(NKikimrBlobStorage::TVMultiPutItem &item, const TContiguousData &buffer); + void StorePayload(NKikimrBlobStorage::TVMultiPutItem &item, const TRcBuf &buffer); TRope GetItemBuffer(ui64 itemIdx) const; - void AddVPut(const TLogoBlobID &logoBlobId, const TContiguousData &buffer, ui64 *cookie, + void AddVPut(const TLogoBlobID &logoBlobId, const TRcBuf &buffer, ui64 *cookie, std::vector<std::pair<ui64, ui32>> *extraBlockChecks, NWilson::TTraceId traceId) { NKikimrBlobStorage::TVMultiPutItem *item = Record.AddItems(); LogoBlobIDFromLogoBlobID(logoBlobId, item->MutableBlobID()); @@ -1475,7 +1475,7 @@ namespace NKikimr { diffBlock->SetBuffer(buffer); } - void AddDiff(ui64 startIdx, const TContiguousData &buffer) { + void AddDiff(ui64 startIdx, const TRcBuf &buffer) { TLogoBlobID id = LogoBlobIDFromLogoBlobID(this->Record.GetOriginalBlobId()); Y_VERIFY(startIdx < id.BlobSize()); REQUEST_VALGRIND_CHECK_MEM_IS_DEFINED(&buffer, sizeof(buffer)); @@ -1927,7 +1927,7 @@ namespace NKikimr { r->SetBuffer(buffer.data(), buffer.size()); } - void AddDiff(ui64 startIdx, const TContiguousData &buffer) { + void AddDiff(ui64 startIdx, const TRcBuf &buffer) { REQUEST_VALGRIND_CHECK_MEM_IS_DEFINED(buffer.data(), buffer.size()); NKikimrBlobStorage::TDiffBlock *r = Record.AddDiffs(); @@ -1991,7 +1991,7 @@ namespace NKikimr { Record.MutableMsgQoS()->SetExtQueueId(NKikimrBlobStorage::EVDiskQueueId::PutAsyncBlob); } - void AddDiff(ui64 startIdx, const TContiguousData &buffer) { + void AddDiff(ui64 startIdx, const TRcBuf &buffer) { REQUEST_VALGRIND_CHECK_MEM_IS_DEFINED(buffer.data(), buffer.size()); NKikimrBlobStorage::TDiffBlock *r = Record.AddDiffs(); diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp index b26712a1c9..9840aae214 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp @@ -289,7 +289,7 @@ namespace NKikimr { // prepare log record NHuge::TAllocChunkRecoveryLogRec logRec(ChunkId); - TContiguousData data = TContiguousData(logRec.Serialize()); + TRcBuf data = TRcBuf(logRec.Serialize()); LOG_INFO(ctx, NKikimrServices::BS_SKELETON, VDISKP(HugeKeeperCtx->VCtx->VDiskLogPrefix, @@ -356,7 +356,7 @@ namespace NKikimr { // prepare log record Y_VERIFY_DEBUG(!ChunksToFree.empty()); NHuge::TFreeChunkRecoveryLogRec logRec(ChunksToFree); - TContiguousData data = TContiguousData(logRec.Serialize()); + TRcBuf data = TRcBuf(logRec.Serialize()); LOG_DEBUG(ctx, BS_HULLHUGE, VDISKP(HugeKeeperCtx->VCtx->VDiskLogPrefix, "ChunkDestroyer: bootstrap:" " chunks# %s Lsn# %" PRIu64, FormatList(ChunksToFree).data(), Lsn)); @@ -440,7 +440,7 @@ namespace NKikimr { TLsnSeg seg(EntryPointLsn, EntryPointLsn); ctx.Send(HugeKeeperCtx->LoggerId, new NPDisk::TEvLog(HugeKeeperCtx->PDiskCtx->Dsk->Owner, HugeKeeperCtx->PDiskCtx->Dsk->OwnerRound, - TLogSignature::SignatureHugeBlobEntryPoint, commitRecord, TContiguousData(Serialized), seg, nullptr)); //FIXME(innokentii): wrapping + TLogSignature::SignatureHugeBlobEntryPoint, commitRecord, TRcBuf(Serialized), seg, nullptr)); //FIXME(innokentii): wrapping TThis::Become(&TThis::StateFunc); } diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp index dddb9e0f01..3ab1858cea 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp +++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp @@ -32,14 +32,14 @@ namespace NKikimr { return res; } - TContiguousData TPutRecoveryLogRecOpt::SerializeZeroCopy(const TBlobStorageGroupType >ype, const TLogoBlobID &id, + TRcBuf TPutRecoveryLogRecOpt::SerializeZeroCopy(const TBlobStorageGroupType >ype, const TLogoBlobID &id, TRope &&rope) { rope.Compact(24); - return SerializeZeroCopy(gtype, id, TContiguousData(rope)); + return SerializeZeroCopy(gtype, id, TRcBuf(rope)); } - TContiguousData TPutRecoveryLogRecOpt::SerializeZeroCopy(const TBlobStorageGroupType >ype, const TLogoBlobID &id, - TContiguousData &&data) { + TRcBuf TPutRecoveryLogRecOpt::SerializeZeroCopy(const TBlobStorageGroupType >ype, const TLogoBlobID &id, + TRcBuf &&data) { Y_VERIFY(id.PartId() && data.GetSize() == gtype.PartSize(id), "id# %s rope.GetSize()# %zu", id.ToString().data(), data.GetSize()); diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h index 5abca4a836..c0edacd2dc 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h +++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h @@ -189,9 +189,9 @@ namespace NKikimr { static TString Serialize(const TBlobStorageGroupType >ype, const TLogoBlobID &id, const TRope &rope); // Will serialize inplace if container has enough headroom and right (single) underlying type - static TContiguousData SerializeZeroCopy(const TBlobStorageGroupType >ype, const TLogoBlobID &id, TRope &&rope); + static TRcBuf SerializeZeroCopy(const TBlobStorageGroupType >ype, const TLogoBlobID &id, TRope &&rope); // Will serialize inplace if container has enough headroom - static TContiguousData SerializeZeroCopy(const TBlobStorageGroupType >ype, const TLogoBlobID &id, TContiguousData &&data); + static TRcBuf SerializeZeroCopy(const TBlobStorageGroupType >ype, const TLogoBlobID &id, TRcBuf &&data); bool ParseFromString(const TBlobStorageGroupType >ype, const TString &data); bool ParseFromArray(const TBlobStorageGroupType >ype, const char* data, size_t size); TString ToString() const; diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcommit.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcommit.h index ebd4b47c32..fd0d71fcd1 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcommit.h +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcommit.h @@ -257,7 +257,7 @@ namespace NKikimr { if (CallerInfo) { DebugMessage << " caller# " << CallerInfo; } - TContiguousData data = TContiguousData(GenerateEntryPointData()); + TRcBuf data = TRcBuf(GenerateEntryPointData()); CommitMsg = std::make_unique<NPDisk::TEvLog>(Ctx->PDiskCtx->Dsk->Owner, Ctx->PDiskCtx->Dsk->OwnerRound, PDiskSignatureForHullDbKey<TKey>(), CommitRecord, data, LsnSeg, nullptr); } diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.cpp b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.cpp index ef161ac4d8..dfea0b6f8d 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.cpp +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.cpp @@ -57,7 +57,7 @@ namespace NKikimr { return std::make_unique<NPDisk::TEvLog>(hullLogCtx->PDiskCtx->Dsk->Owner, hullLogCtx->PDiskCtx->Dsk->OwnerRound, signature, - TContiguousData(data), //FIXME(innokentii) wrapping + TRcBuf(data), //FIXME(innokentii) wrapping seg, cookie, std::move(callback)); @@ -79,14 +79,14 @@ namespace NKikimr { hullLogCtx->PDiskCtx->Dsk->OwnerRound, signature, commitRecord, - TContiguousData(data), //FIXME(innokentii) wrapping + TRcBuf(data), //FIXME(innokentii) wrapping seg, cookie, std::move(callback)); } std::unique_ptr<NPDisk::TEvLog> CreateHullUpdate(const std::shared_ptr<THullLogCtx> &hullLogCtx, TLogSignature signature, - const TContiguousData &data, + const TRcBuf &data, TLsnSeg seg, void *cookie, std::unique_ptr<IEventBase> syncLogMsg, @@ -109,7 +109,7 @@ namespace NKikimr { std::unique_ptr<NPDisk::TEvLog> CreateHullUpdate(const std::shared_ptr<THullLogCtx> &hullLogCtx, TLogSignature signature, const NPDisk::TCommitRecord &commitRecord, - const TContiguousData &data, + const TRcBuf &data, TLsnSeg seg, void *cookie, std::unique_ptr<IEventBase> syncLogMsg) diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.h index 8a1fd73ead..c8e405bbc0 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.h +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.h @@ -30,7 +30,7 @@ namespace NKikimr { std::unique_ptr<NPDisk::TEvLog> CreateHullUpdate(const std::shared_ptr<THullLogCtx> &hullLogCtx, TLogSignature signature, - const TContiguousData &data, + const TRcBuf &data, TLsnSeg seg, void *cookie, std::unique_ptr<IEventBase> syncLogMsg, @@ -39,7 +39,7 @@ namespace NKikimr { std::unique_ptr<NPDisk::TEvLog> CreateHullUpdate(const std::shared_ptr<THullLogCtx> &hullLogCtx, TLogSignature signature, const NPDisk::TCommitRecord &commitRecord, - const TContiguousData &data, + const TRcBuf &data, TLsnSeg seg, void *cookie, std::unique_ptr<IEventBase> syncLogMsg); diff --git a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_logreplay.cpp b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_logreplay.cpp index 4bdc4638c7..74c4e747af 100644 --- a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_logreplay.cpp +++ b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_logreplay.cpp @@ -727,7 +727,7 @@ namespace NKikimr { } EDispatchStatus HandlePhantomLogoBlobs(const TActorContext& ctx, const NPDisk::TLogRecord& record) { - const TContiguousData& data = record.Data; + const TRcBuf& data = record.Data; if (!PhantomLogoBlobs.ParseFromArray(data.GetData(), data.GetSize())) { return EDispatchStatus::Error; } diff --git a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp index eb6aff76e1..468407e709 100644 --- a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp +++ b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp @@ -252,7 +252,7 @@ namespace NKikimr { // read existing one emptyDb = false; counter = 0; - const TContiguousData &data = it->second.Data; + const TRcBuf &data = it->second.Data; TString explanation; NKikimrVDiskData::THullDbEntryPoint pb; const bool good = THullDbSignatureRoutines::ParseArray(pb, data.GetData(), data.GetSize(), explanation); @@ -317,7 +317,7 @@ namespace NKikimr { bool InitSyncLogData(const TStartingPoints &startingPoints, const TActorContext &ctx) { TStartingPoints::const_iterator it; it = startingPoints.find(TLogSignature::SignatureSyncLogIdx); - TContiguousData entryPoint; + TRcBuf entryPoint; ui64 entryPointLsn = 0; if (it == startingPoints.end()) { @@ -372,7 +372,7 @@ namespace NKikimr { } else { // read existing one LocRecCtx->RecovInfo->EmptySyncer = false; - const TContiguousData &entryPoint = it->second.Data; + const TRcBuf &entryPoint = it->second.Data; if (!TSyncerData::CheckEntryPoint(LocRecCtx->VCtx->VDiskLogPrefix, SkeletonId, LocRecCtx->VCtx->ShortSelfVDisk, LocRecCtx->VCtx->Top, entryPoint)) { SignalErrorAndDie(ctx, NKikimrProto::ERROR, "Entry point for Syncer check failed"); @@ -424,7 +424,7 @@ namespace NKikimr { LocRecCtx->RecovInfo->EmptyHuge = false; const ui64 lsn = it->second.Lsn; - const TContiguousData &entryPoint = it->second.Data; + const TRcBuf &entryPoint = it->second.Data; if (!THullHugeKeeperPersState::CheckEntryPoint(entryPoint)) { SignalErrorAndDie(ctx, NKikimrProto::ERROR, "Entry point for HugeKeeper check failed"); return false; diff --git a/ydb/core/blobstorage/vdisk/scrub/scrub_actor.cpp b/ydb/core/blobstorage/vdisk/scrub/scrub_actor.cpp index 5e50c55f1f..ee81a7d832 100644 --- a/ydb/core/blobstorage/vdisk/scrub/scrub_actor.cpp +++ b/ydb/core/blobstorage/vdisk/scrub/scrub_actor.cpp @@ -208,7 +208,7 @@ namespace NKikimr { state.CorruptedPart.SerializeToProto(*pb->MutableCorruptedPart()); } - TContiguousData data(TContiguousData::Uninitialized(ScrubEntrypoint.ByteSizeLong())); + TRcBuf data(TRcBuf::Uninitialized(ScrubEntrypoint.ByteSizeLong())); //FIXME(innokentii): better use SerializeWithCachedSizesToArray + check that all fields are set const bool success = ScrubEntrypoint.SerializeToArray(reinterpret_cast<uint8_t*>(data.UnsafeGetDataMut()), data.GetSize()); Y_VERIFY(success); diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp index dc85118ddf..58b5543d5c 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp @@ -373,7 +373,7 @@ namespace NKikimr { // regions // prepare message to recovery log - TContiguousData dataToWrite = TPutRecoveryLogRecOpt::SerializeZeroCopy(Db->GType, id, TRope(buffer)); + TRcBuf dataToWrite = TPutRecoveryLogRecOpt::SerializeZeroCopy(Db->GType, id, TRope(buffer)); LOG_DEBUG_S(ctx, BS_VDISK_PUT, VCtx->VDiskLogPrefix << evPrefix << ": userDataSize# " << buffer.GetSize() << " writtenSize# " << dataToWrite.size() diff --git a/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmovedpatch_actor.cpp b/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmovedpatch_actor.cpp index 8eda6ac928..6a03ebf0c5 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmovedpatch_actor.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmovedpatch_actor.cpp @@ -66,7 +66,7 @@ namespace NKikimr { Y_VERIFY(diff.HasOffset()); Diffs[idx].Offset = diff.GetOffset(); Y_VERIFY(diff.HasBuffer()); - Diffs[idx].Buffer = TContiguousData(diff.GetBuffer()); + Diffs[idx].Buffer = TRcBuf(diff.GetBuffer()); } } diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_committer.cpp b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_committer.cpp index e7e1e0b2c7..dbc7317ef3 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_committer.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_committer.cpp @@ -134,7 +134,7 @@ namespace NKikimr { // commit NPDisk::TCommitRecord commitRec; commitRec.IsStartingPoint = true; - TContiguousData data = TContiguousData(State.Serialize()); + TRcBuf data = TRcBuf(State.Serialize()); size_t dataSize = data.size(); TLsnSeg seg = SyncerCtx->LsnMngr->AllocLsnForLocalUse(); auto msg = std::make_unique<NPDisk::TEvLog>(SyncerCtx->PDiskCtx->Dsk->Owner, diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogkeeper_committer.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogkeeper_committer.cpp index cf980c4cf5..037d2b9844 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogkeeper_committer.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogkeeper_committer.cpp @@ -43,7 +43,7 @@ namespace NKikimr { // commit msg auto commitMsg = std::make_unique<NPDisk::TEvLog>(SlCtx->PDiskCtx->Dsk->Owner, SlCtx->PDiskCtx->Dsk->OwnerRound, TLogSignature::SignatureSyncLogIdx, - CommitRecord, TContiguousData(EntryPointSerializer.GetSerializedData()), seg, nullptr); + CommitRecord, TRcBuf(EntryPointSerializer.GetSerializedData()), seg, nullptr); if (CommitRecord.CommitChunks || CommitRecord.DeleteChunks) { LOG_INFO(ctx, NKikimrServices::BS_SKELETON, diff --git a/ydb/core/erasure/erasure.cpp b/ydb/core/erasure/erasure.cpp index e0174a7e1e..2505c7713b 100644 --- a/ydb/core/erasure/erasure.cpp +++ b/ydb/core/erasure/erasure.cpp @@ -46,7 +46,7 @@ namespace NKikimr { static void Refurbish(TRope &str, ui64 size, ui64 headroom = 0, ui64 tailroom = 0) { if (str.size() != size) { - str = TRope(TContiguousData::Uninitialized(size, headroom, tailroom)); + str = TRope(TRcBuf::Uninitialized(size, headroom, tailroom)); } } @@ -2518,7 +2518,7 @@ void MirrorSplit(TErasureType::ECrcMode crcMode, const TErasureType &type, TRope case TErasureType::CrcModeWholePart: { ui64 partSize = type.PartSize(crcMode, buffer.size()); - TContiguousData part(buffer); + TRcBuf part(buffer); part.GrowBack(partSize - buffer.GetSize()); char *dst = part.GetContiguousSpanMut().data(); if (buffer.size() || part.size()) { @@ -2559,7 +2559,7 @@ void MirrorRestore(TErasureType::ECrcMode crcMode, const TErasureType &type, TDa TRope outBuffer = partSet.Parts[partIdx].OwnedString; outBuffer.GetContiguousSpanMut(); // Detach if(outBuffer.size() != partSet.FullDataSize) { - TContiguousData newOutBuffer(outBuffer); + TRcBuf newOutBuffer(outBuffer); Y_VERIFY(outBuffer.size() >= partSet.FullDataSize, "Unexpected outBuffer.size# %" PRIu64 " fullDataSize# %" PRIu64, (ui64)outBuffer.size(), (ui64)partSet.FullDataSize); newOutBuffer.TrimBack(partSet.FullDataSize); // To pad with zeroes! @@ -2687,7 +2687,7 @@ void EoBlockSplitDiff(TErasureType::ECrcMode crcMode, const TErasureType &type, Y_VERIFY(bufferSize); Y_VERIFY_S(diffShift + bufferSize <= diff.Buffer.size(), "diffShift# " << diffShift << " bufferSize# " << bufferSize << " diff.GetDiffLength()# " << diff.GetDiffLength()); - TContiguousData newBuffer(diff.Buffer); + TRcBuf newBuffer(diff.Buffer); newBuffer.TrimBack(bufferSize + diffShift); newBuffer.TrimFront(bufferSize); part.Diffs.emplace_back(newBuffer, 0, false, true); @@ -2698,7 +2698,7 @@ void EoBlockSplitDiff(TErasureType::ECrcMode crcMode, const TErasureType &type, break; } } else if (diffEnd <= nextOffset) { - TContiguousData buffer; + TRcBuf buffer; ui32 bufferSize = 0; if (lineOffset && !diff.IsAligned) { bufferSize = diff.GetDiffLength() + lineOffset; @@ -2713,7 +2713,7 @@ void EoBlockSplitDiff(TErasureType::ECrcMode crcMode, const TErasureType &type, diffIdx++; } else if (diff.Offset < nextOffset) { ui32 bufferSize = nextOffset - diff.Offset + lineOffset; - TContiguousData newBuffer = diff.Buffer; + TRcBuf newBuffer = diff.Buffer; newBuffer.GrowFront(lineOffset); // FIXME(innokentii) should the [0..lineOffset) be zeroed? newBuffer.TrimBack(bufferSize); Y_VERIFY(bufferSize); @@ -2774,7 +2774,7 @@ void MakeEoBlockXorDiff(TErasureType::ECrcMode crcMode, const TErasureType &type ui32 bufferSize = upperEndPos - lowerStartPos; Y_VERIFY(bufferSize); - TContiguousData xorDiffBuffer = TContiguousData::Uninitialized(bufferSize); // FIXME(innokentii) candidate + TRcBuf xorDiffBuffer = TRcBuf::Uninitialized(bufferSize); // FIXME(innokentii) candidate ui8 *xorDiffBufferBytes = reinterpret_cast<ui8*>(const_cast<char*>(xorDiffBuffer.data())); if (lowerEndPos == lowerStartPos) { diff --git a/ydb/core/erasure/erasure.h b/ydb/core/erasure/erasure.h index 5f40a042ea..909415c413 100644 --- a/ydb/core/erasure/erasure.h +++ b/ydb/core/erasure/erasure.h @@ -17,7 +17,7 @@ namespace NKikimr { struct TDiff { - TContiguousData Buffer; + TRcBuf Buffer; ui32 Offset = 0; bool IsXor = false; bool IsAligned = false; @@ -35,7 +35,7 @@ struct TDiff { { } - TDiff(const TContiguousData &buffer, ui32 offset, bool isXor, bool isAligned) + TDiff(const TRcBuf &buffer, ui32 offset, bool isXor, bool isAligned) : Buffer(buffer) , Offset(offset) , IsXor(isXor) @@ -43,7 +43,7 @@ struct TDiff { { } - TDiff(const TContiguousData &buffer, ui32 offset) + TDiff(const TRcBuf &buffer, ui32 offset) : TDiff(buffer, offset, false, false) { } @@ -90,7 +90,7 @@ struct TPartFragment { } void UninitializedOwnedWhole(ui64 size, ui64 headroom = 0, ui64 tailroom = 0) { - OwnedString = TRope(TContiguousData::Uninitialized(size, headroom, tailroom)); + OwnedString = TRope(TRcBuf::Uninitialized(size, headroom, tailroom)); Bytes = OwnedString.UnsafeGetContiguousSpanMut().data(); Offset = 0; Size = size; |