Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions cloud/filestore/config/filesystem.proto
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,7 @@ message TFileSystemConfig

// Async processing of destroy handle requests only for read only handles.
optional bool AsyncDestroyReadOnlyHandleEnabled = 36;

// Async processing of read-only create handle requests.
optional bool AsyncCreateHandleEnabled = 37;
}
3 changes: 3 additions & 0 deletions cloud/filestore/config/storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -851,4 +851,7 @@ message TStorageConfig

// Enables injecting of errors in TIndexTabletDatabase. Must be only used in tests!
optional double FakeTxPageFaultsProbability = 527;

// Async processing of read-only create handle requests.
optional bool AsyncCreateHandleEnabled = 528;
}
12 changes: 12 additions & 0 deletions cloud/filestore/libs/diagnostics/profile_log_events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,17 @@ void InitProfileLogRequestInfo(
nodeInfo->SetHandle(request.GetHandle());
}

template <>
void InitProfileLogRequestInfo(
NProto::TProfileLogRequestInfo& profileLogRequest,
const NProto::TConfirmCreateHandleRequest& request)
{
auto* nodeInfo = profileLogRequest.MutableNodeInfo();
nodeInfo->SetNodeId(request.GetNodeId());
nodeInfo->SetHandle(request.GetHandle());
nodeInfo->SetFlags(request.GetFlags());
}

template <>
void InitProfileLogRequestInfo(
NProto::TProfileLogRequestInfo& profileLogRequest,
Expand Down Expand Up @@ -666,6 +677,7 @@ void UpdateRangeNodeIds(
IMPLEMENT_DEFAULT_METHOD(AccessNode, NProto)
IMPLEMENT_DEFAULT_METHOD(ReadLink, NProto)
IMPLEMENT_DEFAULT_METHOD(RemoveNodeXAttr, NProto)
IMPLEMENT_DEFAULT_METHOD(ConfirmCreateHandle, NProto)
IMPLEMENT_DEFAULT_METHOD(DestroyHandle, NProto)
IMPLEMENT_DEFAULT_METHOD(AcquireLock, NProto)
IMPLEMENT_DEFAULT_METHOD(ReleaseLock, NProto)
Expand Down
30 changes: 30 additions & 0 deletions cloud/filestore/libs/diagnostics/profile_log_events_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,36 @@ Y_UNIT_TEST_SUITE(TProfileLogEventsTest)
UNIT_ASSERT(!nodeInfo.HasSize());
}

Y_UNIT_TEST(ShouldConfirmCreateHandleRequestInitializeFieldsCorrectly)
{
const auto nodeId = 12;
const auto handle = 34;
const auto flags = 56;

NProto::TConfirmCreateHandleRequest req;
req.SetNodeId(nodeId);
req.SetHandle(handle);
req.SetFlags(flags);

NProto::TProfileLogRequestInfo profileLogRequest;
InitProfileLogRequestInfo(profileLogRequest, req);

UNIT_ASSERT_VALUES_EQUAL(0, profileLogRequest.RangesSize());
UNIT_ASSERT(profileLogRequest.HasNodeInfo());
UNIT_ASSERT(!profileLogRequest.HasLockInfo());

const auto& nodeInfo = profileLogRequest.GetNodeInfo();
UNIT_ASSERT(!nodeInfo.HasParentNodeId());
UNIT_ASSERT(!nodeInfo.HasNodeName());
UNIT_ASSERT(!nodeInfo.HasNewParentNodeId());
UNIT_ASSERT(!nodeInfo.HasNewNodeName());
UNIT_ASSERT_VALUES_EQUAL(flags, nodeInfo.GetFlags());
UNIT_ASSERT(!nodeInfo.HasMode());
UNIT_ASSERT_VALUES_EQUAL(nodeId, nodeInfo.GetNodeId());
UNIT_ASSERT_VALUES_EQUAL(handle, nodeInfo.GetHandle());
UNIT_ASSERT(!nodeInfo.HasSize());
}

Y_UNIT_TEST(ShouldReadDataRequestInitializeFieldsCorrectly)
{
const auto nodeId = 12;
Expand Down
1 change: 1 addition & 0 deletions cloud/filestore/libs/service/auth_scheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ TPermissionList GetRequestPermissions(EFileStoreRequest requestType)
case EFileStoreRequest::SetNodeXAttr:
case EFileStoreRequest::RemoveNodeXAttr:
case EFileStoreRequest::CreateHandle:
case EFileStoreRequest::ConfirmCreateHandle:
case EFileStoreRequest::DestroyHandle:
case EFileStoreRequest::WriteData:
case EFileStoreRequest::AllocateData:
Expand Down
1 change: 1 addition & 0 deletions cloud/filestore/libs/service/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ namespace NCloud::NFileStore {
xxx(ReadData, __VA_ARGS__) \
xxx(WriteData, __VA_ARGS__) \
xxx(AllocateData, __VA_ARGS__) \
xxx(ConfirmCreateHandle, __VA_ARGS__) \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve existing request type numbers

This macro feeds the numeric EFileStoreRequest enum that is written to profile/event logs, so inserting ConfirmCreateHandle here shifts Fsync, FsyncDir, endpoint, and private request ids (the updated dump test now expects Fsync to move from 46 to 47). Existing logs and any consumers that decode stored request type numbers will be mislabelled after this change; add the new request without renumbering the existing values.

Useful? React with 👍 / 👎.

// FILESTORE_DATA_METHODS

#define FILESTORE_LOCAL_DATA_METHODS(xxx, ...) \
Expand Down
1 change: 1 addition & 0 deletions cloud/filestore/libs/service_local/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace NCloud::NFileStore {
xxx(RemoveNodeXAttr, __VA_ARGS__) \
\
xxx(CreateHandle, __VA_ARGS__) \
xxx(ConfirmCreateHandle, __VA_ARGS__) \
xxx(DestroyHandle, __VA_ARGS__) \
\
xxx(AcquireLock, __VA_ARGS__) \
Expand Down
8 changes: 8 additions & 0 deletions cloud/filestore/libs/service_local/fs_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ NProto::TCreateHandleResponse TLocalFileSystem::CreateHandle(
return response;
}

NProto::TConfirmCreateHandleResponse TLocalFileSystem::ConfirmCreateHandle(
const NProto::TConfirmCreateHandleRequest& request)
{
Y_UNUSED(request);

return {};
}

NProto::TDestroyHandleResponse TLocalFileSystem::DestroyHandle(
const NProto::TDestroyHandleRequest& request)
{
Expand Down
10 changes: 10 additions & 0 deletions cloud/filestore/libs/service_null/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ struct TNullFileStore final
return MakeFuture(response);
}

TFuture<NProto::TConfirmCreateHandleResponse> ConfirmCreateHandle(
TCallContextPtr callContext,
std::shared_ptr<NProto::TConfirmCreateHandleRequest> request) override
{
Y_UNUSED(callContext);
Y_UNUSED(request);

return MakeFuture(NProto::TConfirmCreateHandleResponse{});
}

TFuture<NProto::TReadDataResponse> ReadData(
TCallContextPtr callContext,
std::shared_ptr<NProto::TReadDataRequest> request) override
Expand Down
5 changes: 3 additions & 2 deletions cloud/filestore/libs/storage/api/service.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace NCloud::NFileStore::NStorage {
// FILESTORE_SERVICE_REQUESTS_FWD_TO_SHARD_BY_NODE_ID

#define FILESTORE_SERVICE_REQUESTS_FWD_TO_SHARD_BY_HANDLE(xxx, ...) \
xxx(ConfirmCreateHandle, __VA_ARGS__) \
xxx(DestroyHandle, __VA_ARGS__) \
xxx(AllocateData, __VA_ARGS__) \
\
Expand Down Expand Up @@ -258,8 +259,8 @@ struct TEvService
EvRegisterLocalFileStore = EvBegin + 71,
EvUnregisterLocalFileStore,

// EvGetSessionAttrRequest
EvUnused2 = EvBegin + 73,
EvConfirmCreateHandleRequest = EvBegin + 73,
EvConfirmCreateHandleResponse,

EvAddClusterNodeRequest = EvBegin + 75,
EvAddClusterNodeResponse,
Expand Down
1 change: 1 addition & 0 deletions cloud/filestore/libs/storage/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ using TAliases = NProto::TStorageConfig::TFilestoreAliases;
\
xxx(AsyncDestroyHandleEnabled, bool, false )\
xxx(AsyncDestroyReadOnlyHandleEnabled, bool, false )\
xxx(AsyncCreateHandleEnabled, bool, false )\
xxx(TabletUnsafeAsyncReadOnlyCreateHandleEnabled, bool, false )\
xxx(TabletUnsafeAsyncDestroyHandleEnabled, bool, false )\
xxx(AsyncHandleOperationPeriod, TDuration, TDuration::MilliSeconds(50))\
Expand Down
1 change: 1 addition & 0 deletions cloud/filestore/libs/storage/core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class TStorageConfig

bool GetAsyncDestroyHandleEnabled() const;
bool GetAsyncDestroyReadOnlyHandleEnabled() const;
bool GetAsyncCreateHandleEnabled() const;
bool GetTabletUnsafeAsyncReadOnlyCreateHandleEnabled() const;
bool GetTabletUnsafeAsyncDestroyHandleEnabled() const;
TDuration GetAsyncHandleOperationPeriod() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ void TStorageServiceActor::ForwardRequestToShard(
FILESTORE_FORWARD_REQUEST_TO_SHARD_BY_HANDLE,
TEvService)

#undef FILESTORE_FORWARD_REQUEST_TO_SHARD_BY_NODE_ID
#undef FILESTORE_FORWARD_REQUEST_TO_SHARD_BY_HANDLE

#define FILESTORE_DEFINE_HANDLE_FORWARD(name, ns) \
template void TStorageServiceActor::ForwardRequest<ns::T##name##Method>( \
Expand Down
Loading
Loading