Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions ydb/core/blobstorage/dsproxy/dsproxy_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<decltype(*val)>;
if (!val) {
return "<nullopt>";
} else {
if constexpr(std::is_same_v<T, ui64>) {
return IntToString<10>(*val);
}
if constexpr(std::is_same_v<T, TBlobStorageGroupInfo::EEncryptionMode>) {
return TBlobStorageGroupInfo::PrintEncryptionMode(*val);
}
if constexpr(std::is_same_v<T, TBlobStorageGroupInfo::ELifeCyclePhase>) {
return TBlobStorageGroupInfo::PrintLifeCyclePhase(*val);
}
// we don't want to print CypherKey value!
return "<value>";
}
};

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();
Expand Down
3 changes: 3 additions & 0 deletions ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
30 changes: 30 additions & 0 deletions ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading