aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormokhotskii <mokhotskii@yandex-team.ru>2022-04-06 20:50:42 +0300
committermokhotskii <mokhotskii@yandex-team.ru>2022-04-06 20:50:42 +0300
commit82f23e3f751b12e33b7c0fa4f86868743dab8dd4 (patch)
tree22a09ddfd2cb592fcf6a3145854bd4ac9d7764c2
parent7a206f1db33ebb596b624c735816cabe60bc91f6 (diff)
downloadydb-82f23e3f751b12e33b7c0fa4f86868743dab8dd4.tar.gz
LOGBROKER-7405 Replace numbers with KB/MB/GB literals
Replace numbers with KB/MB/GB literals ref:cd41dfbf823d332c23bbc80e68896377a06e2eaa
-rw-r--r--ydb/core/persqueue/blob.cpp2
-rw-r--r--ydb/core/persqueue/cache_eviction.h2
-rw-r--r--ydb/core/persqueue/internals_ut.cpp25
-rw-r--r--ydb/core/persqueue/mirrorer.h2
-rw-r--r--ydb/core/persqueue/mirrorer_ut.cpp2
-rw-r--r--ydb/core/persqueue/partition.cpp12
-rw-r--r--ydb/core/persqueue/pq_impl.cpp6
-rw-r--r--ydb/core/persqueue/pq_l2_cache.cpp6
-rw-r--r--ydb/core/persqueue/pq_l2_cache.h12
-rw-r--r--ydb/core/persqueue/pq_ut.cpp198
-rw-r--r--ydb/core/persqueue/pq_ut.h4
-rw-r--r--ydb/core/persqueue/pq_ut_slow.cpp6
-rw-r--r--ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/read_session.cpp2
-rw-r--r--ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/write_session.cpp2
-rw-r--r--ydb/public/sdk/cpp/client/ydb_persqueue_core/persqueue.h9
-rw-r--r--ydb/public/sdk/cpp/client/ydb_persqueue_core/ut/basic_usage_ut.cpp3
-rw-r--r--ydb/public/sdk/cpp/client/ydb_persqueue_core/ut/compress_executor_ut.cpp2
-rw-r--r--ydb/services/datastreams/datastreams_proxy.cpp10
-rw-r--r--ydb/services/datastreams/datastreams_ut.cpp13
-rw-r--r--ydb/services/datastreams/put_records_actor.h8
-rw-r--r--ydb/services/persqueue_v1/grpc_pq_read_actor.cpp2
-rw-r--r--ydb/services/persqueue_v1/grpc_pq_write_actor.cpp2
-rw-r--r--ydb/services/persqueue_v1/persqueue_new_schemecache_ut.cpp4
-rw-r--r--ydb/services/persqueue_v1/persqueue_ut.cpp36
-rw-r--r--ydb/services/persqueue_v1/ut/persqueue_test_fixture.h2
-rw-r--r--ydb/services/persqueue_v1/ut/rate_limiter_test_setup.cpp2
26 files changed, 187 insertions, 187 deletions
diff --git a/ydb/core/persqueue/blob.cpp b/ydb/core/persqueue/blob.cpp
index 7727f12a130..21d687a5e42 100644
--- a/ydb/core/persqueue/blob.cpp
+++ b/ydb/core/persqueue/blob.cpp
@@ -814,7 +814,7 @@ std::pair<TKey, TString> TPartitionedBlob::Add(TClientBlob&& blob)
valueD += batch.Serialize();
}
res.second = valueD;
- Y_VERIFY(res.second.size() <= MaxBlobSize && (res.second.size() + size + 1024 * 1024 > MaxBlobSize
+ Y_VERIFY(res.second.size() <= MaxBlobSize && (res.second.size() + size + 1_MB > MaxBlobSize
|| HeadSize + BlobsSize + size + GetMaxHeaderSize() <= MaxBlobSize));
HeadSize = 0;
BlobsSize = 0;
diff --git a/ydb/core/persqueue/cache_eviction.h b/ydb/core/persqueue/cache_eviction.h
index 07ae210f852..f151587f405 100644
--- a/ydb/core/persqueue/cache_eviction.h
+++ b/ydb/core/persqueue/cache_eviction.h
@@ -85,7 +85,7 @@ namespace NPQ {
/// @note We should return blobs of size ~25 Mb. It's about 3 well-filled blobs.
THolder<TEvPQ::TEvBlobResponse> MakePQResponse(const TActorContext& ctx, TErrorInfo error = TErrorInfo())
{
- static const ui64 MAX_RESPONSE_SIZE = 24 * 1024 * 1024;
+ static const ui64 MAX_RESPONSE_SIZE = 24_MB;
ui64 size = 0;
ui32 cropped = 0;
diff --git a/ydb/core/persqueue/internals_ut.cpp b/ydb/core/persqueue/internals_ut.cpp
index d72ffe5e11e..b981f6ac153 100644
--- a/ydb/core/persqueue/internals_ut.cpp
+++ b/ydb/core/persqueue/internals_ut.cpp
@@ -1,5 +1,6 @@
#include "blob.h"
#include <library/cpp/testing/unittest/registar.h>
+#include <util/generic/size_literals.h>
namespace NKikimr {
namespace NPQ {
@@ -16,7 +17,7 @@ Y_UNIT_TEST(TestPartitionedBlobSimpleTest) {
THead head;
THead newHead;
- TPartitionedBlob blob(0, 0, "sourceId", 1, 1, 10, head, newHead, false, false, 8 << 20);
+ TPartitionedBlob blob(0, 0, "sourceId", 1, 1, 10, head, newHead, false, false, 8_MB);
TClientBlob clientBlob("sourceId", 1, "valuevalue", TMaybe<TPartData>(), TInstant::MilliSeconds(1), TInstant::MilliSeconds(1), 0, "123", "123");
UNIT_ASSERT(blob.IsInited());
TString error;
@@ -34,7 +35,7 @@ void Test(bool headCompacted, ui32 parts, ui32 partSize, ui32 leftInHead)
THead head;
head.Offset = 100;
- TString value(102400, 'a');
+ TString value(100_KB, 'a');
head.Batches.push_back(TBatch(head.Offset, 0, TVector<TClientBlob>()));
for (ui32 i = 0; i < 50; ++i) {
head.Batches.back().AddBlob(TClientBlob(
@@ -91,8 +92,8 @@ void Test(bool headCompacted, ui32 parts, ui32 partSize, ui32 leftInHead)
for (ui32 i = 0; i < formed.size(); ++i) {
UNIT_ASSERT(formed[i].first == blob.GetFormedBlobs()[i].first);
UNIT_ASSERT(formed[i].second.size() == blob.GetFormedBlobs()[i].second);
- UNIT_ASSERT(formed[i].second.size() <= 8 * 1024 * 1024);
- UNIT_ASSERT(formed[i].second.size() > 6 * 1024 * 1024);
+ UNIT_ASSERT(formed[i].second.size() <= 8_MB);
+ UNIT_ASSERT(formed[i].second.size() > 6_MB);
}
TVector<TClientBlob> real;
ui32 nextOffset = headCompacted ? newHead.Offset : head.Offset;
@@ -159,12 +160,12 @@ void Test(bool headCompacted, ui32 parts, ui32 partSize, ui32 leftInHead)
Y_UNIT_TEST(TestPartitionedBigTest) {
- Test(true, 100, 400*1024, 3);
- Test(false, 100, 512*1024 - 9 - sizeof(ui64) - sizeof(ui16) - 100, 16); //serialized size of client blob is 512*1024 - 100
- Test(false, 101, 512*1024 - 9 - sizeof(ui64) - sizeof(ui16) - 100, 1); //serialized size of client blob is 512*1024 - 100
- Test(false, 1, 512*1024 - 9 - sizeof(ui64) - sizeof(ui16) - 100, 1); //serialized size of client blob is 512*1024 - 100
- Test(true, 1, 512*1024 - 9 - sizeof(ui64) - sizeof(ui16) - 100, 1); //serialized size of client blob is 512*1024 - 100
- Test(true, 101, 512*1024 - 9 - sizeof(ui64) - sizeof(ui16) - 100, 7); //serialized size of client blob is 512*1024 - 100
+ Test(true, 100, 400_KB, 3);
+ Test(false, 100, 512_KB - 9 - sizeof(ui64) - sizeof(ui16) - 100, 16); //serialized size of client blob is 512_KB - 100
+ Test(false, 101, 512_KB - 9 - sizeof(ui64) - sizeof(ui16) - 100, 1); //serialized size of client blob is 512_KB - 100
+ Test(false, 1, 512_KB - 9 - sizeof(ui64) - sizeof(ui16) - 100, 1); //serialized size of client blob is 512_KB - 100
+ Test(true, 1, 512_KB - 9 - sizeof(ui64) - sizeof(ui16) - 100, 1); //serialized size of client blob is 512_KB - 100
+ Test(true, 101, 512_KB - 9 - sizeof(ui64) - sizeof(ui16) - 100, 7); //serialized size of client blob is 512_KB - 100
}
Y_UNIT_TEST(TestBatchPacking) {
@@ -190,8 +191,8 @@ Y_UNIT_TEST(TestBatchPacking) {
TBatch batch3;
batch3.AddBlob(TClientBlob(
- "sourceId", 999999999999999ll, "abacaba", TPartData{33,66,4000000000u},
- TInstant::MilliSeconds(999999999999ll), TInstant::MilliSeconds(1000), 0, "", ""
+ "sourceId", 999'999'999'999'999ll, "abacaba", TPartData{33, 66, 4'000'000'000u},
+ TInstant::MilliSeconds(999'999'999'999ll), TInstant::MilliSeconds(1000), 0, "", ""
));
batch3.Pack();
UNIT_ASSERT(batch3.Header.GetFormat() == NKikimrPQ::TBatchHeader::EUncompressed);
diff --git a/ydb/core/persqueue/mirrorer.h b/ydb/core/persqueue/mirrorer.h
index ff1fb9671ba..5fb57038b3b 100644
--- a/ydb/core/persqueue/mirrorer.h
+++ b/ydb/core/persqueue/mirrorer.h
@@ -20,7 +20,7 @@ namespace NPQ {
class TMirrorer : public TActorBootstrapped<TMirrorer> {
private:
const ui64 MAX_READ_FUTURES_STORE = 25;
- const ui64 MAX_BYTES_IN_FLIGHT = 8 * 1024 * 1024;
+ const ui64 MAX_BYTES_IN_FLIGHT = 8_MB;
const TDuration WRITE_RETRY_TIMEOUT_MAX = TDuration::Seconds(1);
const TDuration WRITE_RETRY_TIMEOUT_START = TDuration::MilliSeconds(1);
diff --git a/ydb/core/persqueue/mirrorer_ut.cpp b/ydb/core/persqueue/mirrorer_ut.cpp
index 800a89c4910..c802606ccfe 100644
--- a/ydb/core/persqueue/mirrorer_ut.cpp
+++ b/ydb/core/persqueue/mirrorer_ut.cpp
@@ -39,7 +39,7 @@ Y_UNIT_TEST_SUITE(TPersQueueMirrorer) {
server.AnnoyingClient->CreateTopic(
dstTopicFullName,
partitionsCount,
- /*ui32 lowWatermark =*/ 8*1024*1024,
+ /*ui32 lowWatermark =*/ 8_MB,
/*ui64 lifetimeS =*/ 86400,
/*ui64 writeSpeed =*/ 20000000,
/*TString user =*/ "",
diff --git a/ydb/core/persqueue/partition.cpp b/ydb/core/persqueue/partition.cpp
index 127f7ddf5e6..5a2457adcfe 100644
--- a/ydb/core/persqueue/partition.cpp
+++ b/ydb/core/persqueue/partition.cpp
@@ -28,9 +28,9 @@
namespace NKikimr {
namespace NPQ {
-static const ui32 BATCH_UNPACK_SIZE_BORDER = 500 * 1024; //500kb
+static const ui32 BATCH_UNPACK_SIZE_BORDER = 500_KB; //500kb
-static const ui32 MAX_WRITE_CYCLE_SIZE = 16 << 20; //16MB
+static const ui32 MAX_WRITE_CYCLE_SIZE = 16_MB; //16MB
static const ui32 MAX_USER_ACTS = 1000;
@@ -801,10 +801,10 @@ void TPartition::SetupTopicCounters(const TActorContext& ctx) {
MessageSize = THolder<NKikimr::NPQ::TPercentileCounter>(new NKikimr::NPQ::TPercentileCounter(
subGroup, labels, {{"sensor", "MessageSize" + suffix}}, "Size",
TVector<std::pair<ui64, TString>>{
- {1024, "1kb"}, {5120, "5kb"}, {10240, "10kb"},
- {20'480, "20kb"}, {51'200, "50kb"}, {102'400, "100kb"}, {204'800, "200kb"},
- {524'288, "512kb"},{1'048'576, "1024kb"}, {2'097'152,"2048kb"}, {5'242'880, "5120kb"},
- {10'485'760, "10240kb"}, {67'108'864, "65536kb"}, {999'999'999, "99999999kb"}}, true));
+ {1_KB, "1kb"}, {5_KB, "5kb"}, {10_KB, "10kb"},
+ {20_KB, "20kb"}, {50_KB, "50kb"}, {100_KB, "100kb"}, {200_KB, "200kb"},
+ {512_KB, "512kb"},{1024_KB, "1024kb"}, {2048_KB,"2048kb"}, {5120_KB, "5120kb"},
+ {10240_KB, "10240kb"}, {65536_KB, "65536kb"}, {999'999'999, "99999999kb"}}, true));
subGroup = GetServiceCounters(counters, "pqproxy|writeSession");
BytesWritten = NKikimr::NPQ::TMultiCounter(subGroup, labels, {}, {"BytesWritten" + suffix}, true);
diff --git a/ydb/core/persqueue/pq_impl.cpp b/ydb/core/persqueue/pq_impl.cpp
index bdec76536eb..804609324d8 100644
--- a/ydb/core/persqueue/pq_impl.cpp
+++ b/ydb/core/persqueue/pq_impl.cpp
@@ -23,10 +23,10 @@ namespace NKikimr {
namespace NPQ {
const TString TMP_REQUEST_MARKER = "__TMP__REQUEST__MARKER__";
-const ui32 CACHE_SIZE = 100 << 20; //100mb per tablet by default
-const ui32 MAX_BYTES = 25 * 1024 * 1024;
+const ui32 CACHE_SIZE = 100_MB;
+const ui32 MAX_BYTES = 25_MB;
const TDuration TOTAL_TIMEOUT = TDuration::Seconds(120);
-static constexpr ui32 MAX_SOURCE_ID_LENGTH = 10240;
+static constexpr ui32 MAX_SOURCE_ID_LENGTH = 10_KB;
struct TPartitionInfo {
TPartitionInfo(const TActorId& actor, TMaybe<TPartitionKeyRange>&& keyRange,
diff --git a/ydb/core/persqueue/pq_l2_cache.cpp b/ydb/core/persqueue/pq_l2_cache.cpp
index e56642c39ae..01dfa5caaa4 100644
--- a/ydb/core/persqueue/pq_l2_cache.cpp
+++ b/ydb/core/persqueue/pq_l2_cache.cpp
@@ -203,7 +203,7 @@ void TPersQueueCacheL2::Handle(NMon::TEvHttpInfo::TPtr& ev, const TActorContext&
TString strParam = params.Get("newCacheLimit");
if (strParam.size()) {
ui32 valueMb = atoll(strParam.data());
- MaxSize = SizeInBytes(valueMb); // will be applyed at next AddBlobs
+ MaxSize = ClampMinSize(valueMb * 1_MB); // will be applyed at next AddBlobs
}
}
@@ -218,8 +218,8 @@ TString TPersQueueCacheL2::HttpForm() const
FORM_CLASS("form-horizontal") {
DIV_CLASS("row") {
PRE() {
- str << "CacheLimit (MB): " << (MaxSize>>20) << Endl;
- str << "CacheSize (MB): " << (CurrentSize>>20) << Endl;
+ str << "CacheLimit (MB): " << (MaxSize >> 20) << Endl;
+ str << "CacheSize (MB): " << (CurrentSize >> 20) << Endl;
str << "Count of blobs: " << Cache.Size() << Endl;
str << "Min RetentionTime: " << KeepTime << Endl;
str << "RetentionTime: " << RetentionTime << Endl;
diff --git a/ydb/core/persqueue/pq_l2_cache.h b/ydb/core/persqueue/pq_l2_cache.h
index f9fcccbc8ed..468da5f569c 100644
--- a/ydb/core/persqueue/pq_l2_cache.h
+++ b/ydb/core/persqueue/pq_l2_cache.h
@@ -78,8 +78,8 @@ public:
}
TPersQueueCacheL2(const TCacheL2Parameters& params, TIntrusivePtr<NMonitoring::TDynamicCounters> countersGroup)
- : Cache(SizeInBytes(1024*1024)/MAX_BLOB_SIZE) // It's some "much bigger then we need" size here.
- , MaxSize(SizeInBytes(params.MaxSizeMB))
+ : Cache(ClampMinSize(1_MB)/MAX_BLOB_SIZE) // It's some "much bigger then we need" size here.
+ , MaxSize(ClampMinSize(params.MaxSizeMB * 1_MB))
, CurrentSize(0)
, KeepTime(params.KeepTime)
, RetentionTime(TDuration::Zero())
@@ -118,11 +118,9 @@ private:
void TouchBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs, bool isHit = true);
void RegretBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs);
- static ui64 SizeInBytes(ui64 maxSizeMB) {
- static const ui64 MIN_SIZE = 32;
- if (maxSizeMB < MIN_SIZE)
- maxSizeMB = MIN_SIZE;
- return maxSizeMB*1024*1024;
+ static ui64 ClampMinSize(ui64 maxSize) {
+ static const ui64 MIN_SIZE = 32_MB;
+ return std::clamp(maxSize, MIN_SIZE, std::numeric_limits<ui64>::max());
}
private:
diff --git a/ydb/core/persqueue/pq_ut.cpp b/ydb/core/persqueue/pq_ut.cpp
index 07f5edf56a9..1f6a3e61439 100644
--- a/ydb/core/persqueue/pq_ut.cpp
+++ b/ydb/core/persqueue/pq_ut.cpp
@@ -148,7 +148,7 @@ Y_UNIT_TEST(TestUserInfoCompatibility) {
TString client = "test";
tc.Runtime->SetLogPriority(NKikimrServices::PERSQUEUE, NLog::PRI_DEBUG);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{client, false}}, tc, 4, 6*1024*1024, true, 0, 0, 1);
+ PQTabletPrepare(20000000, 100_MB, 0, {{client, false}}, tc, 4, 6_MB, true, 0, 0, 1);
TVector<std::pair<ui64, TString>> data;
data.push_back({1, "s"});
@@ -194,7 +194,7 @@ Y_UNIT_TEST(TestReadRuleVersions) {
activeZone = false;
TString client = "test";
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{client, false}, {"another-user", false}}, tc, 3);
+ PQTabletPrepare(20000000, 100_MB, 0, {{client, false}, {"another-user", false}}, tc, 3);
tc.Runtime->SetLogPriority(NKikimrServices::PERSQUEUE, NLog::PRI_DEBUG);
@@ -247,7 +247,7 @@ Y_UNIT_TEST(TestReadRuleVersions) {
UNIT_ASSERT(result->Record.GetReadRangeResult(0).GetPair().size() == 7);
}
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc, 3);
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc, 3);
CmdGetOffset(0, client, 0, tc);
CmdGetOffset(1, client, 0, tc);
@@ -519,7 +519,7 @@ Y_UNIT_TEST(TestSwitchOffImportantFlag) {
tc.Prepare(dispatchName, setup, activeZone);
activeZone = false;
tc.Runtime->SetScheduledLimit(600);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc);
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc);
{
TDispatchOptions options;
@@ -529,7 +529,7 @@ Y_UNIT_TEST(TestSwitchOffImportantFlag) {
CheckLabeledCountersResponse(8, tc); //only topic counters
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"user", true}}, tc);
+ PQTabletPrepare(20000000, 100_MB, 0, {{"user", true}}, tc);
{
TDispatchOptions options;
@@ -539,7 +539,7 @@ Y_UNIT_TEST(TestSwitchOffImportantFlag) {
CheckLabeledCountersResponse(8, tc, {"user/1/topic"}); //topic counters + important
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc);
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc);
{
TDispatchOptions options;
@@ -555,7 +555,7 @@ Y_UNIT_TEST(TestSwitchOffImportantFlag) {
CheckLabeledCountersResponse(8, tc, {"user/0/topic"}); //topic counters + not important
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"user", true}, {"user2", true}}, tc);
+ PQTabletPrepare(20000000, 100_MB, 0, {{"user", true}, {"user2", true}}, tc);
{
TDispatchOptions options;
@@ -571,7 +571,7 @@ Y_UNIT_TEST(TestSwitchOffImportantFlag) {
CheckLabeledCountersResponse(11, tc, {"user/1/topic", "user2/1/topic"}); //topic counters + not important
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"user", true}, {"user2", false}}, tc);
+ PQTabletPrepare(20000000, 100_MB, 0, {{"user", true}, {"user2", false}}, tc);
{
TDispatchOptions options;
@@ -588,7 +588,7 @@ Y_UNIT_TEST(TestSwitchOffImportantFlag) {
CheckLabeledCountersResponse(12, tc, {"user/1/topic", "user2/0/topic"});
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"user", true}}, tc);
+ PQTabletPrepare(20000000, 100_MB, 0, {{"user", true}}, tc);
{
TDispatchOptions options;
@@ -619,7 +619,7 @@ Y_UNIT_TEST(TestSeveralOwners) {
activeZone = false;
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
TVector<std::pair<ui64, TString>> data;
@@ -651,7 +651,7 @@ Y_UNIT_TEST(TestWaitInOwners) {
activeZone = false;
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
TVector<std::pair<ui64, TString>> data;
@@ -747,7 +747,7 @@ Y_UNIT_TEST(TestReserveBytes) {
activeZone = false;
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
TVector<std::pair<ui64, TString>> data;
@@ -808,7 +808,7 @@ Y_UNIT_TEST(TestMessageNo) {
activeZone = false;
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
TVector<std::pair<ui64, TString>> data;
@@ -860,9 +860,9 @@ Y_UNIT_TEST(TestPartitionedBlobFails) {
activeZone = false;
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 200 * 1024 * 1024, 0, {{"user1", true}}, tc); //one important client, never delete
+ PQTabletPrepare(20000000, 200_MB, 0, {{"user1", true}}, tc); //one important client, never delete
- TString ss{50*1024*1024, '_'};
+ TString ss{50_MB, '_'};
char k = 0;
TString s = "";
s += k;
@@ -874,7 +874,7 @@ Y_UNIT_TEST(TestPartitionedBlobFails) {
data.push_back({1, s});
TVector<TString> parts;
- ui32 size = 400*1024;
+ ui32 size = 400_KB;
ui32 diff = 50;
for (ui32 pos = 0; pos < s.size();) {
parts.push_back(s.substr(pos, size - diff));
@@ -886,7 +886,7 @@ Y_UNIT_TEST(TestPartitionedBlobFails) {
{
TString cookie = CmdSetOwner(0, tc).first;
- WritePartDataWithBigMsg(0, "sourceid0", 1, 1, 5, s.size(), parts[1], tc, cookie, 0, 12*1024*1024);
+ WritePartDataWithBigMsg(0, "sourceid0", 1, 1, 5, s.size(), parts[1], tc, cookie, 0, 12_MB);
TAutoPtr<IEventHandle> handle;
TEvPersQueue::TEvResponse *result;
@@ -938,11 +938,11 @@ Y_UNIT_TEST(TestPartitionedBlobFails) {
PQGetPartInfo(0, i + 2, tc);
toWrite = parts.size();
}
- data.back().second.resize(64*1024);
+ data.back().second.resize(64_KB);
CmdWrite(0, "sourceid3", data, tc);
CmdWrite(0, "sourceid5", data, tc);
activeZone = true;
- data.back().second.resize(8*1024*1024);
+ data.back().second.resize(8_MB);
CmdWrite(0, "sourceid7", data, tc);
activeZone = false;
{
@@ -998,7 +998,7 @@ Y_UNIT_TEST(TestPartitionedBlobFails) {
//check very big msg
cookie = CmdSetOwner(0, tc).first;
- WritePartData(0, "sourceidY", 13, 1, 0, 5, s.size(), TString{10*1024*1024, 'a'}, tc, cookie, 0);
+ WritePartData(0, "sourceidY", 13, 1, 0, 5, s.size(), TString{10_MB, 'a'}, tc, cookie, 0);
result = tc.Runtime->GrabEdgeEvent<TEvPersQueue::TEvResponse>(handle);
@@ -1020,7 +1020,7 @@ Y_UNIT_TEST(TestAlreadyWritten) {
activeZone = false;
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
activeZone = true;
TVector<std::pair<ui64, TString>> data;
@@ -1047,7 +1047,7 @@ Y_UNIT_TEST(TestAlreadyWrittenWithoutDeduplication) {
activeZone = false;
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
TVector<std::pair<ui64, TString>> data;
activeZone = true;
@@ -1072,14 +1072,14 @@ Y_UNIT_TEST(TestWritePQCompact) {
activeZone = false;
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc, 2, 8 * 1024 * 1024 - 512 * 1024);
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc, 2, 8_MB - 512_KB);
//no important clients, lifetimeseconds=0 - delete all right now, except last datablob
TVector<std::pair<ui64, TString>> data;
- TString ss{1024*1024 - 100, '_'};
- TString s1{131072, 'a'};
- TString s2{2048, 'b'};
+ TString ss{1_MB - 100, '_'};
+ TString s1{128_KB, 'a'};
+ TString s2{2_KB, 'b'};
TString s3{32, 'c'};
ui32 pp = 4 + 8 + 2 + 9;
for (ui32 i = 0; i < 8; ++i) {
@@ -1088,7 +1088,7 @@ Y_UNIT_TEST(TestWritePQCompact) {
CmdWrite(0, "sourceid0", data, tc, false, {}, true); //now 1 blob
PQGetPartInfo(0, 8, tc);
data.clear();
- for (ui32 i = 0; i + s1.size() < 7*1024*1024 + 4 * s1.size(); i += s1.size()) {
+ for (ui32 i = 0; i + s1.size() < 7_MB + 4 * s1.size(); i += s1.size()) {
data.push_back({i + 1, s1.substr(pp)});
}
CmdWrite(0, "sourceid1", data, tc);
@@ -1129,13 +1129,13 @@ Y_UNIT_TEST(TestWritePQBigMessage) {
activeZone = false;
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 1000 * 1024 * 1024, 0, {{"user1", true}}, tc, 2, 8 * 1024 * 1024 - 512 * 1024); //nothing dropped
+ PQTabletPrepare(20000000, 1000_MB, 0, {{"user1", true}}, tc, 2, 8_MB - 512_KB); //nothing dropped
//no important clients, lifetimeseconds=0 - delete all right now, except last datablob
TVector<std::pair<ui64, TString>> data;
- TString ss{50*1024*1024 - 100 - 2, '_'};
- TString s1{400*1024 - 2, 'a'};
+ TString ss{50_MB - 100 - 2, '_'};
+ TString s1{400_KB - 2, 'a'};
ui32 pp = 4 + 8 + 2 + 9;
char k = 0;
TString s = "";
@@ -1181,18 +1181,18 @@ Y_UNIT_TEST(TestWritePQ) {
tc.Prepare(dispatchName, setup, activeZone);
tc.Runtime->SetScheduledLimit(100);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"user", true}}, tc); //important client, lifetimeseconds=0 - never delete
+ PQTabletPrepare(20000000, 100_MB, 0, {{"user", true}}, tc); //important client, lifetimeseconds=0 - never delete
TVector<std::pair<ui64, TString>> data, data1, data2;
activeZone = PlainOrSoSlow(true, false);
- TString ss{1024*1024, '_'};
- TString s1{131072, 'a'};
- TString s2{2048, 'b'};
+ TString ss{1_MB, '_'};
+ TString s1{128_KB, 'a'};
+ TString s2{2_KB, 'b'};
TString s3{32, 'c'};
ui32 pp = 4 + 8 + 2 + 9;
- TString sb{15*1024*1024 + 512*1024, '_'};
+ TString sb{15_MB + 512_KB, '_'};
data.push_back({1, sb.substr(pp)});
CmdWrite(0,"sourceid0", data, tc, false, {}, true, "", -1, 100);
activeZone = false;
@@ -1212,8 +1212,8 @@ Y_UNIT_TEST(TestWritePQ) {
data.push_back({2, ss.substr(pp)});
CmdWrite(0,"sourceid4", data, tc);
- TString a1{8*1024*1024 - 1024, '_'};
- TString a2{2*1024, '_'};
+ TString a1{8_MB - 1_KB, '_'};
+ TString a2{2_KB, '_'};
data.clear();
data.push_back({1, a1.substr(pp)});
data1.clear();
@@ -1272,7 +1272,7 @@ Y_UNIT_TEST(TestSourceIdDropByUserWrites) {
tc.Prepare(dispatchName, setup, activeZone);
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important client, lifetimeseconds=0 - delete right now
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc); //no important client, lifetimeseconds=0 - delete right now
TVector<std::pair<ui64, TString>> data;
activeZone = true;
@@ -1309,7 +1309,7 @@ Y_UNIT_TEST(TestSourceIdDropBySourceIdCount) {
tc.Prepare(dispatchName, setup, activeZone);
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc, 2, 6*1024*1024, true, 0, 3); //no important client, lifetimeseconds=0 - delete right now
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc, 2, 6_MB, true, 0, 3); //no important client, lifetimeseconds=0 - delete right now
TVector<std::pair<ui64, TString>> data;
activeZone = true;
@@ -1352,19 +1352,19 @@ Y_UNIT_TEST(TestWriteOffsetWithBigMessage) {
tc.Prepare(dispatchName, setup, activeZone);
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{{"user", true}}}, tc, 3); //important client, lifetimeseconds=0 - never delete
+ PQTabletPrepare(20000000, 100_MB, 0, {{{"user", true}}}, tc, 3); //important client, lifetimeseconds=0 - never delete
activeZone = false;
TVector<std::pair<ui64, TString>> data;
- data.push_back({1, TString{10*1024*1024, 'a'}});
+ data.push_back({1, TString{10_MB, 'a'}});
CmdWrite(1, "sourceIdx", data, tc, false, {}, false, "", -1, 80000);
data.front().first = 2;
CmdWrite(1, "sourceIdx", data, tc, false, {}, false, "", -1, 160000);
data.clear();
- data.push_back({1, TString{100*1024, 'a'}});
+ data.push_back({1, TString{100_KB, 'a'}});
for (ui32 i = 0; i < 100; ++i) {
data.push_back(data.front());
data.back().first = i + 2;
@@ -1388,8 +1388,8 @@ Y_UNIT_TEST(TestWriteSplit) {
activeZone = false;
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"user1", true}}, tc); //never delete
- const ui32 size = PlainOrSoSlow(2*1024*1024, 1*1024*1024);
+ PQTabletPrepare(20000000, 100_MB, 0, {{"user1", true}}, tc); //never delete
+ const ui32 size = PlainOrSoSlow(2_MB, 1_MB);
TVector<std::pair<ui64, TString>> data;
data.push_back({1, TString{size, 'b'}});
@@ -1412,24 +1412,24 @@ Y_UNIT_TEST(TestLowWatermark) {
tc.Prepare(dispatchName, setup, activeZone);
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc, 2, 2 * 1024 * 1024); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc, 2, 2_MB); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
TVector<std::pair<ui64, TString>> data;
ui32 pp = 4 + 8 + 2 + 9;
- TString ss{1024*1024, '_'};
+ TString ss{1_MB, '_'};
data.push_back({1, ss.substr(pp)});
data.push_back({2, ss.substr(pp)});
data.push_back({3, ss.substr(pp)});
CmdWrite(0,"sourceid0", data, tc, false, {}, true);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc, 2, 6 * 1024 * 1024); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc, 2, 6_MB); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
CmdWrite(0,"sourceid1", data, tc, false, {}, false); //first are compacted
PQGetPartInfo(0, 6, tc);
CmdWrite(0,"sourceid2", data, tc, false, {}, false); //3 and 6 are compacted
PQGetPartInfo(3, 9, tc);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc, 2, 3 * 1024 * 1024); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc, 2, 3_MB); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob
CmdWrite(0,"sourceid3", data, tc, false, {}, false); //3, 6 and 3 are compacted
data.resize(1);
CmdWrite(0,"sourceid4", data, tc, false, {}, false); //3, 6 and 3 are compacted
@@ -1450,7 +1450,7 @@ Y_UNIT_TEST(TestWriteToFullPartition) {
tc.Runtime->SetScheduledLimit(100);
- PQTabletPrepare(11, 100 * 1024 * 1024, 0, {}, tc);
+ PQTabletPrepare(11, 100_MB, 0, {}, tc);
TVector<std::pair<ui64, TString>> data;
activeZone = PlainOrSoSlow(true, false);
@@ -1461,11 +1461,11 @@ Y_UNIT_TEST(TestWriteToFullPartition) {
data.push_back({i + 1, s.substr(pp)});
}
CmdWrite(0, "sourceid0", data, tc, false, {}, true); //now 1 blob
- PQTabletPrepare(10, 100 * 1024 * 1024, 0, {}, tc);
+ PQTabletPrepare(10, 100_MB, 0, {}, tc);
PQGetPartInfo(0, 10, tc);
data.resize(1);
CmdWrite(0, "sourceid1", data, tc, true);
- PQTabletPrepare(12, 100 * 1024 * 1024, 0, {}, tc);
+ PQTabletPrepare(12, 100_MB, 0, {}, tc);
CmdWrite(0, "sourceid1", data, tc);
PQTabletPrepare(12, 100, 0, {}, tc);
CmdWrite(0, "sourceid1", data, tc, true);
@@ -1484,13 +1484,13 @@ Y_UNIT_TEST(TestPQPartialRead) {
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc); //important client - never delete
+ PQTabletPrepare(20000000, 100_MB, 0, {{"aaa", true}}, tc); //important client - never delete
activeZone = false;
TVector<std::pair<ui64, TString>> data;
ui32 pp = 4 + 8 + 2 + 9 + 100 + 40; //pp is for size of meta
- TString tmp{1024*1024 - pp - 2, '-'};
+ TString tmp{1_MB - pp - 2, '-'};
char k = 0;
TString ss = "";
ss += k;
@@ -1517,15 +1517,15 @@ Y_UNIT_TEST(TestPQRead) {
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc); //important client - never delete
+ PQTabletPrepare(20000000, 100_MB, 0, {{"aaa", true}}, tc); //important client - never delete
activeZone = false;
TVector<std::pair<ui64, TString>> data;
ui32 pp = 4 + 8 + 2 + 9 + 100 + 40; //pp is for size of meta
- TString tmp{1024*1024 - pp - 2, '-'};
+ TString tmp{1_MB - pp - 2, '-'};
char k = 0;
- for (ui32 i = 0; i < 26 * 1024 * 1024;) { //3 full blobs and 2 in head
+ for (ui32 i = 0; i < 26_MB;) { //3 full blobs and 2 in head
TString ss = "";
ss += k;
ss += tmp;
@@ -1540,21 +1540,21 @@ Y_UNIT_TEST(TestPQRead) {
CmdRead(0, 26, Max<i32>(), Max<i32>(), 0, true, tc);
CmdRead(0, 0, Max<i32>(), Max<i32>(), 25, false, tc);
- CmdRead(0, 0, 10, 1024*102400, 10, false, tc);
- CmdRead(0, 9, 1, 1024*102400, 1, false, tc);
- CmdRead(0, 23, 3, 1024*102400, 3, false, tc);
+ CmdRead(0, 0, 10, 100_MB, 10, false, tc);
+ CmdRead(0, 9, 1, 100_MB, 1, false, tc);
+ CmdRead(0, 23, 3, 100_MB, 3, false, tc);
- CmdRead(0, 3, 1000, 511*1024, 1, false, tc);
- CmdRead(0, 3, 1000, 1024, 1, false, tc); //at least one message will be readed always
- CmdRead(0, 25, 1000, 1024, 1, false, tc); //at least one message will be readed always, from head
+ CmdRead(0, 3, 1000, 511_KB, 1, false, tc);
+ CmdRead(0, 3, 1000, 1_KB, 1, false, tc); //at least one message will be readed always
+ CmdRead(0, 25, 1000, 1_KB, 1, false, tc); //at least one message will be readed always, from head
activeZone = true;
- CmdRead(0, 9, 1000, 3*1024*1024, 3, false, tc);
- CmdRead(0, 9, 1000, 3*1024*1024-10240, 3, false, tc);
- CmdRead(0, 25, 1000, 512*1024, 1, false, tc); //from head
- CmdRead(0, 24, 1000, 512*1024, 1, false, tc); //from head
+ CmdRead(0, 9, 1000, 3_MB, 3, false, tc);
+ CmdRead(0, 9, 1000, 3_MB - 10_KB, 3, false, tc);
+ CmdRead(0, 25, 1000, 512_KB, 1, false, tc); //from head
+ CmdRead(0, 24, 1000, 512_KB, 1, false, tc); //from head
- CmdRead(0, 23, 1000, 102400000, 3, false, tc);
+ CmdRead(0, 23, 1000, 98_MB, 3, false, tc);
});
}
@@ -1569,7 +1569,7 @@ Y_UNIT_TEST(TestPQSmallRead) {
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc); //important client - never delete
+ PQTabletPrepare(20000000, 100_MB, 0, {{"aaa", true}}, tc); //important client - never delete
activeZone = false;
TVector<std::pair<ui64, TString>> data;
@@ -1595,8 +1595,8 @@ Y_UNIT_TEST(TestPQSmallRead) {
CmdRead(0, 5, Max<i32>(), Max<i32>(), 0, true, tc);
CmdRead(0, 0, Max<i32>(), Max<i32>(), 5, false, tc);
- CmdRead(0, 0, 3, 1024*102400, 3, false, tc);
- CmdRead(0, 3, 1000, 1024, 2, false, tc);
+ CmdRead(0, 0, 3, 100_MB, 3, false, tc);
+ CmdRead(0, 3, 1000, 1_KB, 2, false, tc);
});
}
@@ -1611,12 +1611,12 @@ Y_UNIT_TEST(TestPQReadAhead) {
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc); //important client - never delete
+ PQTabletPrepare(20000000, 100_MB, 0, {{"aaa", true}}, tc); //important client - never delete
TVector<std::pair<ui64, TString>> data;
ui32 pp = 8 + 4 + 2 + 9;
- TString tmp{1024*1024 - pp - 2, '-'};
+ TString tmp{1_MB - pp - 2, '-'};
TString tmp0{32 - pp - 2, '-'};
char k = 0;
for (ui32 i = 0; i < 5; ++i) {
@@ -1627,7 +1627,7 @@ Y_UNIT_TEST(TestPQReadAhead) {
++k;
data.push_back({i + 1, ss});
}
- for (ui32 i = 0; i < 17 * 1024 * 1024;) { //3 full blobs and 2 in head
+ for (ui32 i = 0; i < 17_MB;) { //3 full blobs and 2 in head
TString ss = "";
ss += k;
ss += tmp;
@@ -1639,11 +1639,11 @@ Y_UNIT_TEST(TestPQReadAhead) {
CmdWrite(0, "sourceid0", data, tc, false, {}, true); //now 1 blob
PQGetPartInfo(0, 22, tc);
activeZone = true;
- CmdRead(0, 0, 1, 1024*102400, 1, false, tc);
- CmdRead(0, 1, 1, 1024*102400, 1, false, tc);
- CmdRead(0, 2, 1, 1024*102400, 1, false, tc);
- CmdRead(0, 3, 1, 1024*102400, 1, false, tc);
- CmdRead(0, 4, 10, 1024*102400, 10, false, tc);
+ CmdRead(0, 0, 1, 100_MB, 1, false, tc);
+ CmdRead(0, 1, 1, 100_MB, 1, false, tc);
+ CmdRead(0, 2, 1, 100_MB, 1, false, tc);
+ CmdRead(0, 3, 1, 100_MB, 1, false, tc);
+ CmdRead(0, 4, 10, 100_MB, 10, false, tc);
});
}
@@ -1657,7 +1657,7 @@ Y_UNIT_TEST(TestOwnership) {
tc.Runtime->SetScheduledLimit(50);
- PQTabletPrepare(10, 100 * 1024 * 1024, 0, {}, tc);
+ PQTabletPrepare(10, 100_MB, 0, {}, tc);
TString cookie, cookie2;
cookie = CmdSetOwner(0, tc).first;
@@ -1677,7 +1677,7 @@ Y_UNIT_TEST(TestSetClientOffset) {
tc.Prepare(dispatchName, setup, activeZone);
tc.Runtime->SetScheduledLimit(50);
- PQTabletPrepare(10, 100 * 1024 * 1024, 0, {{"user1", false}}, tc);
+ PQTabletPrepare(10, 100_MB, 0, {{"user1", false}}, tc);
activeZone = true;
@@ -1707,7 +1707,7 @@ Y_UNIT_TEST(TestReadSessions) {
tc.Prepare(dispatchName, setup, activeZone);
tc.Runtime->SetScheduledLimit(50);
- PQTabletPrepare(10, 100 * 1024 * 1024, 0, {{"user1", false}}, tc);
+ PQTabletPrepare(10, 100_MB, 0, {{"user1", false}}, tc);
activeZone = true;
@@ -1749,13 +1749,13 @@ Y_UNIT_TEST(TestGetTimestamps) {
tc.Runtime->UpdateCurrentTime(TInstant::Zero() + TDuration::Days(2));
activeZone = false;
- PQTabletPrepare(10, 100 * 1024 * 1024, 0, {{"user1", false}}, tc);
+ PQTabletPrepare(10, 100_MB, 0, {{"user1", false}}, tc);
TVector<std::pair<ui64, TString>> data;
- data.push_back({1, TString(1024, 'a')});
- data.push_back({2, TString(1024, 'a')});
- data.push_back({3, TString(1024, 'a')});
- data.push_back({4, TString(1024, 'a')});
+ data.push_back({1, TString(1_KB, 'a')});
+ data.push_back({2, TString(1_KB, 'a')});
+ data.push_back({3, TString(1_KB, 'a')});
+ data.push_back({4, TString(1_KB, 'a')});
CmdWrite(0, "sourceid0", data, tc, false, {}, true, "", -1, 1);
CmdGetOffset(0, "user1", 0, tc, -1);
@@ -1815,9 +1815,9 @@ Y_UNIT_TEST(TestChangeConfig) {
data.push_back({i + 1, ss});
}
- PQTabletPrepare(100, 100 * 1024 * 1024, 86400 * 2, {{"aaa", true}}, tc, 5);
+ PQTabletPrepare(100, 100_MB, 86400 * 2, {{"aaa", true}}, tc, 5);
CmdWrite(0, "sourceid0", data, tc, false, {}, true); //now 1 blob
- PQTabletPrepare(5, 1024 * 1024, 86400, {{"bbb", true}, {"ccc", true}}, tc, 10);
+ PQTabletPrepare(5, 1_MB, 86400, {{"bbb", true}, {"ccc", true}}, tc, 10);
data.pop_back(); //to be sure that after write partition will no be full
CmdWrite(0, "sourceid1", data, tc, true); //partition is full
CmdWrite(1, "sourceid2", data, tc);
@@ -1850,7 +1850,7 @@ Y_UNIT_TEST(TestReadSubscription) {
data.push_back({i + 1, ss});
}
- PQTabletPrepare(100, 100 * 1024 * 1024, 86400 * 2, {{"user1", true}}, tc, 5);
+ PQTabletPrepare(100, 100_MB, 86400 * 2, {{"user1", true}}, tc, 5);
CmdWrite(0, "sourceid0", data, tc, false, {}, true);
TAutoPtr<IEventHandle> handle;
@@ -1934,14 +1934,14 @@ Y_UNIT_TEST(TestPQCacheSizeManagement) {
tc.Runtime->SetScheduledLimit(200);
activeZone = false;
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc); //important client - never delete
+ PQTabletPrepare(20000000, 100_MB, 0, {{"aaa", true}}, tc); //important client - never delete
TVector<std::pair<ui64, TString>> data;
ui32 pp = 4 + 8 + 2 + 9 + 100;
- TString tmp{1024*1024 - pp - 2, '-'};
+ TString tmp{1_MB - pp - 2, '-'};
char k = 0;
- for (ui32 i = 0; i < 26 * 1024 * 1024;) {
+ for (ui32 i = 0; i < 26_MB;) {
TString ss = "";
ss += k;
ss += tmp;
@@ -1955,7 +1955,7 @@ Y_UNIT_TEST(TestPQCacheSizeManagement) {
TAutoPtr<IEventHandle> handle;
for (ui32 i = 0; i < 10; ++i) {
- CmdRead(0, 0, 1, 1024*102400, 1, false, tc);
+ CmdRead(0, 0, 1, 100_MB, 1, false, tc);
RestartTablet(tc);
}
});
@@ -1992,14 +1992,14 @@ Y_UNIT_TEST(TestMaxTimeLagRewind) {
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc);
+ PQTabletPrepare(20000000, 100_MB, 0, {{"aaa", true}}, tc);
activeZone = false;
for (int i = 0; i < 5; i++) {
TVector<std::pair<ui64, TString>> data;
for (int j = 0; j < 7; j++) {
- data.push_back({7 * i + j + 1, TString(1 * 1024 * 1024, 'a')});
+ data.push_back({7 * i + j + 1, TString(1_MB, 'a')});
}
CmdWrite(0, "sourceid0", data, tc, false, {}, i == 0);
tc.Runtime->UpdateCurrentTime(tc.Runtime->GetCurrentTime() + TDuration::Minutes(1));
@@ -2014,7 +2014,7 @@ Y_UNIT_TEST(TestMaxTimeLagRewind) {
CmdRead(0, 22, 1, Max<i32>(), 1, false, tc, {22}, 0, ts.MilliSeconds() - 3 * 60 * 1000);
CmdRead(0, 4, 1, Max<i32>(), 1, false, tc, {34}, 0, ts.MilliSeconds() - 1000);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc, 2, 6*1024*1024, true, ts.MilliSeconds() - 1000);
+ PQTabletPrepare(20000000, 100_MB, 0, {{"aaa", true}}, tc, 2, 6_MB, true, ts.MilliSeconds() - 1000);
CmdRead(0, 0, 1, Max<i32>(), 1, false, tc, {34});
});
@@ -2030,7 +2030,7 @@ Y_UNIT_TEST(TestWriteTimeStampEstimate) {
tc.Runtime->SetDispatchTimeout(TDuration::Seconds(1));
tc.Runtime->SetLogPriority(NKikimrServices::PERSQUEUE, NLog::PRI_DEBUG);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc);
+ PQTabletPrepare(20000000, 100_MB, 0, {{"aaa", true}}, tc);
tc.Runtime->UpdateCurrentTime(TInstant::MilliSeconds(1000000));
@@ -2039,7 +2039,7 @@ Y_UNIT_TEST(TestWriteTimeStampEstimate) {
CmdGetOffset(0, "user1", 0, tc, -1, 1000000);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc, 2, 6 * 1024 * 1024, false);
+ PQTabletPrepare(20000000, 100_MB, 0, {{"aaa", true}}, tc, 2, 6_MB, false);
RestartTablet(tc);
@@ -2093,7 +2093,7 @@ Y_UNIT_TEST(TestTabletRestoreEventsOrder) {
// Scenario 2: expect EvTabletActive only after partitions init complete
CheckEventSequence(tc, /*scenario=*/[&tc]() {
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc, /*partitions=*/2);
+ PQTabletPrepare(20000000, 100_MB, 0, {{"aaa", true}}, tc, /*partitions=*/2);
ForwardToTablet(*tc.Runtime, tc.TabletId, tc.Edge, new TEvents::TEvPoisonPill());
}, /*expectedEvents=*/{
TEvTablet::TEvRestored::EventType,
diff --git a/ydb/core/persqueue/pq_ut.h b/ydb/core/persqueue/pq_ut.h
index f5f961022cf..1ea7c549672 100644
--- a/ydb/core/persqueue/pq_ut.h
+++ b/ydb/core/persqueue/pq_ut.h
@@ -209,7 +209,7 @@ struct TFinalizer {
// SINGLE COMMAND TEST FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void PQTabletPrepare(ui32 mcip, ui64 msip, ui32 deleteTime, const TVector<std::pair<TString, bool>>& users, TTestContext& tc, int partitions = 2, ui32 lw = 6*1024*1024, bool localDC = true, ui64 ts = 0, ui64 sidMaxCount = 0, ui32 specVersion = 0) {
+void PQTabletPrepare(ui32 mcip, ui64 msip, ui32 deleteTime, const TVector<std::pair<TString, bool>>& users, TTestContext& tc, int partitions = 2, ui32 lw = 6_MB, bool localDC = true, ui64 ts = 0, ui64 sidMaxCount = 0, ui32 specVersion = 0) {
TAutoPtr<IEventHandle> handle;
static int version = 0;
if (specVersion) {
@@ -225,7 +225,7 @@ void PQTabletPrepare(ui32 mcip, ui64 msip, ui32 deleteTime, const TVector<std::p
for (i32 i = 0; i < partitions; ++i) {
request->Record.MutableTabletConfig()->AddPartitionIds(i);
}
- request->Record.MutableTabletConfig()->SetCacheSize(10*1024*1024);
+ request->Record.MutableTabletConfig()->SetCacheSize(10_MB);
request->Record.SetTxId(12345);
auto tabletConfig = request->Record.MutableTabletConfig();
tabletConfig->SetTopicName("topic");
diff --git a/ydb/core/persqueue/pq_ut_slow.cpp b/ydb/core/persqueue/pq_ut_slow.cpp
index 51041c10459..37e90f35339 100644
--- a/ydb/core/persqueue/pq_ut_slow.cpp
+++ b/ydb/core/persqueue/pq_ut_slow.cpp
@@ -38,13 +38,13 @@ Y_UNIT_TEST(TestWriteVeryBigMessage) {
tc.Runtime->SetScheduledLimit(200);
activeZone = false;
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //always delete
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc); //always delete
TVector<std::pair<ui64, TString>> data;
data.push_back({1, TString{10, 'b'}});
CmdWrite(1, "sourceIdx", data, tc, false, {}, false, "", -1, 40000);
data.clear();
- const ui32 size = PlainOrSoSlow(40*1024*1024, 1*1024*1024);
+ const ui32 size = PlainOrSoSlow(40_MB, 1_MB);
const ui32 so = PlainOrSoSlow(1, 0);
data.push_back({2, TString{size, 'a'}});
CmdWrite(1, "sourceIdx", data, tc, false, {}, false, "", -1, 80000);
@@ -66,7 +66,7 @@ Y_UNIT_TEST(TestOnDiskStoredSourceIds) {
tc.Prepare(dispatchName, setup, activeZone);
tc.Runtime->SetScheduledLimit(200);
- PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc, 2, 6*1024*1024, true, 0, 3); //no important client, lifetimeseconds=0 - delete right now
+ PQTabletPrepare(20000000, 100_MB, 0, {}, tc, 2, 6_MB, true, 0, 3); //no important client, lifetimeseconds=0 - delete right now
TVector<TString> writtenSourceIds;
diff --git a/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/read_session.cpp b/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/read_session.cpp
index 0386a85d93b..38d3b3a2f42 100644
--- a/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/read_session.cpp
+++ b/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/read_session.cpp
@@ -115,7 +115,7 @@ bool TReadSession::ValidateSettings() {
issues.AddIssue("No consumer specified.");
}
- if (Settings.MaxMemoryUsageBytes_ < 1024 * 1024) {
+ if (Settings.MaxMemoryUsageBytes_ < 1_MB) {
issues.AddIssue("Too small max memory usage. Valid values start from 1 megabyte.");
}
diff --git a/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/write_session.cpp b/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/write_session.cpp
index 1259126b660..31ef9eadfa4 100644
--- a/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/write_session.cpp
+++ b/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/write_session.cpp
@@ -997,7 +997,7 @@ size_t TWriteSession::WriteBatchImpl() {
}
size_t GetMaxGrpcMessageSize() {
- return 120 * 1024 * 1024;
+ return 120_MB;
}
bool TWriteSession::IsReadyToSendNextImpl() const {
diff --git a/ydb/public/sdk/cpp/client/ydb_persqueue_core/persqueue.h b/ydb/public/sdk/cpp/client/ydb_persqueue_core/persqueue.h
index 48e6ea50117..872cda5f04f 100644
--- a/ydb/public/sdk/cpp/client/ydb_persqueue_core/persqueue.h
+++ b/ydb/public/sdk/cpp/client/ydb_persqueue_core/persqueue.h
@@ -10,6 +10,7 @@
#include <util/generic/hash.h>
#include <util/generic/maybe.h>
#include <util/generic/ptr.h>
+#include <util/generic/size_literals.h>
#include <util/string/builder.h>
#include <util/thread/pool.h>
@@ -233,8 +234,8 @@ struct TTopicSettings : public TOperationRequestSettings<TDerived> {
FLUENT_SETTING_DEFAULT(TVector<ECodec>, SupportedCodecs, GetDefaultCodecs());
FLUENT_SETTING_DEFAULT(ui64, MaxPartitionStorageSize, 0);
- FLUENT_SETTING_DEFAULT(ui64, MaxPartitionWriteSpeed, 2 * 1024 * 1024);
- FLUENT_SETTING_DEFAULT(ui64, MaxPartitionWriteBurst, 2 * 1024 * 1024);
+ FLUENT_SETTING_DEFAULT(ui64, MaxPartitionWriteSpeed, 2_MB);
+ FLUENT_SETTING_DEFAULT(ui64, MaxPartitionWriteBurst, 2_MB);
FLUENT_SETTING_DEFAULT(bool, ClientWriteDisabled, false);
FLUENT_SETTING_DEFAULT(bool, AllowUnauthenticatedWrite, false);
@@ -1040,7 +1041,7 @@ struct TWriteSessionSettings : public TRequestSettings<TWriteSessionSettings> {
//! Writer will not accept new messages if memory usage exceeds this limit.
//! Memory usage consists of raw data pending compression and compressed messages being sent.
- FLUENT_SETTING_DEFAULT(ui64, MaxMemoryUsage, 20 * 1024 * 1024);
+ FLUENT_SETTING_DEFAULT(ui64, MaxMemoryUsage, 20_MB);
//! Maximum messages accepted by writer but not written (with confirmation from server).
//! Writer will not accept new messages after reaching the limit.
@@ -1250,7 +1251,7 @@ struct TReadSessionSettings : public TRequestSettings<TReadSessionSettings> {
FLUENT_SETTING_DEFAULT(bool, DisableClusterDiscovery, false);
//! Maximum memory usage for read session.
- FLUENT_SETTING_DEFAULT(size_t, MaxMemoryUsageBytes, 100 * 1024 * 1024);
+ FLUENT_SETTING_DEFAULT(size_t, MaxMemoryUsageBytes, 100_MB);
//! Max message time lag. All messages older that now - MaxTimeLag will be ignored.
FLUENT_SETTING_OPTIONAL(TDuration, MaxTimeLag);
diff --git a/ydb/public/sdk/cpp/client/ydb_persqueue_core/ut/basic_usage_ut.cpp b/ydb/public/sdk/cpp/client/ydb_persqueue_core/ut/basic_usage_ut.cpp
index 7e0ac174040..c021a6b7c4f 100644
--- a/ydb/public/sdk/cpp/client/ydb_persqueue_core/ut/basic_usage_ut.cpp
+++ b/ydb/public/sdk/cpp/client/ydb_persqueue_core/ut/basic_usage_ut.cpp
@@ -125,7 +125,8 @@ Y_UNIT_TEST_SUITE(BasicUsage) {
UNIT_ASSERT_VALUES_EQUAL(previousOffset + 1, committedOffset);
UNIT_ASSERT_VALUES_EQUAL(readMessageCount, messageCount);
- log.Write(TLOG_INFO, Sprintf("Time took to write and read %u messages, %u [MiB] in total is %lu [s]", messageCount, (totalSize / 1024 / 1024), (TInstant::Now() - start).Seconds()));
+ log.Write(TLOG_INFO, Sprintf("Time took to write and read %u messages, %lu [MiB] in total is %lu [s]",
+ messageCount, (totalSize / 1_MB), (TInstant::Now() - start).Seconds()));
}
diff --git a/ydb/public/sdk/cpp/client/ydb_persqueue_core/ut/compress_executor_ut.cpp b/ydb/public/sdk/cpp/client/ydb_persqueue_core/ut/compress_executor_ut.cpp
index 04abfab569f..54bef0969e0 100644
--- a/ydb/public/sdk/cpp/client/ydb_persqueue_core/ut/compress_executor_ut.cpp
+++ b/ydb/public/sdk/cpp/client/ydb_persqueue_core/ut/compress_executor_ut.cpp
@@ -46,7 +46,7 @@ Y_UNIT_TEST_SUITE(CompressExecutor) {
UNIT_ASSERT(!waitEventFuture.HasValue());
TStringBuilder msgBuilder;
- while (msgBuilder.size() < 100 * 1024) {
+ while (msgBuilder.size() < 100_KB) {
msgBuilder << "0123456789abcdefghijk";
}
const ui64 COMPRESSED_SIZE = 305;
diff --git a/ydb/services/datastreams/datastreams_proxy.cpp b/ydb/services/datastreams/datastreams_proxy.cpp
index ffd6573fa48..bbecdb14fd9 100644
--- a/ydb/services/datastreams/datastreams_proxy.cpp
+++ b/ydb/services/datastreams/datastreams_proxy.cpp
@@ -34,7 +34,7 @@ namespace NKikimr::NDataStreams::V1 {
namespace {
ui32 PartitionWriteSpeedInBytesPerSec(ui32 speedInKbPerSec) {
- return speedInKbPerSec == 0 ? 1024 * 1024 : speedInKbPerSec * 1024;
+ return speedInKbPerSec == 0 ? 1_MB : speedInKbPerSec * 1_KB;
}
TDuration RetentionPeriod(ui32 retentionPeriodInHours) {
@@ -88,7 +88,7 @@ namespace NKikimr::NDataStreams::V1 {
THashSet<ui32> validLimits {0};
if (AppData(ctx)->PQConfig.ValidWriteSpeedLimitsKbPerSecSize() == 0) {
validLimits.insert(128);
- validLimits.insert(1024);
+ validLimits.insert(1_KB);
} else {
const auto& limits = AppData(ctx)->PQConfig.GetValidWriteSpeedLimitsKbPerSec();
validLimits.insert(limits.begin(), limits.end());
@@ -378,8 +378,8 @@ namespace NKikimr::NDataStreams::V1 {
if (!ValidateWriteSpeedLimit(*GetProtoRequest(), error, ctx)) {
return ReplyWithError(Ydb::StatusIds::BAD_REQUEST, Ydb::PersQueue::ErrorCode::BAD_REQUEST, error, ctx);
}
- groupConfig.MutablePQTabletConfig()->MutablePartitionConfig()->SetWriteSpeedInBytesPerSecond(GetProtoRequest()->write_quota_kb_per_sec() * 1024LL);
- groupConfig.MutablePQTabletConfig()->MutablePartitionConfig()->SetBurstSize(GetProtoRequest()->write_quota_kb_per_sec() * 1024LL);
+ groupConfig.MutablePQTabletConfig()->MutablePartitionConfig()->SetWriteSpeedInBytesPerSecond(GetProtoRequest()->write_quota_kb_per_sec() * 1_KB);
+ groupConfig.MutablePQTabletConfig()->MutablePartitionConfig()->SetBurstSize(GetProtoRequest()->write_quota_kb_per_sec() * 1_KB);
}
//-----------------------------------------------------------------------------------------------------------
@@ -540,7 +540,7 @@ namespace NKikimr::NDataStreams::V1 {
Ydb::DataStreams::V1::DescribeStreamResult result;
auto& pqConfig = PQGroup.GetPQTabletConfig();
- ui32 writeSpeed = pqConfig.GetPartitionConfig().GetWriteSpeedInBytesPerSecond() / 1024;
+ ui32 writeSpeed = pqConfig.GetPartitionConfig().GetWriteSpeedInBytesPerSecond() / 1_KB;
auto& description = *result.mutable_stream_description();
description.set_stream_name(GetProtoRequest()->stream_name());
ui32 retentionPeriodHours = TInstant::Seconds(pqConfig.GetPartitionConfig().GetLifetimeSeconds()).Hours();
diff --git a/ydb/services/datastreams/datastreams_ut.cpp b/ydb/services/datastreams/datastreams_ut.cpp
index d1ccb6f619a..485c999fd84 100644
--- a/ydb/services/datastreams/datastreams_ut.cpp
+++ b/ydb/services/datastreams/datastreams_ut.cpp
@@ -174,7 +174,7 @@ Y_UNIT_TEST_SUITE(DataStreams) {
UNIT_ASSERT_VALUES_EQUAL(result.GetResult().stream_description().stream_status(),
YDS_V1::StreamDescription::ACTIVE);
UNIT_ASSERT_VALUES_EQUAL(result.GetResult().stream_description().stream_name(), streamName);
- UNIT_ASSERT_VALUES_EQUAL(result.GetResult().stream_description().write_quota_kb_per_sec(), 1024);
+ UNIT_ASSERT_VALUES_EQUAL(result.GetResult().stream_description().write_quota_kb_per_sec(), 1_KB);
UNIT_ASSERT_VALUES_EQUAL(result.GetResult().stream_description().retention_period_hours(), 24);
UNIT_ASSERT_VALUES_EQUAL(result.GetResult().stream_description().shards().size(), 3);
@@ -697,7 +697,7 @@ Y_UNIT_TEST_SUITE(DataStreams) {
// Test for too long data
TString longData = TString(1048577, '1');
- TString shortEnoughData = TString(1048576, '1');
+ TString shortEnoughData = TString(1_MB, '1');
result = client.PutRecords(streamName,
{{longData, shortEnoughKey, ""},
@@ -744,7 +744,7 @@ Y_UNIT_TEST_SUITE(DataStreams) {
{
std::vector<NYDS_V1::TDataRecord> records;
- TString data = TString(1024*1024, 'a');
+ TString data = TString(1_MB, 'a');
records.push_back({data, "key", ""});
records.push_back({data, "key", ""});
records.push_back({data, "key", ""});
@@ -1381,7 +1381,7 @@ Y_UNIT_TEST_SUITE(DataStreams) {
}
std::string data;
- data.resize(1 << 10);
+ data.resize(1_KB);
std::iota(data.begin(), data.end(), 1);
TString id{"0000"};
{
@@ -1455,7 +1455,7 @@ Y_UNIT_TEST_SUITE(DataStreams) {
const ui32 recordsCount = 10;
{
std::string data;
- data.resize(1 << 15);
+ data.resize(32_KB);
std::iota(data.begin(), data.end(), 1);
std::random_device rd;
std::mt19937 generator{rd()};
@@ -1513,8 +1513,7 @@ Y_UNIT_TEST_SUITE(DataStreams) {
std::vector<ui64> timestamps;
{
std::string data;
- // data.resize((1 << 21) + 2);
- data.resize(1 << 15);
+ data.resize(32_KB);
std::iota(data.begin(), data.end(), 1);
std::random_device rd;
std::mt19937 generator{rd()};
diff --git a/ydb/services/datastreams/put_records_actor.h b/ydb/services/datastreams/put_records_actor.h
index 6b5888a18b6..a402f488d35 100644
--- a/ydb/services/datastreams/put_records_actor.h
+++ b/ydb/services/datastreams/put_records_actor.h
@@ -193,8 +193,8 @@ namespace NKikimr::NDataStreams::V1 {
if (record.partition_key().empty()) {
return "Empty partition key";
}
- if (record.data().size() > 1048576) {
- return TStringBuilder() << "Data of size of " << record.data().size() << " bytes exceed limit of " << 1048576 << " bytes";
+ if (record.data().size() > 1_MB) {
+ return TStringBuilder() << "Data of size of " << record.data().size() << " bytes exceed limit of " << 1_MB << " bytes";
}
if (record.partition_key().size() > 256) {
return TStringBuilder() << "Partition key is too long: " << record.partition_key();
@@ -203,8 +203,8 @@ namespace NKikimr::NDataStreams::V1 {
return TStringBuilder() << record.explicit_hash_key() << " is not a valid 128 bit decimal";
}
}
- if (totalSize > 5 * 1024 * 1024) {
- return TStringBuilder() << "Total size of PutRecords request of " << totalSize << " bytes exceed limit of " << (5*1024*1024) << " bytes";
+ if (totalSize > 5_MB) {
+ return TStringBuilder() << "Total size of PutRecords request of " << totalSize << " bytes exceed limit of " << 5_MB << " bytes";
}
return "";
diff --git a/ydb/services/persqueue_v1/grpc_pq_read_actor.cpp b/ydb/services/persqueue_v1/grpc_pq_read_actor.cpp
index d83ae00434d..2c371066ef1 100644
--- a/ydb/services/persqueue_v1/grpc_pq_read_actor.cpp
+++ b/ydb/services/persqueue_v1/grpc_pq_read_actor.cpp
@@ -46,7 +46,7 @@ static const NTabletPipe::TClientRetryPolicy RetryPolicyForPipes = {
.DoFirstRetryInstantly = true
};
-static const ui64 MAX_INFLY_BYTES = 25 * 1024 * 1024;
+static const ui64 MAX_INFLY_BYTES = 25_MB;
static const ui32 MAX_INFLY_READS = 10;
static const TDuration READ_TIMEOUT_DURATION = TDuration::Seconds(1);
diff --git a/ydb/services/persqueue_v1/grpc_pq_write_actor.cpp b/ydb/services/persqueue_v1/grpc_pq_write_actor.cpp
index c40ced868e9..2ecb80ac08e 100644
--- a/ydb/services/persqueue_v1/grpc_pq_write_actor.cpp
+++ b/ydb/services/persqueue_v1/grpc_pq_write_actor.cpp
@@ -81,7 +81,7 @@ using namespace Ydb::PersQueue::V1;
static const ui32 MAX_RESERVE_REQUESTS_INFLIGHT = 5;
-static const ui32 MAX_BYTES_INFLIGHT = 1 << 20; //1mb
+static const ui32 MAX_BYTES_INFLIGHT = 1_MB;
static const TDuration SOURCEID_UPDATE_PERIOD = TDuration::Hours(1);
//TODO: add here tracking of bytes in/out
diff --git a/ydb/services/persqueue_v1/persqueue_new_schemecache_ut.cpp b/ydb/services/persqueue_v1/persqueue_new_schemecache_ut.cpp
index 3d53b1c9558..826cff9d860 100644
--- a/ydb/services/persqueue_v1/persqueue_new_schemecache_ut.cpp
+++ b/ydb/services/persqueue_v1/persqueue_new_schemecache_ut.cpp
@@ -285,7 +285,7 @@ namespace NKikimr::NPersQueueTests {
Y_UNIT_TEST(TestReadAtTimestamp) {
auto generate1 = [](ui32 messageId) {
Y_UNUSED(messageId);
- TString message = "Hello___" + CreateGuidAsString() + TString(1024*1024, 'a');
+ TString message = "Hello___" + CreateGuidAsString() + TString(1_MB, 'a');
return message;
};
@@ -293,7 +293,7 @@ namespace NKikimr::NPersQueueTests {
auto generate2 = [](ui32 messageId) {
Y_UNUSED(messageId);
- TString message = "Hello___" + CreateGuidAsString() + TString(1024*10240, 'a');
+ TString message = "Hello___" + CreateGuidAsString() + TString(1_MB, 'a');
return message;
};
diff --git a/ydb/services/persqueue_v1/persqueue_ut.cpp b/ydb/services/persqueue_v1/persqueue_ut.cpp
index 7b3cfcd6a97..8865962ccc0 100644
--- a/ydb/services/persqueue_v1/persqueue_ut.cpp
+++ b/ydb/services/persqueue_v1/persqueue_ut.cpp
@@ -379,7 +379,7 @@ namespace {
ui64 SOURCEID_COUNT_DELETE_BATCH_SIZE = 100;
NPersQueue::TTestServer server;
server.EnableLogs({ NKikimrServices::PERSQUEUE, NKikimrServices::PQ_WRITE_PROXY });
- server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1, 8*1024*1024, 86400, 20000000, "", 200000000, {}, {}, {}, X, 86400);
+ server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1, 8_MB, 86400, 20000000, "", 200000000, {}, {}, {}, X, 86400);
auto driver = server.AnnoyingClient->GetDriver();
@@ -651,7 +651,7 @@ namespace {
Y_UNIT_TEST(WriteExistingBigValue) {
NPersQueue::TTestServer server(PQSettings(0).SetDomainName("Root").SetNodeCount(2));
server.EnableLogs({ NKikimrServices::FLAT_TX_SCHEMESHARD, NKikimrServices::PERSQUEUE });
- server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 2, 8*1024*1024, 86400, 100000);
+ server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 2, 8_MB, 86400, 100000);
TInstant now(Now());
@@ -769,11 +769,11 @@ namespace {
Y_UNIT_TEST(BigRead) {
NPersQueue::TTestServer server(PQSettings(0).SetDomainName("Root"));
- server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1, 8*1024*1024, 86400, 20000000, "user", 2000000);
+ server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1, 8_MB, 86400, 20000000, "user", 2000000);
server.EnableLogs({ NKikimrServices::FLAT_TX_SCHEMESHARD, NKikimrServices::PERSQUEUE });
- TString value(1024*1024, 'x');
+ TString value(1_MB, 'x');
for (ui32 i = 0; i < 32; ++i)
server.AnnoyingClient->WriteToPQ({DEFAULT_TOPIC_NAME, 0, "source1", i}, value);
@@ -795,11 +795,11 @@ namespace {
// expects that L2 size is 32Mb
Y_UNIT_TEST(Cache) {
NPersQueue::TTestServer server(PQSettings(0).SetDomainName("Root"));
- server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1, 8*1024*1024, 86400);
+ server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1, 8_MB, 86400);
server.EnableLogs({ NKikimrServices::FLAT_TX_SCHEMESHARD, NKikimrServices::PERSQUEUE });
- TString value(1024*1024, 'x');
+ TString value(1_MB, 'x');
for (ui32 i = 0; i < 32; ++i)
server.AnnoyingClient->WriteToPQ({DEFAULT_TOPIC_NAME, 0, "source1", i}, value);
@@ -826,14 +826,14 @@ namespace {
Y_UNIT_TEST(CacheHead) {
NPersQueue::TTestServer server(PQSettings(0).SetDomainName("Root"));
- server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1, 6*1024*1024, 86400);
+ server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1, 6_MB, 86400);
server.EnableLogs({ NKikimrServices::FLAT_TX_SCHEMESHARD, NKikimrServices::PERSQUEUE });
ui64 seqNo = 0;
for (ui32 blobSizeKB = 256; blobSizeKB < 4096; blobSizeKB *= 2) {
- static const ui32 maxEventKB = 24*1024;
- ui32 blobSize = blobSizeKB * 1024;
+ static const ui32 maxEventKB = 24_KB;
+ ui32 blobSize = blobSizeKB * 1_KB;
ui32 count = maxEventKB / blobSizeKB;
count -= count%2;
ui32 half = count/2;
@@ -855,9 +855,9 @@ namespace {
Y_UNIT_TEST(SameOffset) {
NPersQueue::TTestServer server(PQSettings(0).SetDomainName("Root"));
- server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1, 6*1024*1024, 86400);
+ server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1, 6_MB, 86400);
TString secondTopic = DEFAULT_TOPIC_NAME + "2";
- server.AnnoyingClient->CreateTopic(secondTopic, 1, 6*1024*1024, 86400);
+ server.AnnoyingClient->CreateTopic(secondTopic, 1, 6_MB, 86400);
server.EnableLogs({ NKikimrServices::FLAT_TX_SCHEMESHARD, NKikimrServices::PERSQUEUE });
@@ -868,7 +868,7 @@ namespace {
server.AnnoyingClient->WriteToPQ({secondTopic, 0, "source1", 0}, value2);
// avoid reading from head
- TString mb(1024*1024, 'x');
+ TString mb(1_MB, 'x');
for (ui32 i = 1; i < 16; ++i) {
server.AnnoyingClient->WriteToPQ({DEFAULT_TOPIC_NAME, 0, "source1", i}, mb);
server.AnnoyingClient->WriteToPQ({secondTopic, 0, "source1", i}, mb);
@@ -1143,7 +1143,7 @@ namespace {
TString shortTopic2Name = "topic12";
PrepareForGrpc(server);
- server.AnnoyingClient->CreateTopic(topic2, 1, 8*1024*1024, 86400, 20000000, "", 200000000, {"user1", "user2"});
+ server.AnnoyingClient->CreateTopic(topic2, 1, 8_MB, 86400, 20000000, "", 200000000, {"user1", "user2"});
server.WaitInit(shortTopic2Name);
server.AnnoyingClient->CreateConsumer("user1");
server.AnnoyingClient->CreateConsumer("user2");
@@ -1729,7 +1729,7 @@ namespace {
auto ev = std::get_if<NYdb::NPersQueue::TWriteSessionEvent::TReadyToAcceptEvent>(&*msg);
UNIT_ASSERT(ev);
- writer->Write(std::move(ev->ContinuationToken), TString((1 << 20) * 60, 'a')); //TODO: Increase GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
+ writer->Write(std::move(ev->ContinuationToken), TString(60_MB, 'a')); //TODO: Increase GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
{
msg = writer->GetEvent(true);
UNIT_ASSERT(msg); // ReadyToAcceptEvent
@@ -1827,7 +1827,7 @@ namespace {
Y_UNIT_TEST(TestLockAfterDrop) {
NPersQueue::TTestServer server{false};
- server.GrpcServerOptions.SetMaxMessageSize(130*1024*1024);
+ server.GrpcServerOptions.SetMaxMessageSize(130_MB);
server.StartServer();
server.AnnoyingClient->CreateTopic(DEFAULT_TOPIC_NAME, 1);
server.WaitInit(SHORT_TOPIC_NAME);
@@ -1835,7 +1835,7 @@ namespace {
auto pqLib = TPQLib::WithCerrLogger();
auto [producer, pcResult] = CreateProducer(pqLib, server.GrpcPort, SHORT_TOPIC_NAME, "123");
- auto f = producer->Write(1, TString(1024, 'a'));
+ auto f = producer->Write(1, TString(1_KB, 'a'));
f.Wait();
ui32 maxCount = 1;
@@ -2282,7 +2282,7 @@ namespace {
auto* writeRequest = clientMessage.mutable_write_request();
auto sequenceNumber = 1;
auto messageCount = 0;
- const auto message = NUnitTest::RandomString(250 * 1024, std::rand());
+ const auto message = NUnitTest::RandomString(250_KB, std::rand());
auto compress = [](TString data, i32 codecID) {
Y_UNUSED(codecID);
return TString(data);
@@ -2321,7 +2321,7 @@ namespace {
auto log = setup.GetLog();
StreamingWriteClientMessage clientMessage;
auto* writeRequest = clientMessage.mutable_write_request();
- const auto message = NUnitTest::RandomString(250 * 1024, std::rand());
+ const auto message = NUnitTest::RandomString(250_KB, std::rand());
const auto codecID = 3;
writeRequest->add_sequence_numbers(1);
writeRequest->add_message_sizes(message.size());
diff --git a/ydb/services/persqueue_v1/ut/persqueue_test_fixture.h b/ydb/services/persqueue_v1/ut/persqueue_test_fixture.h
index 2933d1f3a17..1f306f53543 100644
--- a/ydb/services/persqueue_v1/ut/persqueue_test_fixture.h
+++ b/ydb/services/persqueue_v1/ut/persqueue_test_fixture.h
@@ -51,7 +51,7 @@ namespace NKikimr::NPersQueueTests {
Server->ServerSettings.PQConfig.SetSourceIdTablePath("some unused path");
}
Cerr << "Init PQ - start server on port " << Server->GrpcPort << Endl;
- Server->GrpcServerOptions.SetMaxMessageSize(130 * 1024 * 1024);
+ Server->GrpcServerOptions.SetMaxMessageSize(130_MB);
EnablePQLogs({NKikimrServices::PQ_READ_PROXY, NKikimrServices::PQ_WRITE_PROXY, NKikimrServices::FLAT_TX_SCHEMESHARD});
EnablePQLogs({NKikimrServices::PERSQUEUE}, NLog::EPriority::PRI_INFO);
diff --git a/ydb/services/persqueue_v1/ut/rate_limiter_test_setup.cpp b/ydb/services/persqueue_v1/ut/rate_limiter_test_setup.cpp
index 779d60e7785..62d58022b98 100644
--- a/ydb/services/persqueue_v1/ut/rate_limiter_test_setup.cpp
+++ b/ydb/services/persqueue_v1/ut/rate_limiter_test_setup.cpp
@@ -120,7 +120,7 @@ void TRateLimiterTestSetup::InitServer(bool enableReadQuoting) {
settings.PQConfig.MutableQuotingConfig()->SetEnableReadQuoting(enableReadQuoting);
settings.PQConfig.MutableQuotingConfig()->SetTopicWriteQuotaEntityToLimit(LimitedEntity);
- Server->GrpcServerOptions.SetMaxMessageSize(130 * 1024 * 1024);
+ Server->GrpcServerOptions.SetMaxMessageSize(130_MB);
Server->StartServer();
Server->EnableLogs(
{