Browse Source

Added point to msku_uploader to trace skus

ayakshibaeva 1 year ago
parent
commit
4c7fae3970

+ 14 - 4
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)

+ 6 - 2
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);
 

+ 1 - 0
yt/yt/core/ytree/yson_struct-inl.h

@@ -379,6 +379,7 @@ void UpdateYsonStructField(TIntrusivePtr<TDst>& dst, const TIntrusivePtr<TSrc>&
 #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) \

+ 4 - 1
yt/yt/core/ytree/yson_struct.h

@@ -341,7 +341,7 @@ void UpdateYsonStructField(TIntrusivePtr<TDst>& dst, const TIntrusivePtr<TSrc>&
 #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<TDst>& dst, const TIntrusivePtr<TSrc>&
 //! 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)