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

Fix missing filesystem id on profile log write #2953

Merged
merged 15 commits into from
Feb 6, 2025
2 changes: 1 addition & 1 deletion cloud/filestore/apps/client/lib/create_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TCreateSessionCommand final
request->MutableHeaders()->SetClientId(ClientId);
request->MutableHeaders()->SetSessionSeqNo(SeqNo);

TCallContextPtr ctx = MakeIntrusive<TCallContext>();
TCallContextPtr ctx = MakeIntrusive<TCallContext>(FileSystemId);
auto response = WaitFor(Client->CreateSession(ctx, std::move(request)));
CheckResponse(response);
Print(response, JsonOutput);
Expand Down
2 changes: 1 addition & 1 deletion cloud/filestore/apps/client/lib/destroy_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TDestroySessionCommand final
request->MutableHeaders()->SetClientId(ClientId);
request->MutableHeaders()->SetSessionSeqNo(SeqNo);

TCallContextPtr ctx = MakeIntrusive<TCallContext>();
TCallContextPtr ctx = MakeIntrusive<TCallContext>(FileSystemId);
auto response = WaitFor(Client->DestroySession(ctx, std::move(request)));
CheckResponse(response);
Print(response, JsonOutput);
Expand Down
2 changes: 1 addition & 1 deletion cloud/filestore/apps/client/lib/forced_compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TForcedCompactionCommand final
STORAGE_DEBUG("Sending ExecuteAction request");
const auto requestId = GetRequestId(*request);
auto result = WaitFor(Client->ExecuteAction(
MakeIntrusive<TCallContext>(requestId),
MakeIntrusive<TCallContext>(FileSystemId, requestId),
std::move(request)));

STORAGE_DEBUG("Received ExecuteAction response");
Expand Down
45 changes: 23 additions & 22 deletions cloud/filestore/libs/service_local/fs_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ NProto::TCreateSessionResponse TLocalFileSystem::CreateSession(
TWriteGuard guard(SessionsLock);

auto session = FindSession(clientId, sessionId, sessionSeqNo);

const auto makeResponse = [&sessionSeqNo, this](const TSessionPtr& session)
{
NProto::TCreateSessionResponse response;
session->GetInfo(*response.MutableSession(), sessionSeqNo);

*response.MutableFileStore() = Store;

auto* features = response.MutableFileStore()->MutableFeatures();
features->SetDirectIoEnabled(Config->GetDirectIoEnabled());
features->SetDirectIoAlign(Config->GetDirectIoAlign());
features->SetGuestWritebackCacheEnabled(
Config->GetGuestWritebackCacheEnabled());
features->SetAsyncDestroyHandleEnabled(
Config->GetAsyncDestroyHandleEnabled());
features->SetAsyncHandleOperationPeriod(
Config->GetAsyncHandleOperationPeriod().MilliSeconds());
return response;
};

if (session) {
if (session->ClientId != clientId) {
return TErrorResponse(E_FS_INVALID_SESSION, TStringBuilder()
Expand All @@ -27,9 +47,7 @@ NProto::TCreateSessionResponse TLocalFileSystem::CreateSession(

session->AddSubSession(sessionSeqNo, readOnly);

NProto::TCreateSessionResponse response;
session->GetInfo(*response.MutableSession(), sessionSeqNo);
return response;
return makeResponse(session);
}

if (sessionId) {
Expand All @@ -41,9 +59,7 @@ NProto::TCreateSessionResponse TLocalFileSystem::CreateSession(
if (it != SessionsByClient.end()) {
(*it->second)->AddSubSession(sessionSeqNo, readOnly);

NProto::TCreateSessionResponse response;
(*it->second)->GetInfo(*response.MutableSession(), sessionSeqNo);
return response;
return makeResponse(*it->second);
}

auto clientSessionStatePath = StatePath / ("client_" + clientId);
Expand Down Expand Up @@ -71,22 +87,7 @@ NProto::TCreateSessionResponse TLocalFileSystem::CreateSession(
SessionsById.emplace(session->SessionId, SessionsList.begin());
Y_ABORT_UNLESS(inserted2);

NProto::TCreateSessionResponse response;
session->GetInfo(*response.MutableSession(), sessionSeqNo);

*response.MutableFileStore() = Store;

auto* features = response.MutableFileStore()->MutableFeatures();
features->SetDirectIoEnabled(Config->GetDirectIoEnabled());
features->SetDirectIoAlign(Config->GetDirectIoAlign());
features->SetGuestWritebackCacheEnabled(
Config->GetGuestWritebackCacheEnabled());
features->SetAsyncDestroyHandleEnabled(
Config->GetAsyncDestroyHandleEnabled());
features->SetAsyncHandleOperationPeriod(
Config->GetAsyncHandleOperationPeriod().MilliSeconds());

return response;
return makeResponse(session);
}

NProto::TPingSessionResponse TLocalFileSystem::PingSession(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ class TDataRequestGenerator final
TIntrusivePtr<TCallContext> CreateCallContext()
{
return MakeIntrusive<TCallContext>(
FileSystemId,
LastRequestId.fetch_add(1, std::memory_order_relaxed));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ class TIndexRequestGenerator final

TIntrusivePtr<TCallContext> CreateCallContext()
{
return MakeIntrusive<TCallContext>(AtomicIncrement(LastRequestId));
return MakeIntrusive<TCallContext>(FileSystemId, AtomicIncrement(LastRequestId));
}
};

Expand Down
Loading