From 4c7fae39703d4abd345a501f40486697ade6f2cc Mon Sep 17 00:00:00 2001 From: ayakshibaeva Date: Fri, 19 Jan 2024 18:00:13 +0300 Subject: Added point to msku_uploader to trace skus --- yt/yt/client/chaos_client/replication_card.cpp | 18 ++++++++++++++---- yt/yt/client/chaos_client/replication_card.h | 8 ++++++-- yt/yt/core/ytree/yson_struct-inl.h | 1 + yt/yt/core/ytree/yson_struct.h | 5 ++++- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/yt/yt/client/chaos_client/replication_card.cpp b/yt/yt/client/chaos_client/replication_card.cpp index a32919b5256..3f58b6d74f9 100644 --- a/yt/yt/client/chaos_client/replication_card.cpp +++ b/yt/yt/client/chaos_client/replication_card.cpp @@ -208,6 +208,11 @@ void TReplicaHistoryItem::Persist(const TStreamPersistenceContext& context) Persist(context, State); } +bool TReplicaHistoryItem::IsSync() const +{ + return Mode == ETableReplicaMode::Sync && State == ETableReplicaState::Enabled; +} + //////////////////////////////////////////////////////////////////////////////// int TReplicaInfo::FindHistoryItemIndex(TTimestamp timestamp) const @@ -243,9 +248,11 @@ TReplicaInfo* TReplicationCard::GetReplicaOrThrow(TReplicaId replicaId, TReplica //////////////////////////////////////////////////////////////////////////////// -bool IsReplicaSync(ETableReplicaMode mode) +bool IsReplicaSync(ETableReplicaMode mode, const TReplicaHistoryItem& lastReplicaHistoryItem) { - return mode == ETableReplicaMode::Sync || mode == ETableReplicaMode::SyncToAsync; + // Check actual replica state to avoid merging transition states (e.g. AsyncToSync -> SyncToAsync) + return mode == ETableReplicaMode::Sync || + (mode == ETableReplicaMode::SyncToAsync && lastReplicaHistoryItem.IsSync()); } bool IsReplicaAsync(ETableReplicaMode mode) @@ -263,9 +270,12 @@ bool IsReplicaDisabled(ETableReplicaState state) return state == ETableReplicaState::Disabled || state == ETableReplicaState::Enabling; } -bool IsReplicaReallySync(ETableReplicaMode mode, ETableReplicaState state) +bool IsReplicaReallySync( + ETableReplicaMode mode, + ETableReplicaState state, + const TReplicaHistoryItem& lastReplicaHistoryItem) { - return IsReplicaSync(mode) && IsReplicaEnabled(state); + return IsReplicaSync(mode, lastReplicaHistoryItem) && IsReplicaEnabled(state); } ETableReplicaMode GetTargetReplicaMode(ETableReplicaMode mode) diff --git a/yt/yt/client/chaos_client/replication_card.h b/yt/yt/client/chaos_client/replication_card.h index 992815a7d2b..43f424567eb 100644 --- a/yt/yt/client/chaos_client/replication_card.h +++ b/yt/yt/client/chaos_client/replication_card.h @@ -35,6 +35,7 @@ struct TReplicaHistoryItem NTabletClient::ETableReplicaMode Mode; NTabletClient::ETableReplicaState State; + bool IsSync() const; void Persist(const TStreamPersistenceContext& context); }; @@ -125,11 +126,14 @@ TString ToString( //////////////////////////////////////////////////////////////////////////////// -bool IsReplicaSync(NTabletClient::ETableReplicaMode mode); +bool IsReplicaSync(NTabletClient::ETableReplicaMode mode, const TReplicaHistoryItem& lastReplicaHistoryItem); bool IsReplicaAsync(NTabletClient::ETableReplicaMode mode); bool IsReplicaEnabled(NTabletClient::ETableReplicaState state); bool IsReplicaDisabled(NTabletClient::ETableReplicaState state); -bool IsReplicaReallySync(NTabletClient::ETableReplicaMode mode, NTabletClient::ETableReplicaState state); +bool IsReplicaReallySync( + NTabletClient::ETableReplicaMode mode, + NTabletClient::ETableReplicaState state, + const TReplicaHistoryItem& lastReplicaHistoryItem); NTabletClient::ETableReplicaMode GetTargetReplicaMode(NTabletClient::ETableReplicaMode mode); NTabletClient::ETableReplicaState GetTargetReplicaState(NTabletClient::ETableReplicaState state); diff --git a/yt/yt/core/ytree/yson_struct-inl.h b/yt/yt/core/ytree/yson_struct-inl.h index 4c69240d4d7..1b864cd8c25 100644 --- a/yt/yt/core/ytree/yson_struct-inl.h +++ b/yt/yt/core/ytree/yson_struct-inl.h @@ -379,6 +379,7 @@ void UpdateYsonStructField(TIntrusivePtr& dst, const TIntrusivePtr& #undef DECLARE_YSON_STRUCT_LITE #undef REGISTER_YSON_STRUCT_LITE #undef DEFINE_YSON_STRUCT +#undef DEFINE_YSON_STRUCT_LITE #undef REGISTER_EXTERNALIZED_YSON_STRUCT #define YSON_STRUCT_IMPL__DECLARE_ALIASES(TStruct) \ diff --git a/yt/yt/core/ytree/yson_struct.h b/yt/yt/core/ytree/yson_struct.h index 97fa767e1db..41b93142f6c 100644 --- a/yt/yt/core/ytree/yson_struct.h +++ b/yt/yt/core/ytree/yson_struct.h @@ -341,7 +341,7 @@ void UpdateYsonStructField(TIntrusivePtr& dst, const TIntrusivePtr& #define REGISTER_YSON_STRUCT(TStruct) //! Declare non-ref-counted Yson Struct auxiliary methods and fields. Must be -//! supplemented by DEFINE_YSON_STRUCT. +//! supplemented by DEFINE_YSON_STRUCT_LITE. #define DECLARE_YSON_STRUCT_LITE(TStruct) //! Declare non-ref-counted Yson Struct auxiliary methods and define them inplace. @@ -350,6 +350,9 @@ void UpdateYsonStructField(TIntrusivePtr& dst, const TIntrusivePtr& //! Define Yson Struct auxiliary methods out of class. #define DEFINE_YSON_STRUCT(TStruct) +//! Define non-ref-counted Yson Struct auxiliary methods out of class. +#define DEFINE_YSON_STRUCT_LITE(TStruct) + //! Define non-ref-counted Yson external serializer methods and fields. #define REGISTER_EXTERNALIZED_YSON_STRUCT(TStruct, TSerializer) -- cgit v1.3