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

createBranch does not push root node from master to branchId #8697

Closed
ComLock opened this issue Mar 8, 2021 · 5 comments
Closed

createBranch does not push root node from master to branchId #8697

ComLock opened this issue Mar 8, 2021 · 5 comments
Assignees
Labels
Projects
Milestone

Comments

@ComLock
Copy link
Member

ComLock commented Mar 8, 2021

When you create a repo, the master branch will be created with a root node.
https://repo.enonic.com/public/com/enonic/xp/docs/7.6.0/docs-7.6.0-libdoc.zip!/module-repo.html#.create

When you create a branch, the root node is not pushed from the master branch unto the branchId
https://repo.enonic.com/public/com/enonic/xp/docs/7.6.0/docs-7.6.0-libdoc.zip!/module-repo.html#.createBranch

When you later try to make a node in the branch, you will get an error because the root path does not exist...

com.enonic.xp.node.NodeNotFoundException: Node with path [/] found in path-cache but not in storage

@rymsha rymsha added the To Be Discussed Issues that require additional discussion label Mar 8, 2021
@rymsha rymsha assigned rymsha and unassigned alansemenov Mar 8, 2021
@rymsha
Copy link
Contributor

rymsha commented Jul 30, 2021

This would be breaking if we start doing that, because all existing developer's code will start failing with NodeAlreadyExistAtPathException.
Possible solution: silently ignore attempts to create root node in any branch and make branch creation code responsible to magically assosiate the root node with a branch.

@rymsha
Copy link
Contributor

rymsha commented Aug 6, 2021

According to the code root node is always pushed immediately into a created branch.

So, I need an example code, that demonstrates the bug

@rymsha rymsha added Bug and removed To Be Discussed Issues that require additional discussion labels Aug 6, 2021
@rymsha rymsha added this to Needs triage in Bugs via automation Aug 6, 2021
@rymsha rymsha moved this from Needs triage to Low priority in Bugs Aug 6, 2021
@rymsha rymsha assigned vbradnitski and unassigned rymsha Nov 15, 2021
@rymsha
Copy link
Contributor

rymsha commented Nov 18, 2021

could it be related to #9205 ?

@vbradnitski
Copy link
Contributor

vbradnitski commented Nov 22, 2021

Can't reproduce it in master and 7.6.2 with the following code:

    repoLib.createBranch({repoId:'com.enonic.cms.default', branchId:'myBranch'});

    var nodeConnect = nodeLib.connect({
        repoId: 'com.enonic.cms.default',
        branch: 'myBranch'
    });

    nodeConnect.create({
        _name: "myNode",
        _parentPath: "/",
        displayName: "This is brand new node",
        someData: {
            cars: [
                "skoda", "tesla model X"
            ],
            likes: "plywood",
            numberOfUselessGadgets: 123
        }
    });

Most likely it was reproduced in a cluster environment, so an additional 'refresh' operation has been added to improve this case (for master and 7.8 branches).

@ComLock

@rymsha rymsha added this to the 7.8.0 milestone Nov 22, 2021
@rymsha rymsha moved this from Low priority to Closed in Bugs Nov 22, 2021
@rymsha
Copy link
Contributor

rymsha commented Nov 22, 2021

We haven't managed to reproduce the problem. Maybe it happens on cluster environments only?

We added extra index refresh. It slows down branch creation a bit, and guarantees that root node existence is newly created branch is visible for sequential node.create calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Bugs
Closed
Development

No branches or pull requests

4 participants