aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilnaz <ilnaz@ydb.tech>2023-02-03 11:35:46 +0300
committerilnaz <ilnaz@ydb.tech>2023-02-03 11:35:46 +0300
commit93fb09be74df957228051d5fb5235c112eaec095 (patch)
tree5af690679ca051fe44cc6fd94c92bbbb9bdbbce3
parentb80714b23581d4516388b3ec8d8f1b80ac0cfc69 (diff)
downloadydb-93fb09be74df957228051d5fb5235c112eaec095.tar.gz
Re-worked logging
-rw-r--r--ydb/core/tx/scheme_board/events.h111
-rw-r--r--ydb/core/tx/scheme_board/populator.cpp127
-rw-r--r--ydb/core/tx/scheme_board/replica.cpp281
-rw-r--r--ydb/core/tx/scheme_board/subscriber.cpp50
4 files changed, 280 insertions, 289 deletions
diff --git a/ydb/core/tx/scheme_board/events.h b/ydb/core/tx/scheme_board/events.h
index 018ebbff7db..506fb5becab 100644
--- a/ydb/core/tx/scheme_board/events.h
+++ b/ydb/core/tx/scheme_board/events.h
@@ -50,6 +50,44 @@ struct TSchemeBoardEvents {
static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_SCHEME_BOARD), "expect End < EventSpaceEnd(ES_SCHEME_BOARD)");
+ template <typename T>
+ static TStringBuilder& PrintOwnerGeneration(TStringBuilder& out, const T& record) {
+ return out
+ << " Owner: " << record.GetOwner()
+ << " Generation: " << record.GetGeneration();
+ }
+
+ template <typename T>
+ static TString PrintOwnerGeneration(const IEventBase* ev, const T& record) {
+ auto out = TStringBuilder() << ev->ToStringHeader() << " {";
+ PrintOwnerGeneration(out, record);
+ return out << " }";
+ }
+
+ template <typename T>
+ static TStringBuilder& PrintPath(TStringBuilder& out, const T& record) {
+ if (record.HasPath() && record.HasPathOwnerId() && record.HasLocalPathId()) {
+ out << " Path: " << record.GetPath()
+ << " PathId: " << TPathId(record.GetPathOwnerId(), record.GetLocalPathId());
+ } else if (record.HasPath()) {
+ out << " Path: " << record.GetPath();
+ } else if (record.HasPathOwnerId() && record.HasLocalPathId()) {
+ out << " PathId: " << TPathId(record.GetPathOwnerId(), record.GetLocalPathId());
+ } else {
+ out << " Path: <empty>"
+ << " PathId: <empty>";
+ }
+
+ return out;
+ }
+
+ template <typename T>
+ static TString PrintPath(const IEventBase* ev, const T& record) {
+ auto out = TStringBuilder() << ev->ToStringHeader() << " {";
+ PrintPath(out, record);
+ return out << " }";
+ }
+
// populator events
struct TEvRequestDescribe: public TEventLocal<TEvRequestDescribe, EvRequestDescribe> {
const TPathId PathId;
@@ -62,6 +100,13 @@ struct TSchemeBoardEvents {
, Replica(replica)
{
}
+
+ TString ToString() const override {
+ return TStringBuilder() << ToStringHeader() << " {"
+ << " PathId: " << PathId
+ << " Replica: " << Replica
+ << " }";
+ }
};
struct TEvDescribeResult: public TEventLocal<TEvDescribeResult, EvDescribeResult> {
@@ -136,6 +181,12 @@ struct TSchemeBoardEvents {
: PathId(pathId)
{
}
+
+ TString ToString() const override {
+ return TStringBuilder() << ToStringHeader() << " {"
+ << " PathId: " << PathId
+ << " }";
+ }
};
// replica <--> populator events
@@ -146,6 +197,10 @@ struct TSchemeBoardEvents {
Record.SetOwner(owner);
Record.SetGeneration(generation);
}
+
+ TString ToString() const override {
+ return PrintOwnerGeneration(this, Record);
+ }
};
struct TEvHandshakeResponse: public TEventPB<TEvHandshakeResponse, NKikimrSchemeBoard::TEvHandshake, EvHandshakeResponse> {
@@ -155,6 +210,10 @@ struct TSchemeBoardEvents {
Record.SetOwner(owner);
Record.SetGeneration(generation);
}
+
+ TString ToString() const override {
+ return PrintOwnerGeneration(this, Record);
+ }
};
struct TEvUpdate: public TEventPreSerializedPB<TEvUpdate, NKikimrSchemeBoard::TEvUpdate, EvUpdate> {
@@ -170,6 +229,10 @@ struct TSchemeBoardEvents {
Record.GetLocalPathId()
);
}
+
+ TString ToString() const override {
+ return PrintOwnerGeneration(this, Record);
+ }
};
struct TEvUpdateBuilder: public TEvUpdate {
@@ -253,6 +316,15 @@ struct TSchemeBoardEvents {
Record.GetLocalPathId()
);
}
+
+ TString ToString() const override {
+ auto out = TStringBuilder() << ToStringHeader() << " {";
+ PrintOwnerGeneration(out, Record);
+ return out
+ << " PathId: " << GetPathId()
+ << " Version: " << Record.GetVersion()
+ << " }";
+ }
};
struct TEvCommitRequest: public TEventPB<TEvCommitRequest, NKikimrSchemeBoard::TEvCommitGeneration, EvCommitRequest> {
@@ -262,6 +334,10 @@ struct TSchemeBoardEvents {
Record.SetOwner(owner);
Record.SetGeneration(generation);
}
+
+ TString ToString() const override {
+ return PrintOwnerGeneration(this, Record);
+ }
};
struct TEvCommitResponse: public TEventPB<TEvCommitResponse, NKikimrSchemeBoard::TEvCommitGeneration, EvCommitResponse> {
@@ -271,6 +347,10 @@ struct TSchemeBoardEvents {
Record.SetOwner(owner);
Record.SetGeneration(generation);
}
+
+ TString ToString() const override {
+ return PrintOwnerGeneration(this, Record);
+ }
};
// subscriber <--> replica events
@@ -290,6 +370,12 @@ struct TSchemeBoardEvents {
FillCapabilities(Record);
}
+ TString ToString() const override {
+ auto out = TStringBuilder() << ToStringHeader() << " {";
+ PrintPath(out, Record);
+ return out << " DomainOwnerId: " << Record.GetDomainOwnerId() << " }";
+ }
+
static void FillCapabilities(NKikimrSchemeBoard::TEvSubscribe& record) {
record.MutableCapabilities()->SetAckNotifications(true);
}
@@ -306,10 +392,18 @@ struct TSchemeBoardEvents {
Record.SetPathOwnerId(pathId.OwnerId);
Record.SetLocalPathId(pathId.LocalPathId);
}
+
+ TString ToString() const override {
+ return PrintPath(this, Record);
+ }
};
struct TEvNotify: public TEventPreSerializedPB<TEvNotify, NKikimrSchemeBoard::TEvNotify, EvNotify> {
TEvNotify() = default;
+
+ TString ToString() const override {
+ return PrintPath(this, Record);
+ }
};
struct TEvNotifyBuilder: public TEvNotify {
@@ -351,6 +445,12 @@ struct TSchemeBoardEvents {
explicit TEvNotifyAck(ui64 version) {
Record.SetVersion(version);
}
+
+ TString ToString() const override {
+ return TStringBuilder() << ToStringHeader() << " {"
+ << " Version: " << Record.GetVersion()
+ << " }";
+ }
};
struct TEvSyncVersionRequest: public TEventPB<TEvSyncVersionRequest, NKikimrSchemeBoard::TEvSyncVersionRequest, EvSyncVersionRequest> {
@@ -364,6 +464,10 @@ struct TSchemeBoardEvents {
Record.SetPathOwnerId(pathId.OwnerId);
Record.SetLocalPathId(pathId.LocalPathId);
}
+
+ TString ToString() const override {
+ return PrintPath(this, Record);
+ }
};
struct TEvSyncVersionResponse: public TEventPB<TEvSyncVersionResponse, NKikimrSchemeBoard::TEvSyncVersionResponse, EvSyncVersionResponse> {
@@ -373,6 +477,13 @@ struct TSchemeBoardEvents {
Record.SetVersion(version);
Record.SetPartial(partial);
}
+
+ TString ToString() const override {
+ return TStringBuilder() << ToStringHeader() << " {"
+ << " Version: " << Record.GetVersion()
+ << " Partial: " << Record.GetPartial()
+ << " }";
+ }
};
// cache <--> subscriber events
diff --git a/ydb/core/tx/scheme_board/populator.cpp b/ydb/core/tx/scheme_board/populator.cpp
index f860bb88cb1..a002989612a 100644
--- a/ydb/core/tx/scheme_board/populator.cpp
+++ b/ydb/core/tx/scheme_board/populator.cpp
@@ -29,11 +29,11 @@
namespace NKikimr {
namespace NSchemeBoard {
-#define SBP_LOG_T(stream) SB_LOG_T(SCHEME_BOARD_POPULATOR, stream)
-#define SBP_LOG_D(stream) SB_LOG_D(SCHEME_BOARD_POPULATOR, stream)
-#define SBP_LOG_N(stream) SB_LOG_N(SCHEME_BOARD_POPULATOR, stream)
-#define SBP_LOG_E(stream) SB_LOG_E(SCHEME_BOARD_POPULATOR, stream)
-#define SBP_LOG_CRIT(stream) SB_LOG_CRIT(SCHEME_BOARD_POPULATOR, stream)
+#define SBP_LOG_T(stream) SB_LOG_T(SCHEME_BOARD_POPULATOR, "" << SelfId() << " " << stream)
+#define SBP_LOG_D(stream) SB_LOG_D(SCHEME_BOARD_POPULATOR, "" << SelfId() << " " << stream)
+#define SBP_LOG_N(stream) SB_LOG_N(SCHEME_BOARD_POPULATOR, "" << SelfId() << " " << stream)
+#define SBP_LOG_E(stream) SB_LOG_E(SCHEME_BOARD_POPULATOR, "" << SelfId() << " " << stream)
+#define SBP_LOG_CRIT(stream) SB_LOG_CRIT(SCHEME_BOARD_POPULATOR, "" << SelfId() << " " << stream)
namespace {
@@ -80,12 +80,10 @@ class TReplicaPopulator: public TMonitorableActor<TReplicaPopulator> {
auto& record = msg->Description.Record;
if (!record.HasStatus()) {
- SBP_LOG_E("Ignore description without status"
- << ": self# " << SelfId());
+ SBP_LOG_E("Ignore description without status");
} else if (record.GetStatus() != NKikimrScheme::StatusSuccess) {
SBP_LOG_E("Ignore description"
- << ": self# " << SelfId()
- << ", status# " << record.GetStatus()
+ << ": status# " << record.GetStatus()
<< ", msg# " << record.ShortDebugString());
} else {
CurPathId = GetPathId(record);
@@ -95,10 +93,9 @@ class TReplicaPopulator: public TMonitorableActor<TReplicaPopulator> {
if (msg->HasMigratedPath()) {
SBP_LOG_D("Ignore description of migrated path"
- << ": self# " << SelfId()
- << ", owner# " << Owner
+ << ": owner# " << Owner
<< ", localPathId# " << msg->MigratedPathId);
- //this path should be described by another owner (tenant schemeshard)
+ // this path should be described by another owner (tenant schemeshard)
auto& migratedLocalPathIds = *update->Record.MutableMigratedLocalPathIds();
migratedLocalPathIds.SetBegin(msg->MigratedPathId);
migratedLocalPathIds.SetEnd(msg->MigratedPathId);
@@ -215,8 +212,7 @@ class TReplicaPopulator: public TMonitorableActor<TReplicaPopulator> {
bool Check(TEvent& ev, T this_, T that, const TString& what) {
if (this_ != that) {
SBP_LOG_E("Suspicious " << TypeName<TEvent>()
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ << ": sender# " << ev->Sender
<< ", " << what << "# " << this_
<< ", other " << what << "# " << that);
return false;
@@ -236,9 +232,8 @@ class TReplicaPopulator: public TMonitorableActor<TReplicaPopulator> {
}
void Handle(TSchemeBoardEvents::TEvHandshakeResponse::TPtr& ev) {
- SBP_LOG_D("Handle TSchemeBoardEvents::TEvHandshakeResponse"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender);
+ SBP_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
if (!CheckOwner(ev)) {
return;
@@ -246,23 +241,19 @@ class TReplicaPopulator: public TMonitorableActor<TReplicaPopulator> {
const ui64 generation = ev->Get()->Record.GetGeneration();
if (generation > Generation) {
- SBP_LOG_CRIT("I MUST DIE"
- << ": self# " << SelfId());
+ SBP_LOG_CRIT("Keep calm");
Become(&TThis::StateCalm);
} else {
SBP_LOG_N("Successful handshake"
- << ": self# " << SelfId()
- << ", replica# " << ev->Sender);
+ << ": replica# " << ev->Sender);
if (generation < Generation) {
SBP_LOG_N("Start full sync"
- << ": self# " << SelfId()
- << ", replica# " << ev->Sender);
+ << ": replica# " << ev->Sender);
ProcessSync();
} else {
SBP_LOG_N("Resume sync"
- << ": self# " << SelfId()
- << ", replica# " << ev->Sender
+ << ": replica# " << ev->Sender
<< ", fromPathId# " << LastAckedPathId.NextId());
ResumeSync(LastAckedPathId.NextId());
}
@@ -273,30 +264,24 @@ class TReplicaPopulator: public TMonitorableActor<TReplicaPopulator> {
}
void Handle(TSchemeBoardEvents::TEvDescribeResult::TPtr& ev) {
- SBP_LOG_D("Handle TSchemeBoardEvents::TEvDescribeResult"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender);
- SBP_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 1000));
+ SBP_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
ProcessSync(ev->Get());
}
void Handle(TSchemeBoardEvents::TEvUpdate::TPtr& ev) {
- SBP_LOG_D("Handle TSchemeBoardEvents::TEvUpdate"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ SBP_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
- SBP_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 1000));
EnqueueUpdate(ev, true);
}
void Handle(TSchemeBoardEvents::TEvUpdateAck::TPtr& ev) {
- SBP_LOG_D("Handle TSchemeBoardEvents::TEvUpdateAck (replica)"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ SBP_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
- SBP_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 1000));
if (!CheckOwner(ev) || !CheckGeneration(ev)) {
return;
@@ -313,10 +298,8 @@ class TReplicaPopulator: public TMonitorableActor<TReplicaPopulator> {
}
void Handle(TSchemeBoardEvents::TEvCommitResponse::TPtr& ev) {
- SBP_LOG_D("Handle TSchemeBoardEvents::TEvCommitResponse"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender);
- SBP_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 1000));
+ SBP_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
if (!CheckOwner(ev) || !CheckGeneration(ev)) {
return;
@@ -544,18 +527,15 @@ class TPopulator: public TMonitorableActor<TPopulator> {
}
void Handle(TSchemeBoardEvents::TEvRequestDescribe::TPtr& ev) {
- SBP_LOG_D("Handle TSchemeBoardEvents::TEvRequestDescribe"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
- << ", pathId# " << ev->Get()->PathId);
+ SBP_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
const TActorId replicaPopulator = ev->Sender;
const TActorId replica = ev->Get()->Replica;
if (ReplicaToReplicaPopulator[replica] != replicaPopulator) {
SBP_LOG_CRIT("Inconsistent replica populator"
- << ": self# " << SelfId()
- << ", replica# " << replica
+ << ": replica# " << replica
<< ", replicaPopulator# " << replicaPopulator);
return;
}
@@ -643,13 +623,10 @@ class TPopulator: public TMonitorableActor<TPopulator> {
}
void Handle(TSchemeBoardEvents::TEvRequestUpdate::TPtr& ev) {
- const TPathId pathId = ev->Get()->PathId;
-
- SBP_LOG_D("Handle TSchemeBoardEvents::TEvRequestUpdate"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
- << ", pathId# " << pathId);
+ SBP_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
+ const TPathId pathId = ev->Get()->PathId;
THolder<TSchemeBoardEvents::TEvUpdateBuilder> update;
auto it = Descriptions.find(pathId);
@@ -665,28 +642,23 @@ class TPopulator: public TMonitorableActor<TPopulator> {
}
void DelayUpdate(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
- SBP_LOG_D("DelayUpdate TEvSchemeShard::TEvDescribeSchemeResult"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ SBP_LOG_D("DelayUpdate " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
- SBP_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 1000));
DelayedUpdates.emplace_back(ev.Release());
}
void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
- SBP_LOG_D("Handle TEvSchemeShard::TEvDescribeSchemeResult"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ SBP_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
- SBP_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 1000));
auto* msg = static_cast<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder*>(ev->Get());
auto& record = msg->Record;
if (!record.HasStatus()) {
- SBP_LOG_E("Description without status"
- << ": self# " << SelfId());
+ SBP_LOG_E("Description without status");
return;
}
@@ -695,8 +667,7 @@ class TPopulator: public TMonitorableActor<TPopulator> {
const ui64 version = isDeletion ? Max<ui64>() : GetPathVersion(record);
SBP_LOG_N("Update description"
- << ": self# " << SelfId()
- << ", owner# " << Owner
+ << ": owner# " << Owner
<< ", pathId# " << pathId
<< ", cookie# " << ev->Cookie
<< ", is deletion# " << (isDeletion ? "true" : "false"));
@@ -704,8 +675,7 @@ class TPopulator: public TMonitorableActor<TPopulator> {
if (isDeletion) {
if (!Descriptions.contains(pathId)) {
SBP_LOG_N("Immediate ack for deleted path"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ << ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie
<< ", pathId# " << pathId);
@@ -736,17 +706,14 @@ class TPopulator: public TMonitorableActor<TPopulator> {
void Handle(TSchemeBoardEvents::TEvUpdateAck::TPtr& ev) {
const auto& record = ev->Get()->Record;
- SBP_LOG_D("Handle TSchemeBoardEvents::TEvUpdateAck (main)"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ SBP_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
- SBP_LOG_T("Message:\n" << record.ShortDebugString());
auto it = UpdateAcks.find(ev->Cookie);
if (it == UpdateAcks.end()) {
SBP_LOG_D("Ack for unknown update (already acked?)"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ << ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
return;
}
@@ -760,8 +727,7 @@ class TPopulator: public TMonitorableActor<TPopulator> {
&& pathIt->first.second <= version) {
if (++pathIt->second > (GroupInfo->NToSelect / 2)) {
SBP_LOG_N("Ack update"
- << ": self# " << SelfId()
- << ", ack to# " << it->second.AckTo
+ << ": ack to# " << it->second.AckTo
<< ", cookie# " << ev->Cookie
<< ", pathId# " << pathId
<< ", version# " << pathIt->first.second);
@@ -784,16 +750,14 @@ class TPopulator: public TMonitorableActor<TPopulator> {
}
void Handle(TEvStateStorage::TEvListSchemeBoardResult::TPtr& ev) {
- SBP_LOG_D("Handle TEvStateStorage::TEvListSchemeBoardResult"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender);
+ SBP_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
const auto& info = ev->Get()->Info;
if (!info) {
SBP_LOG_E("Publish on unconfigured SchemeBoard"
- << ": self# " << SelfId()
- << ", StateStorage group# " << StateStorageGroup);
+ << ": StateStorage group# " << StateStorageGroup);
Become(&TThis::StateCalm);
return;
}
@@ -880,8 +844,7 @@ class TPopulator: public TMonitorableActor<TPopulator> {
void HandleUndelivered() {
SBP_LOG_E("Publish on unavailable SchemeBoard"
- << ": self# " << SelfId()
- << ", StateStorage group# " << StateStorageGroup);
+ << ": StateStorage group# " << StateStorageGroup);
Become(&TThis::StateCalm);
}
diff --git a/ydb/core/tx/scheme_board/replica.cpp b/ydb/core/tx/scheme_board/replica.cpp
index dfdd36ff180..4771206aa05 100644
--- a/ydb/core/tx/scheme_board/replica.cpp
+++ b/ydb/core/tx/scheme_board/replica.cpp
@@ -26,11 +26,11 @@
namespace NKikimr {
namespace NSchemeBoard {
-#define SBR_LOG_T(stream) SB_LOG_T(SCHEME_BOARD_REPLICA, stream)
-#define SBR_LOG_D(stream) SB_LOG_D(SCHEME_BOARD_REPLICA, stream)
-#define SBR_LOG_I(stream) SB_LOG_I(SCHEME_BOARD_REPLICA, stream)
-#define SBR_LOG_N(stream) SB_LOG_N(SCHEME_BOARD_REPLICA, stream)
-#define SBR_LOG_E(stream) SB_LOG_E(SCHEME_BOARD_REPLICA, stream)
+#define SBR_LOG_T(stream) SB_LOG_T(SCHEME_BOARD_REPLICA, "" << SelfId() << " " << stream)
+#define SBR_LOG_D(stream) SB_LOG_D(SCHEME_BOARD_REPLICA, "" << SelfId() << " " << stream)
+#define SBR_LOG_I(stream) SB_LOG_I(SCHEME_BOARD_REPLICA, "" << SelfId() << " " << stream)
+#define SBR_LOG_N(stream) SB_LOG_N(SCHEME_BOARD_REPLICA, "" << SelfId() << " " << stream)
+#define SBR_LOG_E(stream) SB_LOG_E(SCHEME_BOARD_REPLICA, "" << SelfId() << " " << stream)
class TReplica: public TMonitorableActor<TReplica> {
using TDescribeSchemeResult = NKikimrScheme::TEvDescribeSchemeResult;
@@ -53,6 +53,12 @@ class TReplica: public TMonitorableActor<TReplica> {
: Owner(owner)
{
}
+
+ TString ToString() const override {
+ return TStringBuilder() << ToStringHeader() << " {"
+ << " Owner: " << Owner
+ << " }";
+ }
};
};
@@ -226,6 +232,10 @@ public:
other.TrackMemory();
}
+ auto SelfId() const {
+ return Owner->SelfId();
+ }
+
public:
explicit TDescription(TReplica* owner, const TString& path)
: Owner(owner)
@@ -288,8 +298,7 @@ public:
TDescription(const TDescription& other) = delete;
TDescription& operator=(const TDescription& other) = delete;
- ~TDescription()
- {
+ ~TDescription() {
UntrackMemory();
}
@@ -321,13 +330,8 @@ public:
<< ", other# " << other.ToString());
SBR_LOG_T("Merge descriptions"
- << ": self# " << Owner->SelfId()
- << ", left path# " << Path
- << ", left pathId# " << PathId
- << ", left version# " << GetVersion()
- << ", rigth path# " << other.Path
- << ", rigth pathId# " << other.PathId
- << ", rigth version# " << other.GetVersion());
+ << ": self# " << ToLogString()
+ << ", other# " << other.ToLogString());
UntrackMemory();
other.UntrackMemory();
@@ -374,6 +378,15 @@ public:
<< " }";
}
+ TString ToLogString() const {
+ return TStringBuilder() << "{"
+ << " Path# " << Path
+ << " PathId# " << PathId
+ << " Version# " << GetVersion()
+ << " ExplicitlyDeleted# " << (ExplicitlyDeleted ? "true" : "false")
+ << " }";
+ }
+
const TString& GetPath() const {
return Path;
}
@@ -534,26 +547,24 @@ private:
template <typename TPath>
TDescription& UpsertDescription(const TPath& path) {
SBR_LOG_I("Upsert description"
- << ": self# " << SelfId()
- << ", path# " << path);
+ << ": path# " << path);
return Descriptions.Upsert(path, TDescription(this, path));
}
TDescription& UpsertDescription(const TString& path, const TPathId& pathId) {
SBR_LOG_I("Upsert description"
- << ": self# " << SelfId()
- << ", path# " << path
+ << ": path# " << path
<< ", pathId# " << pathId);
return Descriptions.Upsert(path, pathId, TDescription(this, path, pathId));
}
template <typename TPath>
- TDescription& UpsertDescription(const TPath path, TDescription&& description) {
+ TDescription& UpsertDescription(const TPath& path, TDescription&& description) {
SBR_LOG_I("Upsert description"
- << ": self# " << SelfId()
- << ", path# " << path);
+ << ": path# " << path
+ << ", desc# " << description.ToLogString());
return Descriptions.Upsert(path, std::move(description));
}
@@ -564,8 +575,7 @@ private:
TDescribeSchemeResult&& describeSchemeResult
) {
SBR_LOG_I("Upsert description"
- << ": self# " << SelfId()
- << ", path# " << path
+ << ": path# " << path
<< ", pathId# " << pathId);
return Descriptions.Upsert(path, pathId, TDescription(this, path, pathId, std::move(describeSchemeResult)));
@@ -590,8 +600,7 @@ private:
auto path = desc->GetPath();
SBR_LOG_I("Delete description"
- << ": self# " << SelfId()
- << ", path# " << path
+ << ": path# " << path
<< ", pathId# " << pathId);
if (TDescription* descByPath = Descriptions.FindPtr(path)) {
@@ -601,10 +610,9 @@ private:
auto curDomainId = descByPath->GetDomainId();
auto domainId = desc->GetDomainId();
- if (curDomainId == pathId) { //Deletion from GSS
+ if (curDomainId == pathId) { // Deletion from GSS
SBR_LOG_N("Delete description by GSS"
- << ": self# " << SelfId()
- << ", path# " << path
+ << ": path# " << path
<< ", pathId# " << pathId
<< ", domainId# " << domainId
<< ", curPathId# " << curPathId
@@ -660,9 +668,8 @@ private:
TDescription* desc = Descriptions.FindPtr(path);
Y_VERIFY(desc);
- SBR_LOG_N("Subscribe"
- << ": self# " << SelfId()
- << ", subscriber# " << subscriber
+ SBR_LOG_I("Subscribe"
+ << ": subscriber# " << subscriber
<< ", path# " << path
<< ", domainOwnerId# " << domainOwnerId
<< ", capabilities# " << capabilities.ShortDebugString());
@@ -679,9 +686,8 @@ private:
TDescription* desc = Descriptions.FindPtr(path);
Y_VERIFY(desc);
- SBR_LOG_N("Unsubscribe"
- << ": self# " << SelfId()
- << ", subscriber# " << subscriber
+ SBR_LOG_I("Unsubscribe"
+ << ": subscriber# " << subscriber
<< ", path# " << path);
desc->Unsubscribe(subscriber);
@@ -770,22 +776,17 @@ private:
}
void Handle(TSchemeBoardEvents::TEvHandshakeRequest::TPtr& ev) {
- const auto& record = ev->Get()->Record;
+ SBR_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
+ const auto& record = ev->Get()->Record;
const ui64 owner = record.GetOwner();
const ui64 generation = record.GetGeneration();
- SBR_LOG_D("Handle TSchemeBoardEvents::TEvHandshakeRequest"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
- << ", owner# " << owner
- << ", generation# " << generation);
-
TPopulatorInfo& info = Populators[owner];
if (generation < info.PendingGeneration) {
SBR_LOG_E("Reject handshake from stale populator"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ << ": sender# " << ev->Sender
<< ", owner# " << owner
<< ", generation# " << generation
<< ", pending generation# " << info.PendingGeneration);
@@ -793,8 +794,7 @@ private:
}
SBR_LOG_N("Successful handshake"
- << ": self# " << SelfId()
- << ", owner# " << owner
+ << ": owner# " << owner
<< ", generation# " << generation);
info.PendingGeneration = generation;
@@ -804,32 +804,25 @@ private:
}
void Handle(TSchemeBoardEvents::TEvUpdate::TPtr& ev) {
- auto& record = *ev->Get()->MutableRecord();
+ SBR_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender
+ << ", cookie# " << ev->Cookie);
+ auto& record = *ev->Get()->MutableRecord();
const ui64 owner = record.GetOwner();
const ui64 generation = record.GetGeneration();
- SBR_LOG_D("Handle TSchemeBoardEvents::TEvUpdate"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
- << ", cookie# " << ev->Cookie
- << ", owner# " << owner
- << ", generation# " << generation);
- SBR_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 10000));
-
const auto populatorIt = Populators.find(owner);
if (populatorIt == Populators.end()) {
SBR_LOG_E("Reject update from unknown populator"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ << ": sender# " << ev->Sender
<< ", owner# " << owner
<< ", generation# " << generation);
return;
}
if (generation != populatorIt->second.PendingGeneration) {
SBR_LOG_E("Reject update from stale populator"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ << ": sender# " << ev->Sender
<< ", owner# " << owner
<< ", generation# " << generation
<< ", pending generation# " << populatorIt->second.PendingGeneration);
@@ -850,8 +843,7 @@ private:
const TPathId pathId = ev->Get()->GetPathId();
SBR_LOG_N("Update description"
- << ": self# " << SelfId()
- << ", path# " << path
+ << ": path# " << path
<< ", pathId# " << pathId
<< ", deletion# " << (record.GetIsDeletion() ? "true" : "false"));
@@ -863,8 +855,7 @@ private:
if (TDescription* desc = Descriptions.FindPtr(pathId)) {
if (desc->IsExplicitlyDeleted()) {
SBR_LOG_N("Path was explicitly deleted, ignoring"
- << ": self# " << SelfId()
- << ", path# " << path
+ << ": path# " << path
<< ", pathId# " << pathId);
return AckUpdate(ev);
@@ -899,97 +890,64 @@ private:
return AckUpdate(ev);
}
- Y_VERIFY_S(desc->IsFilled(), "desc :"
- << ": path# " << desc->GetPath()
- << ", pathId# " << desc->GetPathId()
- << ", domainId# " << desc->GetDomainId()
- << ", version# " << desc->GetVersion());
+ Y_VERIFY_S(desc->IsFilled(), "Description is not filled"
+ << ": desc# " << desc->ToLogString());
auto curDomainId = desc->GetDomainId();
auto domainId = GetDomainId(record.GetDescribeSchemeResult());
- if (curPathId == domainId) { //Update from TSS, GSS->TSS
+ auto log = [&](const TString& message) {
+ SBR_LOG_N("" << message
+ << ": path# " << path
+ << ", pathId# " << pathId
+ << ", domainId# " << domainId
+ << ", curPathId# " << curPathId
+ << ", curDomainId# " << curDomainId);
+ };
+ if (curPathId == domainId) { // Update from TSS, GSS->TSS
// it is only because we need to manage undo of upgrade subdomain, finally remove it
auto abandonedSchemeShards = desc->GetAbandonedSchemeShardIds();
- if (abandonedSchemeShards.contains(pathId.OwnerId)) { //TSS is ignored, present GSS reverted it
- SBR_LOG_N("Replace GSS by TSS description is rejected, GSS implicitly knows that TSS has been reverted"
- ", but still inject description only by pathId for safe"
- << ": self# " << SelfId()
- << ", path# " << path
- << ", pathId# " << pathId
- << ", domainId# " << domainId
- << ", curPathId# " << curPathId
- << ", curDomainId# " << curDomainId);
+ if (abandonedSchemeShards.contains(pathId.OwnerId)) { // TSS is ignored, present GSS reverted it
+ log("Replace GSS by TSS description is rejected, GSS implicitly knows that TSS has been reverted"
+ ", but still inject description only by pathId for safe");
UpsertDescription(pathId, TDescription(this, path, pathId, std::move(*record.MutableDescribeSchemeResult())));
return AckUpdate(ev);
}
- SBR_LOG_N("Replace GSS by TSS description"
- << ": self# " << SelfId()
- << ", path# " << path
- << ", pathId# " << pathId
- << ", domainId# " << domainId
- << ", curPathId# " << curPathId
- << ", curDomainId# " << curDomainId);
- //unlick GSS desc by path
+ log("Replace GSS by TSS description");
+ // unlick GSS desc by path
Descriptions.DeleteIndex(path);
RelinkSubscribers(desc, path);
UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
return AckUpdate(ev);
}
- if (curDomainId == pathId) { //Update from GSS, TSS->GSS
-
+ if (curDomainId == pathId) { // Update from GSS, TSS->GSS
// it is only because we need to manage undo of upgrade subdomain, finally remove it
auto abandonedSchemeShards = GetAbandonedSchemeShardIds(record.GetDescribeSchemeResult());
- if (abandonedSchemeShards.contains(curPathId.OwnerId)) { //GSS reverts TSS
- SBR_LOG_N("Replace TSS by GSS description, TSS was implicitly reverted by GSS"
- << ": self# " << SelfId()
- << ", path# " << path
- << ", pathId# " << pathId
- << ", domainId# " << domainId
- << ", curPathId# " << curPathId
- << ", curDomainId# " << curDomainId);
- //unlick TSS desc by path
+ if (abandonedSchemeShards.contains(curPathId.OwnerId)) { // GSS reverts TSS
+ log("Replace TSS by GSS description, TSS was implicitly reverted by GSS");
+ // unlick TSS desc by path
Descriptions.DeleteIndex(path);
RelinkSubscribers(desc, path);
UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
return AckUpdate(ev);
}
- SBR_LOG_N("Inject description only by pathId, it is update from GSS"
- << ": self# " << SelfId()
- << ", path# " << path
- << ", pathId# " << pathId
- << ", domainId# " << domainId
- << ", curPathId# " << curPathId
- << ", curDomainId# " << curDomainId);
+ log("Inject description only by pathId, it is update from GSS");
UpsertDescription(pathId, TDescription(this, path, pathId, std::move(*record.MutableDescribeSchemeResult())));
return AckUpdate(ev);
}
if (curDomainId == domainId) {
if (curPathId > pathId) {
- SBR_LOG_N("Totally ignore description, path with obsolete pathId"
- << ": self# " << SelfId()
- << ", path# " << path
- << ", pathId# " << pathId
- << ", domainId# " << domainId
- << ", curPathId# " << curPathId
- << ", curDomainId# " << curDomainId);
+ log("Totally ignore description, path with obsolete pathId");
return AckUpdate(ev);
}
if (curPathId < pathId) {
- SBR_LOG_N("Update description by newest path form tenant schemeshard"
- << ": self# " << SelfId()
- << ", path# " << path
- << ", pathId# " << pathId
- << ", domainId# " << domainId
- << ", curPathId# " << curPathId
- << ", curDomainId# " << curDomainId);
-
+ log("Update description by newest path form tenant schemeshard");
SoftDeleteDescription(desc->GetPathId());
Descriptions.DeleteIndex(path);
RelinkSubscribers(desc, path);
@@ -998,31 +956,18 @@ private:
UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
return AckUpdate(ev);
} else if (curDomainId < domainId) {
- SBR_LOG_N("Update description by newest path with newer domainId"
- << ": self# " << SelfId()
- << ", path# " << path
- << ", pathId# " << pathId
- << ", domainId# " << domainId
- << ", curPathId# " << curPathId
- << ", curDomainId# " << curDomainId);
+ log("Update description by newest path with newer domainId");
Descriptions.DeleteIndex(path);
RelinkSubscribers(desc, path);
UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
return AckUpdate(ev);
} else {
- SBR_LOG_N("Totally ignore description, path with obsolete domainId"
- << ": self# " << SelfId()
- << ", path# " << path
- << ", pathId# " << pathId
- << ", domainId# " << domainId
- << ", curPathId# " << curPathId
- << ", curDomainId# " << curDomainId);
+ log("Totally ignore description, path with obsolete domainId");
return AckUpdate(ev);
}
Y_FAIL_S("Can't insert old description, no relation between obj"
- << ": self# " << SelfId()
- << ", path# " << path
+ << ": path# " << path
<< ", pathId# " << pathId
<< ", domainId# " << domainId
<< ", curPathId# " << curPathId
@@ -1030,22 +975,17 @@ private:
}
void Handle(TSchemeBoardEvents::TEvCommitRequest::TPtr& ev) {
- const auto& record = ev->Get()->Record;
+ SBR_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
+ const auto& record = ev->Get()->Record;
const ui64 owner = record.GetOwner();
const ui64 generation = record.GetGeneration();
- SBR_LOG_D("Handle TSchemeBoardEvents::TEvCommitRequest"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
- << ", owner# " << owner
- << ", generation# " << generation);
-
auto it = Populators.find(owner);
if (it == Populators.end()) {
SBR_LOG_E("Reject commit from unknown populator"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ << ": sender# " << ev->Sender
<< ", owner# " << owner
<< ", generation# " << generation);
return;
@@ -1054,8 +994,7 @@ private:
TPopulatorInfo& info = it->second;
if (generation != info.PendingGeneration) {
SBR_LOG_E("Reject commit from stale populator"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
+ << ": sender# " << ev->Sender
<< ", owner# " << owner
<< ", generation# " << generation
<< ", pending generation# " << info.PendingGeneration);
@@ -1063,8 +1002,7 @@ private:
}
SBR_LOG_N("Commit generation"
- << ": self# " << SelfId()
- << ", owner# " << owner
+ << ": owner# " << owner
<< ", generation# " << generation);
info.Generation = info.PendingGeneration;
@@ -1076,25 +1014,19 @@ private:
}
void Handle(TEvPrivate::TEvSendStrongNotifications::TPtr& ev) {
- const auto limit = ev->Get()->BatchSize;
- const auto owner = ev->Get()->Owner;
-
- SBR_LOG_D("Handle TEvPrivate::TEvSendStrongNotifications"
- << ": self# " << SelfId()
- << ", owner# " << owner);
+ SBR_LOG_D("Handle " << ev->Get()->ToString());
+ const auto owner = ev->Get()->Owner;
if (!IsPopulatorCommited(owner)) {
SBR_LOG_N("Populator is not commited"
- << ": self# " << SelfId()
- << ", owner# " << owner);
+ << ": owner# " << owner);
return;
}
auto itSubscribers = WaitStrongNotifications.find(owner);
if (itSubscribers == WaitStrongNotifications.end()) {
SBR_LOG_E("Invalid owner"
- << ": self# " << SelfId()
- << ", owner# " << owner);
+ << ": owner# " << owner);
return;
}
@@ -1102,6 +1034,7 @@ private:
auto it = subscribers.begin();
ui32 count = 0;
+ const auto limit = ev->Get()->BatchSize;
while (count++ < limit && it != subscribers.end()) {
const TActorId subscriber = *it;
it = subscribers.erase(it);
@@ -1141,15 +1074,12 @@ private:
void Handle(TSchemeBoardEvents::TEvSubscribe::TPtr& ev) {
const auto& record = ev->Get()->Record;
-
- SBR_LOG_D("Handle TSchemeBoardEvents::TEvSubscribe"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
- << ", record# " << record.ShortDebugString());
-
const ui64 domainOwnerId = record.GetDomainOwnerId();
const auto& capabilities = record.GetCapabilities();
+ SBR_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
+
if (record.HasPath()) {
SubscribeBy(ev->Sender, record.GetPath(), domainOwnerId, capabilities);
} else {
@@ -1161,10 +1091,8 @@ private:
void Handle(TSchemeBoardEvents::TEvUnsubscribe::TPtr& ev) {
const auto& record = ev->Get()->Record;
- SBR_LOG_D("Handle TSchemeBoardEvents::TEvUnsubscribe"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
- << ", record# " << record.ShortDebugString());
+ SBR_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
if (record.HasPath()) {
UnsubscribeBy(ev->Sender, record.GetPath());
@@ -1177,10 +1105,8 @@ private:
void Handle(TSchemeBoardEvents::TEvNotifyAck::TPtr& ev) {
const auto& record = ev->Get()->Record;
- SBR_LOG_D("Handle TSchemeBoardEvents::TEvNotifyAck"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
- << ", record# " << record.ShortDebugString());
+ SBR_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
auto it = Subscribers.find(ev->Sender);
if (it == Subscribers.end()) {
@@ -1217,11 +1143,9 @@ private:
void Handle(TSchemeBoardEvents::TEvSyncVersionRequest::TPtr& ev) {
const auto& record = ev->Get()->Record;
- SBR_LOG_D("Handle TSchemeBoardEvents::TEvSyncVersionRequest"
- << ": self# " << SelfId()
- << ", sender# " << ev->Sender
- << ", cookie# " << ev->Cookie
- << ", record# " << record.ShortDebugString());
+ SBR_LOG_D("Handle " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender
+ << ", cookie# " << ev->Cookie);
auto it = Subscribers.find(ev->Sender);
if (it == Subscribers.end()) {
@@ -1330,9 +1254,8 @@ private:
void Handle(TEvInterconnect::TEvNodeDisconnected::TPtr& ev) {
const ui32 nodeId = ev->Get()->NodeId;
- SBR_LOG_D("Handle TEvInterconnect::TEvNodeDisconnected"
- << ": self# " << SelfId()
- << ", nodeId# " << nodeId);
+ SBR_LOG_D("Handle " << ev->Get()->ToString()
+ << ": nodeId# " << nodeId);
auto it = Subscribers.lower_bound(TActorId(nodeId, 0, 0, 0));
while (it != Subscribers.end() && it->first.NodeId() == nodeId) {
diff --git a/ydb/core/tx/scheme_board/subscriber.cpp b/ydb/core/tx/scheme_board/subscriber.cpp
index 70f6909a699..840a842796b 100644
--- a/ydb/core/tx/scheme_board/subscriber.cpp
+++ b/ydb/core/tx/scheme_board/subscriber.cpp
@@ -28,12 +28,12 @@ using EDeletionPolicy = ESchemeBoardSubscriberDeletionPolicy;
namespace NSchemeBoard {
-#define SBS_LOG_T(stream) SB_LOG_T(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "] " << this->SelfId() << " [" << Path << "] " << stream)
-#define SBS_LOG_D(stream) SB_LOG_D(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "] " << this->SelfId() << " [" << Path << "] " << stream)
-#define SBS_LOG_I(stream) SB_LOG_I(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "] " << this->SelfId() << " [" << Path << "] " << stream)
-#define SBS_LOG_N(stream) SB_LOG_N(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "] " << this->SelfId() << " [" << Path << "] " << stream)
-#define SBS_LOG_W(stream) SB_LOG_W(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "] " << this->SelfId() << " [" << Path << "] " << stream)
-#define SBS_LOG_E(stream) SB_LOG_E(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "] " << this->SelfId() << " [" << Path << "] " << stream)
+#define SBS_LOG_T(stream) SB_LOG_T(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "]" << this->SelfId() << "[" << Path << "] " << stream)
+#define SBS_LOG_D(stream) SB_LOG_D(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "]" << this->SelfId() << "[" << Path << "] " << stream)
+#define SBS_LOG_I(stream) SB_LOG_I(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "]" << this->SelfId() << "[" << Path << "] " << stream)
+#define SBS_LOG_N(stream) SB_LOG_N(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "]" << this->SelfId() << "[" << Path << "] " << stream)
+#define SBS_LOG_W(stream) SB_LOG_W(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "]" << this->SelfId() << "[" << Path << "] " << stream)
+#define SBS_LOG_E(stream) SB_LOG_E(SCHEME_BOARD_SUBSCRIBER, "[" << LogPrefix() << "]" << this->SelfId() << "[" << Path << "] " << stream)
namespace {
@@ -225,8 +225,8 @@ namespace {
// it is only because we need to manage undo of upgrade subdomain, finally remove it
- if (Version.PathId == other.DomainId) { //Update from TSS, GSS->TSS
- if (AbandonedSchemeShards.contains(other.Version.PathId.OwnerId)) { //TSS is ignored, present GSS reverted that TSS
+ if (Version.PathId == other.DomainId) { // Update from TSS, GSS->TSS
+ if (AbandonedSchemeShards.contains(other.Version.PathId.OwnerId)) { // TSS is ignored, present GSS reverted that TSS
reason = "Update was ignored, GSS implisytly banned that TSS";
return false;
}
@@ -235,8 +235,8 @@ namespace {
return true;
}
- if (DomainId == other.Version.PathId) { //Update from GSS, TSS->GSS
- if (other.AbandonedSchemeShards.contains(Version.PathId.OwnerId)) { //GSS reverts TSS
+ if (DomainId == other.Version.PathId) { // Update from GSS, TSS->GSS
+ if (other.AbandonedSchemeShards.contains(Version.PathId.OwnerId)) { // GSS reverts TSS
reason = "Path was updated as a replacement from GSS, GSS implicitly reverts TSS";
return true;
}
@@ -294,17 +294,14 @@ class TReplicaSubscriber: public TMonitorableActor<TDerived> {
void Handle(TSchemeBoardEvents::TEvNotify::TPtr& ev) {
auto& record = *ev->Get()->MutableRecord();
- SBS_LOG_D("Handle TSchemeBoardEvents::TEvNotify"
+ SBS_LOG_D("Handle " << ev->Get()->ToString()
<< ": sender# " << ev->Sender);
- SBS_LOG_T("Message:\n" << record.ShortDebugString());
this->Send(ev->Sender, new TSchemeBoardEvents::TEvNotifyAck(record.GetVersion()));
if (!IsValidNotification(Path, record)) {
- SBS_LOG_E("Suspicious notification"
- << ": sender# " << ev->Sender
- << ", other path# " << record.GetPath()
- << ", other pathId# " << TPathId(record.GetPathOwnerId(), record.GetLocalPathId()));
+ SBS_LOG_E("Suspicious " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
return;
}
@@ -312,7 +309,7 @@ class TReplicaSubscriber: public TMonitorableActor<TDerived> {
}
void Handle(TSchemeBoardEvents::TEvSyncVersionRequest::TPtr& ev) {
- SBS_LOG_D("Handle TSchemeBoardEvents::TEvSyncVersionRequest"
+ SBS_LOG_D("Handle " << ev->Get()->ToString()
<< ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
@@ -321,7 +318,7 @@ class TReplicaSubscriber: public TMonitorableActor<TDerived> {
}
void Handle(TSchemeBoardEvents::TEvSyncVersionResponse::TPtr& ev) {
- SBS_LOG_D("Handle TSchemeBoardEvents::TEvSyncVersionResponse"
+ SBS_LOG_D("Handle " << ev->Get()->ToString()
<< ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
@@ -726,15 +723,12 @@ class TSubscriber: public TMonitorableActor<TDerived> {
void Handle(TSchemeBoardEvents::TEvNotify::TPtr& ev) {
auto& record = *ev->Get()->MutableRecord();
- SBS_LOG_D("Handle TSchemeBoardEvents::TEvNotify"
+ SBS_LOG_D("Handle " << ev->Get()->ToString()
<< ": sender# " << ev->Sender);
- SBS_LOG_T("Message:\n" << record.ShortDebugString());
if (!IsValidNotification(Path, record)) {
- SBS_LOG_E("Suspicious notification"
- << ": sender# " << ev->Sender
- << ", other path# " << record.GetPath()
- << ", other pathId# " << TPathId(record.GetPathOwnerId(), record.GetLocalPathId()));
+ SBS_LOG_E("Suspicious " << ev->Get()->ToString()
+ << ": sender# " << ev->Sender);
return;
}
@@ -785,12 +779,12 @@ class TSubscriber: public TMonitorableActor<TDerived> {
}
void Handle(TSchemeBoardEvents::TEvSyncRequest::TPtr& ev) {
- SBS_LOG_D("Handle TSchemeBoardEvents::TEvSyncRequest"
+ SBS_LOG_D("Handle " << ev->Get()->ToString()
<< ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
if (ev->Sender != Owner) {
- SBS_LOG_W("Suspicious sync version request"
+ SBS_LOG_W("Suspicious " << ev->Get()->ToString()
<< ": sender# " << ev->Sender
<< ", owner# " << Owner);
return;
@@ -806,7 +800,7 @@ class TSubscriber: public TMonitorableActor<TDerived> {
}
void Handle(TSchemeBoardEvents::TEvSyncVersionResponse::TPtr& ev) {
- SBS_LOG_D("Handle TSchemeBoardEvents::TEvSyncVersionResponse"
+ SBS_LOG_D("Handle " << ev->Get()->ToString()
<< ": sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
@@ -876,7 +870,7 @@ class TSubscriber: public TMonitorableActor<TDerived> {
}
void Handle(TEvStateStorage::TEvResolveReplicasList::TPtr& ev) {
- SBS_LOG_D("Handle TEvStateStorage::TEvResolveReplicasList");
+ SBS_LOG_D("Handle " << ev->Get()->ToString());
const auto& replicas = ev->Get()->Replicas;