1 Reply Latest reply on Oct 20, 2017 12:07 PM by dharrison

    New node version not being seen in another process that has the same repository

    jeh.sandoval

      We have two process that has exactly the same repository configuration (please see attached). When the first process checks in a new version, the second process cannot see it immediately. However, if the repository was redeployed or the process was restarted, it was able to see it.

       

      I have tested Adding a new node directly and it does not have any problems. Both process can see the changes immediately. Modifications though cannot be seen on the other process.

       

      I suspect the node is being cached but I cannot find any API for invalidation. Anyway, please find additional details below:

       

      Here is the code for checking in:

       

      VersionManager versionManager = session.getWorkspace().getVersionManager();
      Node fileNode = session.getNodeByIdentifier(documentId);
      String fileNodePath = fileNode.getPath();
      versionManager.checkout(fileNodePath);
      Node contentNode = fileNode.getNode("jcr:content");  
      Binary binary = session.getValueFactory().createBinary(content);
      contentNode.setProperty("jcr:data", binary);
      binary.dispose();
      session.save();
      content.close();
      Version newVersion = versionManager.checkin(fileNodePath);
      

       

      And here's for the retrieval:

      if(!StringUtils.isEmpty(documentVersion)){
           Version version = versionManager.getVersionHistory(docNode.getPath()).getVersion(documentVersion);
           versionedNode = version.getFrozenNode();
      }else{
           Version version = versionManager.getBaseVersion(docNode.getPath());
           versionedNode = version.getFrozenNode();
      }
      

       

      According to the VersionHistory in the second process, the base version is still "1.0" and the version history has only two entries, root and base. In the first process, it already has version "1.1".

       

      I am not sure if this is relevant to the issue but I had also confirmed that the jcr:system path of the VersionHistory is identical on both process.