@@ -52,79 +52,6 @@ void CreateTableWithGlobalIndex(TTestEnv& env, const TString& databaseName, cons
5252 FillTable (env, databaseName, tableName, rowCount);
5353}
5454
55- void ValidateRowCount (TTestActorRuntime& runtime, ui32 nodeIndex, TPathId pathId, size_t expectedRowCount) {
56- auto statServiceId = NStat::MakeStatServiceID (runtime.GetNodeId (nodeIndex));
57- ui64 rowCount = 0 ;
58- while (rowCount == 0 ) {
59- NStat::TRequest req;
60- req.PathId = pathId;
61-
62- auto evGet = std::make_unique<TEvStatistics::TEvGetStatistics>();
63- evGet->StatType = NStat::EStatType::SIMPLE;
64- evGet->StatRequests .push_back (req);
65-
66- auto sender = runtime.AllocateEdgeActor (nodeIndex);
67- runtime.Send (statServiceId, sender, evGet.release (), nodeIndex, true );
68- auto evResult = runtime.GrabEdgeEventRethrow <TEvStatistics::TEvGetStatisticsResult>(sender);
69-
70- UNIT_ASSERT (evResult);
71- UNIT_ASSERT (evResult->Get ());
72- UNIT_ASSERT (evResult->Get ()->StatResponses .size () == 1 );
73-
74- auto rsp = evResult->Get ()->StatResponses [0 ];
75- auto stat = rsp.Simple ;
76-
77- rowCount = stat.RowCount ;
78-
79- if (rowCount != 0 ) {
80- UNIT_ASSERT (stat.RowCount == expectedRowCount);
81- break ;
82- }
83-
84- runtime.SimulateSleep (TDuration::Seconds (1 ));
85- }
86- }
87-
88- ui64 GetRowCount (TTestActorRuntime& runtime, ui32 nodeIndex, TPathId pathId) {
89- auto statServiceId = NStat::MakeStatServiceID (runtime.GetNodeId (nodeIndex));
90- NStat::TRequest req;
91- req.PathId = pathId;
92-
93- auto evGet = std::make_unique<TEvStatistics::TEvGetStatistics>();
94- evGet->StatType = NStat::EStatType::SIMPLE;
95- evGet->StatRequests .push_back (req);
96-
97- auto sender = runtime.AllocateEdgeActor (nodeIndex);
98- runtime.Send (statServiceId, sender, evGet.release (), nodeIndex, true );
99- auto evResult = runtime.GrabEdgeEventRethrow <TEvStatistics::TEvGetStatisticsResult>(sender);
100-
101- UNIT_ASSERT (evResult);
102- UNIT_ASSERT (evResult->Get ());
103- UNIT_ASSERT (evResult->Get ()->StatResponses .size () == 1 );
104-
105- auto rsp = evResult->Get ()->StatResponses [0 ];
106- auto stat = rsp.Simple ;
107-
108- return stat.RowCount ;
109- }
110-
111- void waitForRowCount (
112- TTestActorRuntime& runtime, ui32 nodeIndex,
113- TPathId pathId, size_t expectedRowCount, size_t timeoutSec = 130 ) {
114- ui64 lastRowCount = 0 ;
115- for (size_t i = 0 ; i <= timeoutSec; ++i) {
116- lastRowCount = GetRowCount (runtime, nodeIndex, pathId);
117- if (i % 5 == 0 ) {
118- Cerr << " row count: " << lastRowCount << " (expected: " << expectedRowCount << " )\n " ;
119- }
120- if (lastRowCount == expectedRowCount) {
121- return ;
122- }
123- runtime.SimulateSleep (TDuration::Seconds (1 ));
124- }
125- UNIT_ASSERT_C (false , " timed out, last row count: " << lastRowCount);
126- }
127-
12855} // namespace
12956
13057Y_UNIT_TEST_SUITE (BasicStatistics) {
@@ -485,7 +412,7 @@ Y_UNIT_TEST_SUITE(BasicStatistics) {
485412
486413 // After everything is healed, stats should get updated.
487414 blockSSUpdates.Stop ();
488- waitForRowCount (runtime, otherNodeIdx, pathId, rowCount2);
415+ WaitForRowCount (runtime, otherNodeIdx, pathId, rowCount2);
489416 }
490417}
491418
0 commit comments