Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check alter version only for ss applyIf #3823

Merged
Merged
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
1 change: 1 addition & 0 deletions ydb/core/protos/flat_scheme_op.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,7 @@ message TApplyIf {
optional uint64 PathId = 1;
optional uint64 PathVersion = 2;
optional uint64 LockedTxId = 3;
optional bool CheckEntityVersion = 4 [default = false];
}

message TUpgradeSubDomain {
Expand Down
67 changes: 66 additions & 1 deletion ydb/core/tx/schemeshard/schemeshard_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,72 @@ bool TSchemeShard::CheckApplyIf(const NKikimrSchemeOp::TModifyScheme &scheme, TS

if (item.HasPathVersion()) {
const auto requiredVersion = item.GetPathVersion();
const auto actualVersion = GetPathVersion(TPath::Init(pathId, this)).GetGeneralVersion();
arc_ui64 actualVersion;
auto path = TPath::Init(pathId, this);
auto pathVersion = GetPathVersion(path);

if (item.HasCheckEntityVersion() && item.GetCheckEntityVersion()) {
switch(path.Base()->PathType) {
niksaveliev marked this conversation as resolved.
Show resolved Hide resolved
case NKikimrSchemeOp::EPathTypePersQueueGroup:
actualVersion = pathVersion.GetPQVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeSubDomain:
case NKikimrSchemeOp::EPathType::EPathTypeExtSubDomain:
actualVersion = pathVersion.GetSubDomainVersion();
break;
case NKikimrSchemeOp::EPathTypeTable:
actualVersion = pathVersion.GetTableSchemaVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeBlockStoreVolume:
actualVersion = pathVersion.GetBSVVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeFileStore:
actualVersion = pathVersion.GetFileStoreVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeKesus:
actualVersion = pathVersion.GetKesusVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeRtmrVolume:
actualVersion = pathVersion.GetRTMRVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeSolomonVolume:
actualVersion = pathVersion.GetSolomonVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeTableIndex:
actualVersion = pathVersion.GetTableIndexVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeColumnStore:
actualVersion = pathVersion.GetColumnStoreVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeColumnTable:
actualVersion = pathVersion.GetColumnTableVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeCdcStream:
actualVersion = pathVersion.GetCdcStreamVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeSequence:
actualVersion = pathVersion.GetSequenceVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeReplication:
actualVersion = pathVersion.GetReplicationVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeExternalTable:
actualVersion = pathVersion.GetExternalTableVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeExternalDataSource:
actualVersion = pathVersion.GetExternalDataSourceVersion();
break;
case NKikimrSchemeOp::EPathType::EPathTypeView:
actualVersion = pathVersion.GetViewVersion();
break;
default:
actualVersion = pathVersion.GetGeneralVersion();
break;
}
} else {
actualVersion = pathVersion.GetGeneralVersion();
}

if (requiredVersion != actualVersion) {
errStr = TStringBuilder()
<< "fail user constraint in ApplyIf section:"
Expand Down
Loading