Skip to content

Commit

Permalink
issue-2674: add multishard2 test, fix hardlinks behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
debnatkh committed Feb 11, 2025
1 parent 6b302ee commit 3682922
Show file tree
Hide file tree
Showing 33 changed files with 2,206 additions and 31 deletions.
8 changes: 0 additions & 8 deletions cloud/filestore/libs/service/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,6 @@ NProto::TError ErrorNameTooLong(const TString& name)
<< "name too long " << MessageSafeStr(name));
}

NProto::TError ErrorSymlinkTooLong(const TString& link)
{
return MakeError(
MAKE_FILESTORE_ERROR(NProto::E_FS_NAMETOOLONG),
TStringBuilder()
<< "link too long " << MessageSafeStr(link));
}

NProto::TError ErrorMaxLink(ui64 nodeId)
{
return MakeError(
Expand Down
1 change: 0 additions & 1 deletion cloud/filestore/libs/service/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ NProto::TError ErrorIsNotEmpty(ui64 nodeId);
//

NProto::TError ErrorNameTooLong(const TString& name);
NProto::TError ErrorSymlinkTooLong(const TString& link);
NProto::TError ErrorMaxLink(ui64 nodeId);
NProto::TError ErrorFileTooBig();
NProto::TError ErrorNoSpaceLeft();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,24 +151,24 @@ void TLinkActor::HandleShardResponse(
msg->Record.GetNode().DebugString().Quote().c_str());

auto request = std::make_unique<TEvService::TEvCreateNodeRequest>();
// By setting the shard filesystem id, we let the leader know that he
// By setting the shard filesystem id, we let the filesystem know that we
// should not verify the target node existence and just create a nodeRef
CreateNodeRequest.SetShardFileSystemId(ShardId);
CreateNodeRequest.MutableLink()->SetTargetNode(
msg->Record.GetNode().GetId());
CreateNodeRequest.MutableLink()->SetShardNodeName(ShardNodeName);
ShardResponse = std::move(msg->Record);

request->Record = std::move(CreateNodeRequest);

LOG_DEBUG(
ctx,
TFileStoreComponents::SERVICE,
"[%s] Creating nodeRef in leader for %lu, %s",
"[%s] Creating nodeRef in leader for %s, %lu",
LogTag.c_str(),
ShardResponse.GetNode().GetId(),
ShardResponse.ShortDebugString().Quote().c_str(),
CreateNodeRequest.GetLink().GetTargetNode());

request->Record = std::move(CreateNodeRequest);

ctx.Send(MakeIndexTabletProxyServiceId(), request.release());

// TODO(#2667): add proper mechanism for handling dangling links for the
Expand Down Expand Up @@ -293,7 +293,8 @@ void TStorageServiceActor::HandleCreateNode(

auto& headers = *msg->Record.MutableHeaders();
headers.SetBehaveAsDirectoryTablet(
StorageConfig->GetDirectoryCreationInShardsEnabled());
StorageConfig->GetDirectoryCreationInShardsEnabled() &&
!msg->Record.HasLink());
if (auto shardNo = ExtractShardNo(msg->Record.GetNodeId())) {
// parent directory is managed by a shard
auto [shardId, error] = SelectShard(
Expand Down
29 changes: 29 additions & 0 deletions cloud/filestore/libs/storage/service/service_ut_sharding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4557,6 +4557,35 @@ Y_UNIT_TEST_SUITE(TStorageServiceShardingTest)
service.DestroyHandle(headers, fsConfig.FsId, nodeId3, handle3);
}

SERVICE_TEST_SID_SELECT_IN_LEADER_ONLY(ShouldCreateHardLinks)
{
config.SetMultiTabletForwardingEnabled(true);
config.SetDirectoryCreationInShardsEnabled(true);
TTestEnv env({}, config);
env.CreateSubDomain("nfs");

ui32 nodeIdx = env.CreateNode("nfs");

TServiceClient service(env.GetRuntime(), nodeIdx);
TFileSystemConfig fsConfig;
fsConfig.DirectoryCreationInShardsEnabled = true;
CreateFileSystem(service, fsConfig);

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

const auto dirId = service.CreateNode(
headers,
TCreateNodeArgs::Directory(RootNodeId, "dir"))->Record.GetNode().GetId();

const auto file1Id = service.CreateNode(
headers,
TCreateNodeArgs::File(dirId, "file1"))->Record.GetNode().GetId();

service.CreateNode(
headers,
TCreateNodeArgs::Link(dirId, "link1", file1Id));
}

SERVICE_TEST_SID_SELECT_IN_LEADER_ONLY(
ShouldListNodesAndGetNodeAttrInDirectoryInShard)
{
Expand Down
15 changes: 8 additions & 7 deletions cloud/filestore/libs/storage/tablet/tablet_actor_createnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,16 @@ void TIndexTabletActor::HandleCreateNode(
{
auto* msg = ev->Get();

auto* session = AcceptRequest<TEvService::TCreateNodeMethod>(
ev,
ctx,
ValidateRequest);
if (!session) {
return;
}

// DupCache isn't needed for Create/UnlinkNode requests in shards
if (!BehaveAsShard(msg->Record.GetHeaders())) {
auto* session = AcceptRequest<TEvService::TCreateNodeMethod>(
ev,
ctx,
ValidateRequest);
if (!session) {
return;
}

const auto requestId = GetRequestId(msg->Record);
if (const auto* e = session->LookupDupEntry(requestId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ void TIndexTabletActor::ExecuteTx_PrepareRenameNodeInSource(
shardRequest->SetFlags(args.Request.GetFlags());
shardRequest->SetSourceNodeShardId(args.ChildRef->ShardId);
shardRequest->SetSourceNodeShardNodeName(args.ChildRef->ShardNodeName);
shardRequest->SetSourceNodeShardNodeName(args.ChildRef->ShardNodeName);
*shardRequest->MutableOriginalRequest() = args.Request;

db.WriteOpLogEntry(args.OpLogEntry);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Client-side read/writes
TwoStageReadEnabled: true
ThreeStageWriteEnabled: true
UnalignedThreeStageWriteEnabled: true
# Caches
ReadAheadCacheRangeSize: 1048576
# Sharding
MultiTabletForwardingEnabled: true
GetNodeAttrBatchEnabled: true
DirectoryCreationInShardsEnabled: true

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
TwoStageReadEnabled: true
NewCompactionEnabled: true
NewCleanupEnabled: true
ThreeStageWriteEnabled: true
ReadAheadCacheRangeSize: 1048576
NodeIndexCacheMaxNodes: 128
PreferredBlockSizeMultiplier: 64
MultiTabletForwardingEnabled: true
GetNodeAttrBatchEnabled: true
UnalignedThreeStageWriteEnabled: true
InMemoryIndexCacheEnabled: true
InMemoryIndexCacheNodesCapacity: 10
InMemoryIndexCacheNodeRefsCapacity: 10
InMemoryIndexCacheNodeAttrsCapacity: 10
InMemoryIndexCacheLoadOnTabletStart: true
InMemoryIndexCacheLoadOnTabletStartRowsPerTx: 1
UseMixedBlocksInsteadOfAliveBlocksInCompaction: true
MixedBlocksOffloadedRangesCapacity: 1024
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TEST_SRCS(

SET(
NFS_STORAGE_CONFIG_PATCH
cloud/filestore/tests/loadtest/service-kikimr-newfeatures-test/nfs-storage.txt
cloud/filestore/tests/common_configs/nfs-storage-newfeatures-patch.txt
)

SET(QEMU_VIRTIO fs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SET(VHOST_RESTART_FLAG 1)
SET(FILESTORE_SHARD_COUNT 5)
SET(
NFS_STORAGE_CONFIG_PATCH
cloud/filestore/tests/loadtest/service-kikimr-newfeatures-test/nfs-storage.txt
cloud/filestore/tests/common_configs/nfs-storage-newfeatures-patch.txt
)
SET(NFS_FORCE_VERBOSE 1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SET(QEMU_VIRTIO fs)
SET(FILESTORE_SHARD_COUNT 5)
SET(
NFS_STORAGE_CONFIG_PATCH
cloud/filestore/tests/loadtest/service-kikimr-newfeatures-test/nfs-storage.txt
cloud/filestore/tests/common_configs/nfs-storage-newfeatures-patch.txt
)

INCLUDE(${ARCADIA_ROOT}/cloud/filestore/tests/recipes/service-kikimr.inc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SET(QEMU_VIRTIO fs)
SET(FILESTORE_SHARD_COUNT 5)
SET(
NFS_STORAGE_CONFIG_PATCH
cloud/filestore/tests/loadtest/service-kikimr-newfeatures-test/nfs-storage.txt
cloud/filestore/tests/common_configs/nfs-storage-newfeatures-patch.txt
)

INCLUDE(${ARCADIA_ROOT}/cloud/filestore/tests/recipes/service-kikimr.inc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ INCLUDE(${ARCADIA_ROOT}/cloud/filestore/tools/testing/fs_posix_compliance/fs_pos
SET(FILESTORE_SHARD_COUNT 2)
SET(
NFS_STORAGE_CONFIG_PATCH
cloud/filestore/tests/loadtest/service-kikimr-newfeatures-test/nfs-storage.txt
cloud/filestore/tests/common_configs/nfs-storage-newfeatures-patch.txt
)

INCLUDE(${ARCADIA_ROOT}/cloud/filestore/tests/recipes/service-kikimr.inc)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"test.test_posix_compliance[chflags]": {
"uri": "file://test.test_posix_compliance_chflags_/results-chflags.txt"
},
"test.test_posix_compliance[chmod]": {
"uri": "file://test.test_posix_compliance_chmod_/results-chmod.txt"
},
"test.test_posix_compliance[chown]": {
"uri": "file://test.test_posix_compliance_chown_/results-chown.txt"
},
"test.test_posix_compliance[flock]": {
"uri": "file://test.test_posix_compliance_flock_/results-flock.txt"
},
"test.test_posix_compliance[link]": {
"uri": "file://test.test_posix_compliance_link_/results-link.txt"
},
"test.test_posix_compliance[mkdir]": {
"uri": "file://test.test_posix_compliance_mkdir_/results-mkdir.txt"
},
"test.test_posix_compliance[open]": {
"uri": "file://test.test_posix_compliance_open_/results-open.txt"
},
"test.test_posix_compliance[rename]": {
"uri": "file://test.test_posix_compliance_rename_/results-rename.txt"
},
"test.test_posix_compliance[rmdir]": {
"uri": "file://test.test_posix_compliance_rmdir_/results-rmdir.txt"
},
"test.test_posix_compliance[symlink]": {
"uri": "file://test.test_posix_compliance_symlink_/results-symlink.txt"
},
"test.test_posix_compliance[truncate]": {
"uri": "file://test.test_posix_compliance_truncate_/results-truncate.txt"
},
"test.test_posix_compliance[unlink]": {
"uri": "file://test.test_posix_compliance_unlink_/results-unlink.txt"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
TEST SUITE[chflags, 00.t] 1..1
ok 1
TEST SUITE[chflags, 01.t] 1..1
ok 1
TEST SUITE[chflags, 02.t] 1..1
ok 1
TEST SUITE[chflags, 03.t] 1..1
ok 1
TEST SUITE[chflags, 04.t] 1..1
ok 1
TEST SUITE[chflags, 05.t] 1..1
ok 1
TEST SUITE[chflags, 06.t] 1..1
ok 1
TEST SUITE[chflags, 07.t] 1..1
ok 1
TEST SUITE[chflags, 08.t] 1..1
ok 1
TEST SUITE[chflags, 09.t] 1..1
ok 1
TEST SUITE[chflags, 10.t] 1..1
ok 1
TEST SUITE[chflags, 11.t] 1..1
ok 1
TEST SUITE[chflags, 12.t] 1..1
ok 1
TEST SUITE[chflags, 13.t] 1..1
ok 1
Loading

0 comments on commit 3682922

Please sign in to comment.