Skip to content

Commit

Permalink
issue-1384: destruction of an already destroyed fs should return S_FA…
Browse files Browse the repository at this point in the history
…LSE (#1659)

Problem:
DestroyFileStore for an already destroyed fs returns NKikimrScheme::EStatus::StatusPathDoesNotExist instead of S_FALSE

Bug was introduced in #1441 because DestroyFileStore actor and DescribeSessions actor are handling missing fs in different ways.
  • Loading branch information
antonmyagkov committed Jul 30, 2024
1 parent b0a8b3a commit 1af6e2b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cloud/filestore/libs/storage/service/service_actor_destroyfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ void TDestroyFileStoreActor::HandleDescribeSessionsResponse(
{
const auto* msg = ev->Get();
if (HasError(msg->GetError())) {
if (msg->GetStatus() ==
MAKE_SCHEMESHARD_ERROR(
NKikimrScheme::EStatus::StatusPathDoesNotExist))
{
ReplyAndDie(
ctx,
MakeError(S_FALSE, FileSystemId.Quote() + " does not exist"));
return;
}

ReplyAndDie(ctx, msg->GetError());
return;
}
Expand Down
45 changes: 45 additions & 0 deletions cloud/filestore/libs/storage/service/service_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3448,6 +3448,51 @@ Y_UNIT_TEST_SUITE(TStorageServiceTest)
destroyFileStoreResponse->GetErrorReason());
}

Y_UNIT_TEST(DestroyDestroyedFileStoreShouldFail)
{
TTestEnv env;
env.CreateSubDomain("nfs");

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

const TString fsId = "test";
const TString fsId2 = "test2";
const auto initialBlockCount = 1'000;
TServiceClient service(env.GetRuntime(), nodeIdx);
service.CreateFileStore(fsId, initialBlockCount);
service.CreateFileStore(fsId2, initialBlockCount);

{
auto destroyFileStoreResponse = service.DestroyFileStore(fsId);
UNIT_ASSERT_VALUES_EQUAL_C(
S_OK,
destroyFileStoreResponse->GetStatus(),
destroyFileStoreResponse->GetErrorReason());

auto alreadyDestroyedFileStoreResponse =
service.DestroyFileStore(fsId);
UNIT_ASSERT_VALUES_EQUAL_C(
S_FALSE,
alreadyDestroyedFileStoreResponse->GetStatus(),
alreadyDestroyedFileStoreResponse->GetErrorReason());
}

{
auto destroyFileStoreResponse = service.DestroyFileStore(fsId2);
UNIT_ASSERT_VALUES_EQUAL_C(
S_OK,
destroyFileStoreResponse->GetStatus(),
destroyFileStoreResponse->GetErrorReason());

auto alreadyDestroyedFileStoreResponse =
service.DestroyFileStore(fsId);
UNIT_ASSERT_VALUES_EQUAL_C(
S_FALSE,
alreadyDestroyedFileStoreResponse->GetStatus(),
alreadyDestroyedFileStoreResponse->GetErrorReason());
}
}

Y_UNIT_TEST(ShouldValidateRequestsWithFollowerId)
{
TTestEnv env;
Expand Down

0 comments on commit 1af6e2b

Please sign in to comment.