@@ -25,8 +25,8 @@ Y_UNIT_TEST_SUITE(GroupLayoutSanitizer) {
2525 }
2626 }
2727
28- void CreateEnv (std::unique_ptr<TEnvironmentSetup>& env, std::vector<TNodeLocation>& locations) {
29- TBlobStorageGroupType groupType = TBlobStorageGroupType::ErasureMirror3dc;
28+ void CreateEnv (std::unique_ptr<TEnvironmentSetup>& env, std::vector<TNodeLocation>& locations,
29+ TBlobStorageGroupType groupType) {
3030 const ui32 numNodes = locations.size ();
3131
3232 env.reset (new TEnvironmentSetup ({
@@ -37,39 +37,49 @@ Y_UNIT_TEST_SUITE(GroupLayoutSanitizer) {
3737
3838 const ui32 disksPerNode = 1 ;
3939 const ui32 slotsPerDisk = 3 ;
40+
41+ env->Runtime ->FilterFunction = CatchSanitizeRequests;
4042 env->CreateBoxAndPool (disksPerNode, numNodes * disksPerNode * slotsPerDisk / 9 );
43+ env->Runtime ->FilterFunction = {};
4144 }
4245
43- Y_UNIT_TEST (Test3dc) {
46+ NActorsInterconnect::TNodeLocation LocationGenerator (ui32 dc, ui32 rack, ui32 unit) {
47+ NActorsInterconnect::TNodeLocation proto;
48+ proto.SetDataCenter (ToString (dc));
49+ proto.SetRack (ToString (rack));
50+ proto.SetUnit (ToString (unit));
51+ return proto;
52+ }
53+
54+ void Test (TBlobStorageGroupType groupType, ui32 dcs, ui32 racks, ui32 units) {
4455 std::vector<TNodeLocation> locations;
45- TLocationGenerator locationGenerator = [](ui32 dc, ui32 rack, ui32 unit) {
46- NActorsInterconnect::TNodeLocation proto;
47- proto.SetDataCenter (ToString (dc));
48- proto.SetRack (ToString (rack));
49- proto.SetUnit (ToString (unit));
50- return proto;
51- };
5256
53- MakeLocations (locations, 3 , 5 , 1 , locationGenerator );
57+ MakeLocations (locations, dcs, racks, units, LocationGenerator );
5458 std::unique_ptr<TEnvironmentSetup> env;
55- CreateEnv (env, locations);
5659
57- TBlobStorageGroupType groupType = TBlobStorageGroupType::ErasureMirror3dc;
58- TGroupGeometryInfo geom = CreateGroupGeometry (groupType);
60+ CreateEnv (env, locations, groupType);
5961
62+
63+ // Assure that sanitizer doesn't send request to initially allocated groups
6064 env->Runtime ->FilterFunction = CatchSanitizeRequests;
65+ env->UpdateSettings (true , false , true );
66+ env->Sim (TDuration::Minutes (3 ));
67+ env->UpdateSettings (false , false , false );
68+
69+ TGroupGeometryInfo geom = CreateGroupGeometry (groupType);
6170
6271 TString error;
6372 auto cfg = env->FetchBaseConfig ();
6473 UNIT_ASSERT_C (CheckBaseConfigLayout (geom, cfg, true , error), error);
65- env->Cleanup ();
6674
6775 // Shuffle node locayion, assure that layout error occured
68- std::random_shuffle (locations.begin (), locations.end ());
69- env->Initialize ();
70- env->Sim (TDuration::Seconds (100 ));
71- cfg = env->FetchBaseConfig ();
72- CheckBaseConfigLayout (geom, cfg, true , error);
76+ do {
77+ env->Cleanup ();
78+ std::random_shuffle (locations.begin (), locations.end ());
79+ env->Initialize ();
80+ env->Sim (TDuration::Seconds (100 ));
81+ cfg = env->FetchBaseConfig ();
82+ } while (CheckBaseConfigLayout (geom, cfg, true , error));
7383 Cerr << error << Endl;
7484
7585 // Sanitize groups
@@ -86,6 +96,18 @@ Y_UNIT_TEST_SUITE(GroupLayoutSanitizer) {
8696 UNIT_ASSERT_C (CheckBaseConfigLayout (geom, cfg, true , error), error);
8797 }
8898
99+ Y_UNIT_TEST (Test3dc) {
100+ Test (TBlobStorageGroupType::ErasureMirror3dc, 3 , 5 , 1 );
101+ }
102+
103+ Y_UNIT_TEST (TestBlock4Plus2) {
104+ Test (TBlobStorageGroupType::Erasure4Plus2Block, 1 , 10 , 2 );
105+ }
106+
107+ Y_UNIT_TEST (TestMirror3of4) {
108+ Test (TBlobStorageGroupType::ErasureMirror3of4, 1 , 10 , 2 );
109+ }
110+
89111 TString PrintGroups (TBlobStorageGroupType groupType, const NKikimrBlobStorage::TBaseConfig& cfg,
90112 std::vector<TNodeLocation> locations) {
91113 TGroupGeometryInfo geom = CreateGroupGeometry (groupType);
@@ -137,6 +159,7 @@ Y_UNIT_TEST_SUITE(GroupLayoutSanitizer) {
137159 }
138160
139161 void TestMultipleRealmsOccupation (bool allowMultipleRealmsOccupation) {
162+ TBlobStorageGroupType groupType = TBlobStorageGroupType::ErasureMirror3dc;
140163 std::vector<TNodeLocation> locations;
141164 TLocationGenerator locationGenerator = [](ui32 dc, ui32 rack, ui32 unit) {
142165 NActorsInterconnect::TNodeLocation proto;
@@ -152,9 +175,8 @@ Y_UNIT_TEST_SUITE(GroupLayoutSanitizer) {
152175 };
153176 MakeLocations (locations, 4 , 5 , 1 , locationGenerator);
154177 std::unique_ptr<TEnvironmentSetup> env;
155- CreateEnv (env, locations);
178+ CreateEnv (env, locations, groupType );
156179
157- TBlobStorageGroupType groupType = TBlobStorageGroupType::ErasureMirror3dc;
158180 TGroupGeometryInfo geom = CreateGroupGeometry (groupType);
159181
160182 env->Runtime ->FilterFunction = CatchSanitizeRequests;
0 commit comments