Skip to content

Commit 4169e81

Browse files
Moved commit "Y_VERIFY in the RenameFormedBlobs function" from ydb repo
1 parent 894dab3 commit 4169e81

File tree

1 file changed

+91
-4
lines changed

1 file changed

+91
-4
lines changed

src/client/topic/ut/topic_to_table_ut.cpp

Lines changed: 91 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ class TFixture : public NUnitTest::TBaseFixture {
152152

153153
void TestTxWithBigBlobs(const TTestTxWithBigBlobsParams& params);
154154

155+
void WriteMessagesInTx(size_t big, size_t small);
156+
155157
const TDriver& GetDriver() const;
156158

157159
void CheckTabletKeys(const TString& topicName);
@@ -1611,21 +1613,22 @@ void TFixture::TestTxWithBigBlobs(const TTestTxWithBigBlobsParams& params)
16111613

16121614
for (size_t i = 0; i < params.OldHeadCount; ++i) {
16131615
WriteToTopic("topic_A", TEST_MESSAGE_GROUP_ID, TString(100'000, 'x'));
1616+
WaitForAcks("topic_A", TEST_MESSAGE_GROUP_ID);
16141617
++oldHeadMsgCount;
16151618
}
16161619

16171620
for (size_t i = 0; i < params.BigBlobsCount; ++i) {
1618-
WriteToTopic("topic_A", TEST_MESSAGE_GROUP_ID, TString(7'900'000, 'x'), &tx);
1621+
WriteToTopic("topic_A", TEST_MESSAGE_GROUP_ID, TString(7'000'000, 'x'), &tx);
1622+
WaitForAcks("topic_A", TEST_MESSAGE_GROUP_ID);
16191623
++bigBlobMsgCount;
16201624
}
16211625

16221626
for (size_t i = 0; i < params.NewHeadCount; ++i) {
16231627
WriteToTopic("topic_A", TEST_MESSAGE_GROUP_ID, TString(100'000, 'x'), &tx);
1628+
WaitForAcks("topic_A", TEST_MESSAGE_GROUP_ID);
16241629
++newHeadMsgCount;
16251630
}
16261631

1627-
WaitForAcks("topic_A", TEST_MESSAGE_GROUP_ID);
1628-
16291632
if (params.RestartMode == ERestartBeforeCommit) {
16301633
RestartPQTablet("topic_A", 0);
16311634
}
@@ -1654,7 +1657,7 @@ void TFixture::TestTxWithBigBlobs(const TTestTxWithBigBlobsParams& params)
16541657
start += oldHeadMsgCount;
16551658

16561659
for (size_t i = 0; i < bigBlobMsgCount; ++i) {
1657-
UNIT_ASSERT_VALUES_EQUAL(messages[start + i].size(), 7'900'000);
1660+
UNIT_ASSERT_VALUES_EQUAL(messages[start + i].size(), 7'000'000);
16581661
}
16591662
start += bigBlobMsgCount;
16601663

@@ -1921,6 +1924,90 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_28, TFixture)
19211924
UNIT_ASSERT_VALUES_EQUAL(messages.size(), 2);
19221925
}
19231926

1927+
void TFixture::WriteMessagesInTx(size_t big, size_t small)
1928+
{
1929+
CreateTopic("topic_A", TEST_CONSUMER);
1930+
1931+
NTable::TSession tableSession = CreateTableSession();
1932+
NTable::TTransaction tx = BeginTx(tableSession);
1933+
1934+
for (size_t i = 0; i < big; ++i) {
1935+
WriteToTopic("topic_A", TEST_MESSAGE_GROUP_ID, TString(7'000'000, 'x'), &tx, 0);
1936+
WaitForAcks("topic_A", TEST_MESSAGE_GROUP_ID);
1937+
}
1938+
1939+
for (size_t i = 0; i < small; ++i) {
1940+
WriteToTopic("topic_A", TEST_MESSAGE_GROUP_ID, TString(16'384, 'x'), &tx, 0);
1941+
WaitForAcks("topic_A", TEST_MESSAGE_GROUP_ID);
1942+
}
1943+
1944+
CommitTx(tx, EStatus::SUCCESS);
1945+
}
1946+
1947+
Y_UNIT_TEST_F(WriteToTopic_Demo_29, TFixture)
1948+
{
1949+
WriteMessagesInTx(1, 0);
1950+
WriteMessagesInTx(1, 0);
1951+
}
1952+
1953+
Y_UNIT_TEST_F(WriteToTopic_Demo_30, TFixture)
1954+
{
1955+
WriteMessagesInTx(1, 0);
1956+
WriteMessagesInTx(0, 1);
1957+
}
1958+
1959+
Y_UNIT_TEST_F(WriteToTopic_Demo_31, TFixture)
1960+
{
1961+
WriteMessagesInTx(1, 0);
1962+
WriteMessagesInTx(1, 1);
1963+
}
1964+
1965+
Y_UNIT_TEST_F(WriteToTopic_Demo_32, TFixture)
1966+
{
1967+
WriteMessagesInTx(0, 1);
1968+
WriteMessagesInTx(1, 0);
1969+
}
1970+
1971+
Y_UNIT_TEST_F(WriteToTopic_Demo_33, TFixture)
1972+
{
1973+
WriteMessagesInTx(0, 1);
1974+
WriteMessagesInTx(0, 1);
1975+
}
1976+
1977+
Y_UNIT_TEST_F(WriteToTopic_Demo_34, TFixture)
1978+
{
1979+
WriteMessagesInTx(0, 1);
1980+
WriteMessagesInTx(1, 1);
1981+
}
1982+
1983+
Y_UNIT_TEST_F(WriteToTopic_Demo_35, TFixture)
1984+
{
1985+
WriteMessagesInTx(1, 1);
1986+
WriteMessagesInTx(1, 0);
1987+
}
1988+
1989+
Y_UNIT_TEST_F(WriteToTopic_Demo_36, TFixture)
1990+
{
1991+
WriteMessagesInTx(1, 1);
1992+
WriteMessagesInTx(0, 1);
1993+
}
1994+
1995+
Y_UNIT_TEST_F(WriteToTopic_Demo_37, TFixture)
1996+
{
1997+
WriteMessagesInTx(1, 1);
1998+
WriteMessagesInTx(1, 1);
1999+
}
2000+
2001+
2002+
Y_UNIT_TEST_F(WriteToTopic_Demo_38, TFixture)
2003+
{
2004+
WriteMessagesInTx(2, 202);
2005+
WriteMessagesInTx(2, 200);
2006+
WriteMessagesInTx(0, 1);
2007+
WriteMessagesInTx(4, 0);
2008+
WriteMessagesInTx(0, 1);
2009+
}
2010+
19242011
}
19252012

19262013
}

0 commit comments

Comments
 (0)