diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp index 94355010fad2..baeed30ddbe0 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp @@ -122,10 +122,33 @@ namespace NKikimr { Send(MonActor, new TEvBlobStorage::TEvConfigureProxy(Info, nullptr)); if (Info) { - Y_ABORT_UNLESS(!EncryptionMode || *EncryptionMode == Info->GetEncryptionMode()); - Y_ABORT_UNLESS(!LifeCyclePhase || *LifeCyclePhase == Info->GetLifeCyclePhase()); - Y_ABORT_UNLESS(!GroupKeyNonce || *GroupKeyNonce == Info->GetGroupKeyNonce()); - Y_ABORT_UNLESS(!CypherKey || *CypherKey == *Info->GetCypherKey()); + auto printOptional = [&](const auto& val) -> TString { + using T = std::decay_t; + if (!val) { + return ""; + } else { + if constexpr(std::is_same_v) { + return IntToString<10>(*val); + } + if constexpr(std::is_same_v) { + return TBlobStorageGroupInfo::PrintEncryptionMode(*val); + } + if constexpr(std::is_same_v) { + return TBlobStorageGroupInfo::PrintLifeCyclePhase(*val); + } + // we don't want to print CypherKey value! + return ""; + } + }; + + Y_VERIFY_S(!EncryptionMode || *EncryptionMode == Info->GetEncryptionMode(), + "EncryptionMode# " << printOptional(EncryptionMode) << " Info# " << Info->ToString()); + Y_VERIFY_S(!LifeCyclePhase || *LifeCyclePhase == Info->GetLifeCyclePhase(), + "LifeCyclePhase# " << printOptional(LifeCyclePhase) << " Info# " << Info->ToString()); + Y_VERIFY_S(!GroupKeyNonce || *GroupKeyNonce == Info->GetGroupKeyNonce(), + "GroupKeyNonce# " << printOptional(GroupKeyNonce) << " Info# " << Info->ToString()); + Y_VERIFY_S(!CypherKey || *CypherKey == *Info->GetCypherKey(), + "CypherKey# " << printOptional(CypherKey) << " Info# " << Info->ToString()); EncryptionMode = Info->GetEncryptionMode(); LifeCyclePhase = Info->GetLifeCyclePhase(); GroupKeyNonce = Info->GetGroupKeyNonce(); diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp index 1b1026b730ba..d0e8423a93ff 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp @@ -977,6 +977,9 @@ TString TBlobStorageGroupInfo::ToString() const { str << " GroupGeneration# " << GroupGeneration; str << " Type# " << Type.ToString(); str << " SizeInUnits# " << GroupSizeInUnits; + str << " EncryptionMode# " << PrintEncryptionMode(EncryptionMode) << Endl; + str << " LifeCyclePhase# " << PrintLifeCyclePhase(LifeCyclePhase) << Endl; + str << " GroupKeyNonce# " << GroupKeyNonce << Endl; str << " FailRealms# {"; for (ui32 realmIdx = 0; realmIdx < Topology->FailRealms.size(); ++realmIdx) { const TFailRealm& realm = Topology->FailRealms[realmIdx]; diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h index e8fecd4f7090..fdae6df7131e 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h @@ -106,6 +106,15 @@ class TBlobStorageGroupInfo : public TThrRefBase { EEM_ENC_V1 = 1 // Encryption at proxy level, no MAC, no CRC }; + static TString PrintEncryptionMode(EEncryptionMode mode) { + switch (mode) { + case EEncryptionMode::EEM_NONE: + return "NONE"; + case EEncryptionMode::EEM_ENC_V1: + return "ENC_V1"; + } + } + // INITIAL upon group creation in base and in memory // PROPOSE comes from the node warden when it proposes after getting INITIAL // INITIAL -> IN_TRANSITION in memory state from transaction start to transaction end @@ -121,6 +130,27 @@ class TBlobStorageGroupInfo : public TThrRefBase { ELCP_KEY_NOT_LOADED = 703, }; + static TString PrintLifeCyclePhase(ELifeCyclePhase phase) { + switch (phase) { + case ELifeCyclePhase::ELCP_INITIAL: + return "INITIAL"; + case ELifeCyclePhase::ELCP_PROPOSE: + return "PROPOSE"; + case ELifeCyclePhase::ELCP_IN_TRANSITION: + return "IN_TRANSITION"; + case ELifeCyclePhase::ELCP_IN_USE: + return "IN_USE"; + case ELifeCyclePhase::ELCP_KEY_CRC_ERROR: + return "KEY_CRC_ERROR"; + case ELifeCyclePhase::ELCP_KEY_VERSION_ERROR: + return "KEY_VERSION_ERROR"; + case ELifeCyclePhase::ELCP_KEY_ID_ERROR: + return "KEY_ID_ERROR"; + case ELifeCyclePhase::ELCP_KEY_NOT_LOADED: + return "KEY_NOT_LOADED"; + } + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SUBSET HELPER CLASSES ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////