Skip to content

Commit

Permalink
issue-2559: initializing BlockSize + added comments to ut (#2736)
Browse files Browse the repository at this point in the history
  • Loading branch information
qkrorlqr authored Dec 19, 2024
1 parent 8819382 commit c67f1bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions cloud/filestore/libs/storage/service/service_ut_sharding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4061,6 +4061,10 @@ Y_UNIT_TEST_SUITE(TStorageServiceShardingTest)

auto headers = service.InitSession(fsId, "client");

// creating 5 files - we should have round-robin balancing at this
// point since all shards have enough free space - more than the
// DesiredFreeSpaceReserve threshold

TVector<ui64> handles;
TVector<ui64> nodes;
TSet<ui32> shards;
Expand All @@ -4080,8 +4084,13 @@ Y_UNIT_TEST_SUITE(TStorageServiceShardingTest)
handles.push_back(handleId);
}

// checking that we indeed created those 5 files in 5 shards

UNIT_ASSERT_VALUES_EQUAL(5, shards.size());

// writing some data to 3 of the 5 files to make 3 of the 5 shards have
// less than DesiredFreeSpaceReserve free space

service.WriteData(
headers,
fsId,
Expand Down Expand Up @@ -4121,6 +4130,10 @@ Y_UNIT_TEST_SUITE(TStorageServiceShardingTest)
nodes.clear();
shards.clear();

// creating 5 new files - these files should be balanced among the
// 2 remaining shards which still have more than DesiredFreeSpaceReserve
// free space

for (ui32 i = 0; i < 5; ++i) {
auto createHandleResponse = service.CreateHandle(
headers,
Expand All @@ -4137,6 +4150,8 @@ Y_UNIT_TEST_SUITE(TStorageServiceShardingTest)
handles.push_back(handleId);
}

// checking that the new 5 files were indeed created in those 2 shards

UNIT_ASSERT_VALUES_EQUAL(2, shards.size());
auto l = emptyShards.begin();
auto r = shards.begin();
Expand Down
2 changes: 1 addition & 1 deletion cloud/filestore/libs/storage/tablet/model/shard_balancer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TShardBalancer
};

private:
ui32 BlockSize;
ui32 BlockSize = 4_KB;
ui64 DesiredFreeSpaceReserve = 0;
ui64 MinFreeSpaceReserve = 0;

Expand Down

0 comments on commit c67f1bf

Please sign in to comment.