@@ -28,6 +28,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
28
28
auto selectQuery = TString (R"(
29
29
SELECT PathId, Kind, TabletId, Sum(Rows) as Rows
30
30
FROM `/Root/olapStore/.sys/store_primary_index_portion_stats`
31
+ WHERE Activity == 1
31
32
GROUP BY PathId, Kind, TabletId
32
33
ORDER BY TabletId, Kind, PathId
33
34
)" );
@@ -61,13 +62,14 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
61
62
WriteTestData (kikimr, " /Root/olapStore/olapTable_1" , 0 , 1000000 + i * 10000 , 1000 );
62
63
WriteTestData (kikimr, " /Root/olapStore/olapTable_2" , 0 , 1000000 + i * 10000 , 2000 );
63
64
}
64
- csController->WaitCompactions (TDuration::Seconds (10 ));
65
+ csController->WaitCompactions (TDuration::Seconds (5 ));
65
66
66
67
auto tableClient = kikimr.GetTableClient ();
67
68
{
68
69
auto selectQuery = TString (R"(
69
70
SELECT PathId, Kind, TabletId
70
71
FROM `/Root/olapStore/olapTable_1/.sys/primary_index_stats`
72
+ WHERE Activity = 1
71
73
GROUP BY PathId, TabletId, Kind
72
74
ORDER BY PathId, TabletId, Kind
73
75
)" );
@@ -82,6 +84,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
82
84
auto selectQuery = TString (R"(
83
85
SELECT PathId, Kind, TabletId
84
86
FROM `/Root/olapStore/olapTable_2/.sys/primary_index_stats`
87
+ WHERE Activity = 1
85
88
GROUP BY PathId, TabletId, Kind
86
89
ORDER BY PathId, TabletId, Kind
87
90
)" );
@@ -168,10 +171,10 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
168
171
helper.ExecuteSchemeQuery (" ALTER OBJECT `/Root/olapStore` (TYPE TABLESTORE) SET (ACTION=ALTER_COLUMN, NAME=field, `SERIALIZER.CLASS_NAME`=`ARROW_SERIALIZER`, `COMPRESSION.TYPE`=`zstd`);" );
169
172
csController->WaitCompactions (TDuration::Seconds (10 ));
170
173
}
171
- const ui64 rawBytesUnpack = rawBytesUnpack1PK - rawBytesPK1;
172
- const ui64 bytesUnpack = bytesUnpack1PK - bytesPK1;
173
- const ui64 rawBytesPack = rawBytesPackAndUnpack2PK - rawBytesUnpack1PK - rawBytesPK1;
174
- const ui64 bytesPack = bytesPackAndUnpack2PK - bytesUnpack1PK - bytesPK1;
174
+ const i64 rawBytesUnpack = rawBytesUnpack1PK - rawBytesPK1;
175
+ const i64 bytesUnpack = bytesUnpack1PK - bytesPK1;
176
+ const i64 rawBytesPack = rawBytesPackAndUnpack2PK - rawBytesUnpack1PK - rawBytesPK1;
177
+ const i64 bytesPack = bytesPackAndUnpack2PK - bytesUnpack1PK - bytesPK1;
175
178
TStringBuilder result;
176
179
result << " unpacked data: " << rawBytesUnpack << " / " << bytesUnpack << Endl;
177
180
result << " packed data: " << rawBytesPack << " / " << bytesPack << Endl;
@@ -292,6 +295,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
292
295
ui64 rawBytes1;
293
296
ui64 bytes1;
294
297
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
298
+ csController->SetSmallSizeDetector (Max<ui32>());
295
299
auto settings = TKikimrSettings ().SetWithSampleTables (false );
296
300
TKikimrRunner kikimr (settings);
297
301
Tests::NCommon::TLoggerInit (kikimr).Initialize ();
@@ -308,6 +312,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
308
312
helper.ExecuteSchemeQuery (" ALTER OBJECT `/Root/olapStore` (TYPE TABLESTORE) SET (ACTION=UPSERT_INDEX, NAME=pk_int_max, TYPE=MAX, FEATURES=`{\" column_name\" : \" pk_int\" }`);" );
309
313
helper.ExecuteSchemeQuery (" ALTER OBJECT `/Root/olapStore` (TYPE TABLESTORE) SET (ACTION=UPSERT_OPTIONS, SCHEME_NEED_ACTUALIZATION=`true`);" );
310
314
csController->WaitActualization (TDuration::Seconds (40 ));
315
+ csController->WaitCompactions (TDuration::Seconds (5 ));
311
316
{
312
317
ui64 rawBytes2;
313
318
ui64 bytes2;
@@ -316,7 +321,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
316
321
AFL_VERIFY (bytes2 < bytes1 * 0.5 )(" f1" , bytes1)(" f2" , bytes2);
317
322
std::vector<NJson::TJsonValue> stats;
318
323
helper.GetStats (stats, true );
319
- AFL_VERIFY (stats.size () == 3 );
324
+ AFL_VERIFY (stats.size () == 3 )( " count " , stats. size ()) ;
320
325
for (auto && i : stats) {
321
326
AFL_VERIFY (i.IsArray ());
322
327
AFL_VERIFY (i.GetArraySafe ().size () == 1 );
@@ -396,6 +401,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
396
401
auto selectQuery = TString (R"(
397
402
SELECT SUM(BlobRangeSize) as Bytes, SUM(Rows) as Rows, PathId, TabletId
398
403
FROM `/Root/olapStore/.sys/store_primary_index_stats`
404
+ WHERE Activity == 1
399
405
GROUP BY PathId, TabletId
400
406
ORDER BY Bytes
401
407
)" );
@@ -409,6 +415,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
409
415
auto selectQuery = TString (R"(
410
416
SELECT Sum(Rows) as Rows, Kind, Sum(ColumnRawBytes) as RawBytes, PathId
411
417
FROM `/Root/olapStore/.sys/store_primary_index_portion_stats`
418
+ WHERE Activity == 1
412
419
GROUP BY Kind, PathId
413
420
ORDER BY PathId, Kind, Rows
414
421
)" );
@@ -529,6 +536,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
529
536
auto selectQuery = TString (R"(
530
537
SELECT PathId, Kind, TabletId, Sum(BlobRangeSize) as Bytes
531
538
FROM `/Root/olapStore/.sys/store_primary_index_stats`
539
+ WHERE Activity == 1
532
540
GROUP BY PathId, Kind, TabletId
533
541
ORDER BY PathId, Kind, TabletId;
534
542
)" );
@@ -542,6 +550,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
542
550
auto selectQuery = TString (R"(
543
551
SELECT PathId, Kind, TabletId, Sum(BlobRangeSize) as Bytes
544
552
FROM `/Root/olapStore/.sys/store_primary_index_stats`
553
+ WHERE Activity == 1
545
554
GROUP BY PathId, Kind, TabletId
546
555
ORDER BY PathId, Kind, TabletId;
547
556
)" );
@@ -569,6 +578,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
569
578
SELECT PathId, Kind, TabletId
570
579
FROM `/Root/olapStore/.sys/store_primary_index_stats`
571
580
WHERE Kind IN ('SPLIT_COMPACTED', 'INACTIVE', 'EVICTED', 'INSERTED')
581
+ AND Activity == 1
572
582
GROUP BY PathId, Kind, TabletId
573
583
ORDER BY PathId, Kind, TabletId;
574
584
)" );
@@ -700,6 +710,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
700
710
auto selectQuery = TString (R"(
701
711
SELECT PathId, TabletId, Kind
702
712
FROM `/Root/olapStore/.sys/store_primary_index_stats`
713
+ WHERE Activity == 1
703
714
GROUP BY PathId, TabletId, Kind
704
715
)" );
705
716
@@ -715,6 +726,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
715
726
count(distinct(Kind)) as KindsCount,
716
727
count(distinct(TabletId)) as TabletsCount
717
728
FROM `/Root/olapStore/.sys/store_primary_index_stats`
729
+ WHERE Activity == 1
718
730
)" );
719
731
720
732
auto rows = ExecuteScanQuery (tableClient, selectQuery);
@@ -727,6 +739,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
727
739
auto selectQuery = TString (R"(
728
740
SELECT PathId, count(*), sum(Rows), sum(BlobRangeSize), sum(RawBytes)
729
741
FROM `/Root/olapStore/.sys/store_primary_index_stats`
742
+ WHERE Activity == 1
730
743
GROUP BY PathId
731
744
ORDER BY PathId
732
745
)" );
0 commit comments