Skip to content

Commit 732d750

Browse files
authored
Merge 85c3275 into 2ed4009
2 parents 2ed4009 + 85c3275 commit 732d750

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

ydb/core/protos/flat_scheme_op.proto

+1
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,7 @@ message TApplyIf {
15591559
optional uint64 PathId = 1;
15601560
optional uint64 PathVersion = 2;
15611561
optional uint64 LockedTxId = 3;
1562+
optional bool CheckEntityVersion = 4 [default = false];
15621563
}
15631564

15641565
message TUpgradeSubDomain {

ydb/core/tx/schemeshard/schemeshard_impl.cpp

+66-1
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,72 @@ bool TSchemeShard::CheckApplyIf(const NKikimrSchemeOp::TModifyScheme &scheme, TS
12391239

12401240
if (item.HasPathVersion()) {
12411241
const auto requiredVersion = item.GetPathVersion();
1242-
const auto actualVersion = GetPathVersion(TPath::Init(pathId, this)).GetGeneralVersion();
1242+
arc_ui64 actualVersion;
1243+
auto path = TPath::Init(pathId, this);
1244+
auto pathVersion = GetPathVersion(path);
1245+
1246+
if (item.HasCheckEntityVersion() && item.GetCheckEntityVersion()) {
1247+
switch(path.Base()->PathType) {
1248+
case NKikimrSchemeOp::EPathTypePersQueueGroup:
1249+
actualVersion = pathVersion.GetPQVersion();
1250+
break;
1251+
case NKikimrSchemeOp::EPathType::EPathTypeSubDomain:
1252+
case NKikimrSchemeOp::EPathType::EPathTypeExtSubDomain:
1253+
actualVersion = pathVersion.GetSubDomainVersion();
1254+
break;
1255+
case NKikimrSchemeOp::EPathTypeTable:
1256+
actualVersion = pathVersion.GetTableSchemaVersion();
1257+
break;
1258+
case NKikimrSchemeOp::EPathType::EPathTypeBlockStoreVolume:
1259+
actualVersion = pathVersion.GetBSVVersion();
1260+
break;
1261+
case NKikimrSchemeOp::EPathType::EPathTypeFileStore:
1262+
actualVersion = pathVersion.GetFileStoreVersion();
1263+
break;
1264+
case NKikimrSchemeOp::EPathType::EPathTypeKesus:
1265+
actualVersion = pathVersion.GetKesusVersion();
1266+
break;
1267+
case NKikimrSchemeOp::EPathType::EPathTypeRtmrVolume:
1268+
actualVersion = pathVersion.GetRTMRVersion();
1269+
break;
1270+
case NKikimrSchemeOp::EPathType::EPathTypeSolomonVolume:
1271+
actualVersion = pathVersion.GetSolomonVersion();
1272+
break;
1273+
case NKikimrSchemeOp::EPathType::EPathTypeTableIndex:
1274+
actualVersion = pathVersion.GetTableIndexVersion();
1275+
break;
1276+
case NKikimrSchemeOp::EPathType::EPathTypeColumnStore:
1277+
actualVersion = pathVersion.GetColumnStoreVersion();
1278+
break;
1279+
case NKikimrSchemeOp::EPathType::EPathTypeColumnTable:
1280+
actualVersion = pathVersion.GetColumnTableVersion();
1281+
break;
1282+
case NKikimrSchemeOp::EPathType::EPathTypeCdcStream:
1283+
actualVersion = pathVersion.GetCdcStreamVersion();
1284+
break;
1285+
case NKikimrSchemeOp::EPathType::EPathTypeSequence:
1286+
actualVersion = pathVersion.GetSequenceVersion();
1287+
break;
1288+
case NKikimrSchemeOp::EPathType::EPathTypeReplication:
1289+
actualVersion = pathVersion.GetReplicationVersion();
1290+
break;
1291+
case NKikimrSchemeOp::EPathType::EPathTypeExternalTable:
1292+
actualVersion = pathVersion.GetExternalTableVersion();
1293+
break;
1294+
case NKikimrSchemeOp::EPathType::EPathTypeExternalDataSource:
1295+
actualVersion = pathVersion.GetExternalDataSourceVersion();
1296+
break;
1297+
case NKikimrSchemeOp::EPathType::EPathTypeView:
1298+
actualVersion = pathVersion.GetViewVersion();
1299+
break;
1300+
default:
1301+
actualVersion = pathVersion.GetGeneralVersion();
1302+
break;
1303+
}
1304+
} else {
1305+
actualVersion = pathVersion.GetGeneralVersion();
1306+
}
1307+
12431308
if (requiredVersion != actualVersion) {
12441309
errStr = TStringBuilder()
12451310
<< "fail user constraint in ApplyIf section:"

0 commit comments

Comments
 (0)