55#include < ydb/core/persqueue/ut/common/pq_ut_common.h>
66#include < ydb/core/security/ticket_parser.h>
77
8+ #include < ydb/core/protos/grpc_pq_old.pb.h>
9+
810#include < ydb/core/testlib/fake_scheme_shard.h>
911#include < ydb/core/testlib/tablet_helpers.h>
1012
@@ -1530,10 +1532,22 @@ Y_UNIT_TEST(TestTimeRetention) {
15301532 });
15311533}
15321534
1533- Y_UNIT_TEST (TestCompactifiedWithRetention) {
1534- // TODO(abcdef): temporarily deleted
1535- return ;
1535+ TString GetSerializedData (ui64 seqNo, const TString& payload, const TString& key) {
1536+ NKikimrPQClient::TDataChunk proto;
1537+ proto.SetSeqNo (seqNo);
1538+ proto.SetData (payload);
1539+ if (!key.empty ()) {
1540+ auto *msgMeta = proto.AddMessageMeta ();
1541+ msgMeta->set_key (" __key" );
1542+ msgMeta->set_value (key);
1543+ }
1544+ TString dataChunkStr;
1545+ bool res = proto.SerializeToString (&dataChunkStr);
1546+ Y_ABORT_UNLESS (res);
1547+ return dataChunkStr;
1548+ }
15361549
1550+ Y_UNIT_TEST (TestCompactifiedWithRetention) {
15371551 TTestContext tc;
15381552 RunTestWithReboots (tc.TabletIds , [&]() {
15391553 return tc.InitialEventsFilter .Prepare ();
@@ -1545,24 +1559,29 @@ Y_UNIT_TEST(TestCompactifiedWithRetention) {
15451559
15461560 tc.Runtime ->GetAppData (0 ).PQConfig .MutableCompactionConfig ()->SetBlobsCount (0 );
15471561
1548- TVector<std::pair<ui64, TString>> data;
1549- activeZone = PlainOrSoSlow (true , false );
1550-
1562+ ui64 key = 1 ;
15511563 TString s{32 , ' c' };
15521564 ui32 pp = 8 + 4 + 2 + 9 ;
1553- for (ui32 i = 0 ; i < 10 ; ++i) {
1554- data.push_back ({i + 1 , s.substr (pp)});
1555- }
1565+ auto getData = [&] () {
1566+ TVector<std::pair<ui64, TString>> data;
1567+ for (ui32 i = 0 ; i < 10 ; ++i) {
1568+ data.push_back ({i + 1 , GetSerializedData (i + 1 , s.substr (pp), ToString (key++))});
1569+ }
1570+ return data;
1571+ };
1572+ activeZone = PlainOrSoSlow (true , false );
1573+
1574+
15561575 PQTabletPrepare ({.maxCountInPartition =1000 , .deleteTime =0 , .lowWatermark =100 , .enableCompactificationByKey = true }, {}, tc);
1557- CmdWrite (0 , " sourceid0" , data , tc, false , {}, true );
1558- CmdWrite (0 , " sourceid1" , data , tc, false );
1559- CmdWrite (0 , " sourceid2" , data , tc, false );
1576+ CmdWrite (0 , " sourceid0" , getData () , tc, false , {}, true );
1577+ CmdWrite (0 , " sourceid1" , getData () , tc, false );
1578+ CmdWrite (0 , " sourceid2" , getData () , tc, false );
15601579 PQGetPartInfo (0 , 30 , tc);
15611580
15621581 PQTabletPrepare ({.maxCountInPartition =1000 , .deleteTime =0 , .lowWatermark =100 , .enableCompactificationByKey = false }, {}, tc);
1563- CmdWrite (0 , " sourceid3" , data , tc, false );
1564- CmdWrite (0 , " sourceid4" , data , tc, false );
1565- CmdWrite (0 , " sourceid5" , data , tc, false );
1582+ CmdWrite (0 , " sourceid3" , getData () , tc, false );
1583+ CmdWrite (0 , " sourceid4" , getData () , tc, false );
1584+ CmdWrite (0 , " sourceid5" , getData () , tc, false );
15661585 Cerr << " Get part info with compactification disabled\n " ;
15671586 PQGetPartInfo (50 , 60 , tc);
15681587 });
0 commit comments