Skip to content

Commit

Permalink
issue-2710: logging operations with SessionByOwner mapping (#2711)
Browse files Browse the repository at this point in the history
  • Loading branch information
qkrorlqr authored Dec 17, 2024
1 parent 68aa32b commit e088770
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 7 deletions.
13 changes: 9 additions & 4 deletions cloud/filestore/libs/storage/tablet/tablet_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,10 @@ void TIndexTabletActor::HandlePoisonPill(
const TEvents::TEvPoisonPill::TPtr& ev,
const TActorContext& ctx)
{
Y_UNUSED(ev);

LOG_INFO_S(ctx, TFileStoreComponents::TABLET,
LogTag << " Stop tablet because of PoisonPill request");
LOG_INFO(ctx, TFileStoreComponents::TABLET,
"%s Stop tablet because of PoisonPill request, ev->Sender: %s",
LogTag.c_str(),
ev->Sender.ToString().c_str());

Suicide(ctx);
}
Expand All @@ -612,6 +612,11 @@ void TIndexTabletActor::HandleSessionDisconnected(
const TEvTabletPipe::TEvServerDisconnected::TPtr& ev,
const TActorContext& ctx)
{
LOG_INFO(ctx, TFileStoreComponents::TABLET,
"%s Server disconnected, ev->Sender: %s",
LogTag.c_str(),
ev->Sender.ToString().c_str());

OrphanSession(ev->Sender, ctx.Now());
}

Expand Down
35 changes: 32 additions & 3 deletions cloud/filestore/libs/storage/tablet/tablet_state_sessions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ TSession* TIndexTabletState::CreateSession(
Impl->SessionByOwner.emplace(owner, session.get());
Impl->SessionByClient.emplace(session->GetClientId(), session.get());

LOG_INFO(*TlsActivationContext, TFileStoreComponents::TABLET,
"%s created session c: %s, s: %s, owner: %s",
LogTag.c_str(),
session->GetClientId().c_str(),
session->GetSessionId().c_str(),
owner.ToString().c_str());

return session.release();
}

Expand All @@ -203,6 +210,13 @@ NActors::TActorId TIndexTabletState::RecoverSession(
session->UpdateSubSession(sessionSeqNo, readOnly, owner);
if (oldOwner) {
Impl->SessionByOwner.erase(oldOwner);

LOG_INFO(*TlsActivationContext, TFileStoreComponents::TABLET,
"%s removed old owner for session c: %s, s: %s, owner: %s",
LogTag.c_str(),
session->GetClientId().c_str(),
session->GetSessionId().c_str(),
oldOwner.ToString().c_str());
}

if (oldOwner != owner) {
Expand All @@ -212,6 +226,13 @@ NActors::TActorId TIndexTabletState::RecoverSession(
Impl->Sessions.PushBack(session);

Impl->SessionByOwner.emplace(owner, session);

LOG_INFO(*TlsActivationContext, TFileStoreComponents::TABLET,
"%s added new owner for session c: %s, s: %s, owner: %s",
LogTag.c_str(),
session->GetClientId().c_str(),
session->GetSessionId().c_str(),
owner.ToString().c_str());
}

session->SetRecoveryTimestampUs(Now().MicroSeconds());
Expand Down Expand Up @@ -244,7 +265,7 @@ TSession* TIndexTabletState::FindSession(
const TString& sessionId,
ui64 seqNo) const
{
auto session = FindSession(sessionId);
auto* session = FindSession(sessionId);
if (session &&
session->IsValid() &&
session->GetClientId() == clientId &&
Expand All @@ -266,10 +287,11 @@ void TIndexTabletState::OrphanSession(const TActorId& owner, TInstant deadline)
auto* session = it->second;

LOG_INFO(*TlsActivationContext, TFileStoreComponents::TABLET,
"%s orphaning session c: %s, s: %s",
"%s orphaning session c: %s, s: %s, owner: %s",
LogTag.c_str(),
session->GetClientId().c_str(),
session->GetSessionId().c_str());
session->GetSessionId().c_str(),
owner.ToString().c_str());

if (!session->DeleteSubSession(owner)) {
session->Deadline = deadline;
Expand All @@ -278,6 +300,13 @@ void TIndexTabletState::OrphanSession(const TActorId& owner, TInstant deadline)
Impl->OrphanSessions.PushBack(session);

Impl->SessionByOwner.erase(it);

LOG_INFO(*TlsActivationContext, TFileStoreComponents::TABLET,
"%s removed last owner for session c: %s, s: %s, owner: %s",
LogTag.c_str(),
session->GetClientId().c_str(),
session->GetSessionId().c_str(),
owner.ToString().c_str());
}
}

Expand Down

0 comments on commit e088770

Please sign in to comment.