Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue-1350: hard links for external modes should return correct node #1600

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class TLinkActor final: public TActorBootstrapped<TLinkActor>

// Response data
bool FollowerResponded = false;
NProto::TCreateNodeResponse FollowerResponse;

// Stats for reporting
IProfileLogPtr ProfileLog;
Expand Down Expand Up @@ -156,6 +157,7 @@ void TLinkActor::HandleFollowerResponse(
CreateNodeRequest.MutableLink()->SetTargetNode(
msg->Record.GetNode().GetId());
CreateNodeRequest.MutableLink()->SetFollowerNodeName(FollowerNodeName);
FollowerResponse = std::move(msg->Record);
qkrorlqr marked this conversation as resolved.
Show resolved Hide resolved

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

Expand Down Expand Up @@ -200,6 +202,10 @@ void TLinkActor::HandleLeaderResponse(
LogTag.c_str(),
msg->Record.GetNode().GetId());

// TODO(#1350): some attributes from the follower response could be invalid
// by the time the leader response is received
msg->Record.MutableNode()->Swap(FollowerResponse.MutableNode());

ReplyAndDie(ctx, std::move(msg->Record));
}

Expand Down
8 changes: 8 additions & 0 deletions cloud/filestore/libs/storage/service/service_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3883,6 +3883,14 @@ Y_UNIT_TEST_SUITE(TStorageServiceTest)
SUCCEEDED(linkNodeResponse->GetStatus()),
linkNodeResponse->GetErrorReason().c_str());

// attributes of the linked node should be updated
UNIT_ASSERT_VALUES_EQUAL(
2,
linkNodeResponse->Record.GetNode().GetLinks());
UNIT_ASSERT_VALUES_UNEQUAL(
0,
linkNodeResponse->Record.GetNode().GetCTime());

// validate that the links field is incremented
auto links = service.GetNodeAttr(headers, fsId, RootNodeId, "file1")
->Record.GetNode().GetLinks();
Expand Down
Loading