Skip to content

Commit 152834e

Browse files
authored
25-1: increase logging around tablet unlocks (#14741) (#15670)
1 parent edb45bf commit 152834e

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

ydb/core/base/hive.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,15 @@ namespace NKikimr {
705705
Record.SetStatus(status);
706706
Record.SetStatusMessage(statusMessage);
707707
}
708+
709+
TString ToString() const override {
710+
TStringStream str;
711+
str << ToStringHeader() << "{Status: " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data();
712+
str << " TabletID: " << Record.GetTabletID();
713+
str << " Message: " << Record.GetStatusMessage();
714+
str << "}";
715+
return str.Str();
716+
}
708717
};
709718

710719
struct TEvLockTabletExecutionLost : public TEventPB<TEvLockTabletExecutionLost,

ydb/core/mind/hive/hive.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ inline void Out<NKikimr::NHive::TCompleteNotifications>(IOutputStream& o, const
384384
if (it != n.Notifications.begin()) {
385385
o << ',';
386386
}
387-
o << Hex(it->first->Type) << " " << it->first.Get()->Recipient;
387+
o << Hex(it->first->Type) << " " << it->first.Get()->Recipient << " " << it->first->ToString();
388388
}
389389
}
390390
}

ydb/core/mind/hive/tx__lock_tablet.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class TTxLockTabletExecution : public TTransactionBase<THive> {
1616

1717
TSideEffects SideEffects;
1818
TActorId PreviousOwner;
19+
bool Success = true;
1920

2021
public:
2122
TTxLockTabletExecution(const NKikimrHive::TEvLockTabletExecution& rec, const TActorId& sender, const ui64 cookie, THive* hive)
@@ -43,6 +44,7 @@ class TTxLockTabletExecution : public TTransactionBase<THive> {
4344
NKikimrProto::ERROR,
4445
TStringBuilder() << "Trying to lock tablet " << TabletId << " to an invalid owner actor"
4546
), 0, Cookie);
47+
Success = false;
4648
return true;
4749
}
4850

@@ -53,6 +55,7 @@ class TTxLockTabletExecution : public TTransactionBase<THive> {
5355
NKikimrProto::ERROR,
5456
TStringBuilder() << "Trying to lock tablet " << TabletId << ", which doesn't exist"
5557
), 0, Cookie);
58+
Success = false;
5659
return true;
5760
}
5861

@@ -62,6 +65,7 @@ class TTxLockTabletExecution : public TTransactionBase<THive> {
6265
NKikimrProto::ERROR,
6366
TStringBuilder() << "Trying to lock tablet " << TabletId << " to " << OwnerActor << ", which is on a different node"
6467
), 0, Cookie);
68+
Success = false;
6569
return true;
6670
}
6771

@@ -71,6 +75,7 @@ class TTxLockTabletExecution : public TTransactionBase<THive> {
7175
NKikimrProto::ERROR,
7276
TStringBuilder() << "Trying to restore lock to tablet " << TabletId << ", which has expired"
7377
), 0, Cookie);
78+
Success = false;
7479
return true;
7580
}
7681

@@ -107,7 +112,11 @@ class TTxLockTabletExecution : public TTransactionBase<THive> {
107112
}
108113

109114
void Complete(const TActorContext& ctx) override {
110-
BLOG_D("THive::TTxLockTabletExecution::Complete TabletId: " << TabletId << " SideEffects: " << SideEffects);
115+
if (Success) {
116+
BLOG_D("THive::TTxLockTabletExecution::Complete TabletId: " << TabletId << " SideEffects: " << SideEffects);
117+
} else {
118+
BLOG_NOTICE("THive::TTxLockTabletExecution::Complete TabletId: " << TabletId << " SideEffects: " << SideEffects);
119+
}
111120
SideEffects.Complete(ctx);
112121
}
113122

ydb/core/mind/hive/tx__unlock_tablet.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class TTxUnlockTabletExecution : public TTransactionBase<THive> {
4040
{}
4141

4242
bool Execute(TTransactionContext& txc, const TActorContext&) override {
43-
BLOG_D("THive::TTxUnlockTabletExecution::Execute TabletId: " << TabletId);
43+
BLOG_NOTICE("THive::TTxUnlockTabletExecution::Execute TabletId: " << TabletId);
4444
SideEffects.Reset(Self->SelfId());
4545
TLeaderTabletInfo* tablet = Self->FindTabletEvenInDeleting(TabletId);
4646
if (tablet == nullptr) {
@@ -85,7 +85,7 @@ class TTxUnlockTabletExecution : public TTransactionBase<THive> {
8585
}
8686

8787
void Complete(const TActorContext& ctx) override {
88-
BLOG_D("THive::TTxUnlockTabletExecution::Complete TabletId: " << TabletId << " SideEffects: " << SideEffects);
88+
BLOG_NOTICE("THive::TTxUnlockTabletExecution::Complete TabletId: " << TabletId << " SideEffects: " << SideEffects);
8989
SideEffects.Complete(ctx);
9090
}
9191

@@ -109,6 +109,7 @@ ITransaction* THive::CreateUnlockTabletExecution(ui64 tabletId, ui64 seqNo, NKik
109109

110110
void THive::ScheduleUnlockTabletExecution(TNodeInfo& node, NKikimrHive::ELockLostReason reason) {
111111
// Unlock tablets that have been locked by this node
112+
BLOG_NOTICE("ScheduleUnlockTabletExecution(" << node.Id << ", " << NKikimrHive::ELockLostReason_Name(reason) << ")");
112113
for (TLeaderTabletInfo* tablet : node.LockedTablets) {
113114
Y_ABORT_UNLESS(FindTabletEvenInDeleting(tablet->Id) == tablet);
114115
Y_ABORT_UNLESS(tablet->LockedToActor.NodeId() == node.Id);
@@ -128,7 +129,7 @@ void THive::ScheduleUnlockTabletExecution(TNodeInfo& node, NKikimrHive::ELockLos
128129
void THive::Handle(TEvPrivate::TEvUnlockTabletReconnectTimeout::TPtr& ev) {
129130
TTabletId tabletId = ev->Get()->TabletId;
130131
ui64 seqNo = ev->Get()->SeqNo;
131-
BLOG_D("THive::Handle::TEvUnlockTabletReconnectTimeout TabletId=" << tabletId);
132+
BLOG_NOTICE("THive::Handle::TEvUnlockTabletReconnectTimeout TabletId=" << tabletId << " Reason=" << NKikimrHive::ELockLostReason_Name(ev->Get()->Reason));
132133
TLeaderTabletInfo* tablet = FindTabletEvenInDeleting(tabletId);
133134
if (tablet != nullptr && tablet->IsLockedToActor() && tablet->PendingUnlockSeqNo == seqNo) {
134135
// We use sequence numbers to make sure unlock happens only if some

0 commit comments

Comments
 (0)