Skip to content

Commit

Permalink
add missing DestroyHandle request completion (#2133)
Browse files Browse the repository at this point in the history
* add missing DestroyHandle request completion

* add test
  • Loading branch information
WilyTiger committed Sep 26, 2024
1 parent 3164c38 commit 04cca17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cloud/filestore/libs/vfs_fuse/fs_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,12 @@ void TFileSystem::ProcessHandleOpsQueue()
RequestStats->RequestStarted(Log, *callContext);

Session->DestroyHandle(callContext, std::move(request))
.Subscribe([this, ptr = weak_from_this()] (const auto& future) {
.Subscribe([=, ptr = weak_from_this()] (const auto& future) {
const auto& response = future.GetValue();
const auto& error = response.GetError();
if (auto self = ptr.lock()) {
RequestStats->RequestCompleted(*callContext, error);

// If destroy request failed, we need to retry it.
// Otherwise, remove it from queue.
if (HasError(error)) {
Expand Down
7 changes: 7 additions & 0 deletions cloud/filestore/libs/vfs_fuse/fs_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1439,9 +1439,15 @@ Y_UNIT_TEST_SUITE(TFileSystemTest)
std::atomic_bool releaseFinished = false;
std::atomic_uint handlerCalled = 0;
auto destroyFinished = NewPromise<void>();
auto counters = bootstrap.Counters->FindSubgroup("component", "fs_ut")
->FindSubgroup("request", "DestroyHandle");
bootstrap.Service->SetHandlerDestroyHandle(
[&, destroyFinished](auto callContext, auto request) mutable
{
UNIT_ASSERT_VALUES_EQUAL(
1,
counters->GetCounter("InProgress")->GetAtomic());

UNIT_ASSERT_VALUES_EQUAL(
FileSystemId,
callContext->FileSystemId);
Expand Down Expand Up @@ -1475,6 +1481,7 @@ Y_UNIT_TEST_SUITE(TFileSystemTest)

destroyFinished.GetFuture().Wait(WaitTimeout);
UNIT_ASSERT_VALUES_EQUAL(2U, handlerCalled.load());
UNIT_ASSERT_VALUES_EQUAL(0, counters->GetCounter("InProgress")->GetAtomic());
}

Y_UNIT_TEST(ShouldRetryDestroyIfNotSuccessDuringAsyncProcessing)
Expand Down

0 comments on commit 04cca17

Please sign in to comment.