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 1 commit
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 CheckGeneralVersion = 4 [default = true];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я бы инвертировал флаг: CheckTypeSpecificVersion или CheckEntityVersion c default-значением false.
В понимании, что есть схемная сущность со своей версией (entity-version), а есть path, через которую эта сущность становится видима. Path и entity связаны, но не совпадают. У пути своя path-version, включающая entity-version. В общем случае работа с сущностями идёт в терминах путей, проверять надо path-version. И в базовой логике не должно быть никаких сомнений.

Для этого кажется лучше, чтобы флага "проверь общую (или path-version)" не было -- лучше иметь флаг "а сейчас не так как всегда, проверь специфику".

}

message TUpgradeSubDomain {
Expand Down
18 changes: 17 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,23 @@ 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.HasCheckGeneralVersion() && !item.GetCheckGeneralVersion()) {
switch(path.Base()->PathType) {
niksaveliev marked this conversation as resolved.
Show resolved Hide resolved
case NKikimrSchemeOp::EPathTypePersQueueGroup:
actualVersion = pathVersion.GetPQVersion();
break;
default:
actualVersion = pathVersion.GetGeneralVersion();
break;
}
} else {
actualVersion = pathVersion.GetGeneralVersion();
}

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