-
Notifications
You must be signed in to change notification settings - Fork 598
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
return grandchildren flag #13307
return grandchildren flag #13307
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1170,6 +1170,54 @@ void IncParentDirAlterVersionWithRepublish(const TOperationId& opId, const TPath | |
} | ||
} | ||
|
||
void IncAliveChildrenSafeWithUndo(const TOperationId& opId, const TPath& parentPath, TOperationContext& context, bool isBackup) { | ||
parentPath.Base()->IncAliveChildrenPrivate(isBackup); | ||
if (parentPath.Base()->GetAliveChildren() == 1 && !parentPath.Base()->IsDomainRoot()) { | ||
auto grandParent = parentPath.Parent(); | ||
if (grandParent.Base()->IsLikeDirectory()) { | ||
++grandParent.Base()->DirAlterVersion; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Как я понял в случае изменения |
||
context.MemChanges.GrabPath(context.SS, grandParent.Base()->PathId); | ||
context.DbChanges.PersistPath(grandParent.Base()->PathId); | ||
} | ||
|
||
if (grandParent.IsActive()) { | ||
context.SS->ClearDescribePathCaches(grandParent.Base()); | ||
context.OnComplete.PublishToSchemeBoard(opId, grandParent->PathId); | ||
} | ||
} | ||
} | ||
|
||
void IncAliveChildrenDirect(const TOperationId& opId, const TPath& parentPath, TOperationContext& context, bool isBackup) { | ||
parentPath.Base()->IncAliveChildrenPrivate(isBackup); | ||
if (parentPath.Base()->GetAliveChildren() == 1 && !parentPath.Base()->IsDomainRoot()) { | ||
auto grandParent = parentPath.Parent(); | ||
if (grandParent.Base()->IsLikeDirectory()) { | ||
++grandParent.Base()->DirAlterVersion; | ||
NIceDb::TNiceDb db(context.GetDB()); | ||
context.SS->PersistPathDirAlterVersion(db, grandParent.Base()); | ||
} | ||
|
||
if (grandParent.IsActive()) { | ||
context.SS->ClearDescribePathCaches(grandParent.Base()); | ||
context.OnComplete.PublishToSchemeBoard(opId, grandParent->PathId); | ||
} | ||
} | ||
} | ||
|
||
void DecAliveChildrenDirect(const TOperationId& opId, TPathElement::TPtr parentPath, TOperationContext& context, bool isBackup) { | ||
parentPath->DecAliveChildrenPrivate(isBackup); | ||
if (parentPath->GetAliveChildren() == 0 && !parentPath->IsDomainRoot()) { | ||
auto grandParentDir = context.SS->PathsById.at(parentPath->ParentPathId); | ||
if (grandParentDir->IsLikeDirectory()) { | ||
++grandParentDir->DirAlterVersion; | ||
NIceDb::TNiceDb db(context.GetDB()); | ||
context.SS->PersistPathDirAlterVersion(db, grandParentDir); | ||
context.SS->ClearDescribePathCaches(grandParentDir); | ||
context.OnComplete.PublishToSchemeBoard(opId, grandParentDir->PathId); | ||
} | ||
} | ||
} | ||
|
||
NKikimrSchemeOp::TModifyScheme MoveTableTask(NKikimr::NSchemeShard::TPath& src, NKikimr::NSchemeShard::TPath& dst) { | ||
NKikimrSchemeOp::TModifyScheme scheme; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это не будет работать, потому что при добавлении потомка мы публикуем родителя, но не прародителя. Так например добавляем в директории A директорию B, на директории B у A будет ChildrenExist==false, но при добавлении потомка в директории B директория A останется в кешах и не обновится, в итоге флаг будет неправильный.