1
1
#include < ydb/core/tx/schemeshard/ut_helpers/helpers.h>
2
2
#include < ydb/core/tx/columnshard/columnshard.h>
3
3
#include < ydb/core/tx/columnshard/test_helper/columnshard_ut_common.h>
4
+ #include < ydb/core/tx/columnshard/hooks/testing/controller.h>
4
5
#include < ydb/core/formats/arrow/arrow_helpers.h>
5
6
#include < ydb/core/formats/arrow/arrow_batch_builder.h>
6
7
@@ -634,17 +635,17 @@ Y_UNIT_TEST_SUITE(TOlap) {
634
635
env.TestWaitNotification (runtime, txId);
635
636
}
636
637
637
- // TODO: AlterTiers
638
- // negatives for store: disallow alters
639
- // negatives for table: wrong tiers count, wrong tiers, wrong eviction column, wrong eviction values,
640
- // different TTL columns in tiers
641
- #if 0
642
638
Y_UNIT_TEST (StoreStats) {
643
639
TTestBasicRuntime runtime;
644
640
TTestEnv env (runtime);
645
641
runtime.SetLogPriority (NKikimrServices::TX_COLUMNSHARD, NActors::NLog::PRI_DEBUG);
646
642
runtime.UpdateCurrentTime (TInstant::Now () - TDuration::Seconds (600 ));
647
643
644
+ auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
645
+ csController->SetPeriodicWakeupActivationPeriod (TDuration::Seconds (1 ));
646
+ csController->SetLagForCompactionBeforeTierings (TDuration::Seconds (1 ));
647
+ csController->SetOverrideReduceMemoryIntervalLimit (1LLU << 30 );
648
+
648
649
// disable stats batching
649
650
auto & appData = runtime.GetAppData ();
650
651
appData.SchemeShardConfig .SetStatsBatchTimeoutMs (0 );
@@ -690,6 +691,16 @@ Y_UNIT_TEST_SUITE(TOlap) {
690
691
UNIT_ASSERT (shardId);
691
692
UNIT_ASSERT (pathId);
692
693
UNIT_ASSERT (planStep);
694
+ {
695
+ auto description = DescribePrivatePath (runtime, TTestTxConfig::SchemeShard, " /MyRoot/OlapStore/ColumnTable" , true , true );
696
+ Cerr << description.DebugString () << Endl;
697
+ auto & tabletStats = description.GetPathDescription ().GetTableStats ();
698
+
699
+ UNIT_ASSERT (description.GetPathDescription ().HasTableStats ());
700
+ UNIT_ASSERT_EQUAL (tabletStats.GetRowCount (), 0 );
701
+ UNIT_ASSERT_EQUAL (tabletStats.GetDataSize (), 0 );
702
+ }
703
+
693
704
694
705
ui32 rowsInBatch = 100000 ;
695
706
@@ -702,7 +713,7 @@ Y_UNIT_TEST_SUITE(TOlap) {
702
713
TSet<ui64> txIds;
703
714
for (ui32 i = 0 ; i < 10 ; ++i) {
704
715
std::vector<ui64> writeIds;
705
- NTxUT::WriteData(runtime, sender, shardId, ++writeId, pathId, data, defaultYdbSchema, &writeIds);
716
+ NTxUT::WriteData (runtime, sender, shardId, ++writeId, pathId, data, defaultYdbSchema, &writeIds, NEvWrite::EModificationType::Upsert, { " timestamp " } );
706
717
NTxUT::ProposeCommit (runtime, sender, shardId, ++txId, writeIds);
707
718
txIds.insert (txId);
708
719
}
@@ -714,16 +725,28 @@ Y_UNIT_TEST_SUITE(TOlap) {
714
725
715
726
// trigger periodic stats at shard (after timeout)
716
727
std::vector<ui64> writeIds;
717
- NTxUT::WriteData(runtime, sender, shardId, ++writeId, pathId, data, defaultYdbSchema, &writeIds);
728
+ NTxUT::WriteData (runtime, sender, shardId, ++writeId, pathId, data, defaultYdbSchema, &writeIds, NEvWrite::EModificationType::Upsert, { " timestamp " } );
718
729
NTxUT::ProposeCommit (runtime, sender, shardId, ++txId, writeIds);
719
730
NTxUT::PlanCommit (runtime, sender, shardId, ++planStep, {txId});
720
731
}
732
+ csController->WaitIndexation (TDuration::Seconds (5 ));
733
+ {
734
+ auto description = DescribePrivatePath (runtime, TTestTxConfig::SchemeShard, " /MyRoot/OlapStore" , true , true );
735
+ auto & tabletStats = description.GetPathDescription ().GetTableStats ();
721
736
722
- auto description = DescribePrivatePath(runtime, TTestTxConfig::SchemeShard, "/MyRoot/OlapStore", true, true);
723
- auto& tabletStats = description.GetPathDescription().GetTableStats();
737
+ UNIT_ASSERT_GT (tabletStats.GetRowCount (), 0 );
738
+ UNIT_ASSERT_GT (tabletStats.GetDataSize (), 0 );
739
+ }
740
+
741
+ {
742
+ auto description = DescribePrivatePath (runtime, TTestTxConfig::SchemeShard, " /MyRoot/OlapStore/ColumnTable" , true , true );
743
+ Cerr << description.DebugString () << Endl;
744
+ auto & tabletStats = description.GetPathDescription ().GetTableStats ();
745
+
746
+ UNIT_ASSERT_GT (tabletStats.GetRowCount (), 0 );
747
+ UNIT_ASSERT_GT (tabletStats.GetDataSize (), 0 );
748
+ }
724
749
725
- UNIT_ASSERT_GT(tabletStats.GetRowCount(), 0);
726
- UNIT_ASSERT_GT(tabletStats.GetDataSize(), 0);
727
750
#if 0
728
751
TestDropColumnTable(runtime, ++txId, "/MyRoot/OlapStore", "ColumnTable");
729
752
env.TestWaitNotification(runtime, txId);
@@ -738,5 +761,4 @@ Y_UNIT_TEST_SUITE(TOlap) {
738
761
TestLsPathId(runtime, 2, NLs::PathStringEqual(""));
739
762
#endif
740
763
}
741
- #endif
742
764
}
0 commit comments