Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-8393

Simplify use of DocumentNodeStore without OSGi

    XMLWordPrintableJSON

    Details

    • Type: Wish
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.12.0
    • Fix Version/s: None
    • Component/s: documentmk
    • Labels:
      None

      Description

      Hi,

      I've been working with Oak using SegmentNodeStore without problems on transient repos.

      Recently I have the requirement to set up a persistent repository on PGSQL. This is the snippet:

       

      PlatformDBSM dbms = ctx.getBean(PlatformDBSM.class);
      RDBOptions options = new RDBOptions().dropTablesOnClose(false).tablePrefix("oak_");
      DocumentNodeStore ns = RDBDocumentNodeStoreBuilder.newRDBDocumentNodeStoreBuilder()
      .setRDBConnection(dbms.getDataSource(), options)
      .build();
      Repository repo = new Jcr(new Oak(ns)).createRepository();
      

      When the tables are not present in the database Oak will create them correctly and the repo works ok. However if I run this code for a second time it will crash because it is always forcing a reindex for some reason, and it either complaints about node types definitions not being consistent or conflicts:

      r16b2e65a3ef-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 9:/oak:index/nodetype/:index/rep%3AChildNodeDefinitions/jcr:system/jcr:nodeTypes/rep:NodeType/rep:namedChildNodeDefinitions/rep:namedChildNodeDefinitions was already added in revision
      r16b2de339a5-0-1 (older than base r16b2e6567db-0-1,r16b2e4bae94-0-2), before
      r16b2e65a3ef-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 9:/oak:index/nodetype/:index/rep%3AChildNodeDefinitions/jcr:system/jcr:nodeTypes/rep:NodeType/rep:namedChildNodeDefinitions/jcr:childNodeDefinition was already added in revision
      r16b2de339a5-0-1 (older than base r16b2e6567db-0-1,r16b2e4bae94-0-2), before
      r16b2e65a3ef-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 9:/oak:index/nodetype/:index/rep%3AChildNodeDefinitions/jcr:system/jcr:nodeTypes/rep:NodeType/rep:namedChildNodeDefinitions/jcr:propertyDefinition was already added in revision
      r16b2de339a5-0-1 (older than base r16b2e6567db-0-1,r16b2e4bae94-0-2), before
      r16b2e65a3ef-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 7:/oak:index/nodetype/:index/rep%3AChildNodeDefinitions/jcr:system/jcr:nodeTypes/rep:root was already added in revision
      r16b2de339a5-0-1 (older than base r16b2e6567db-0-1,r16b2e4bae94-0-2), before
      r16b2e65a3ef-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 8:/oak:index/nodetype/:index/rep%3AChildNodeDefinitions/jcr:system/jcr:nodeTypes/rep:root/rep:residualChildNodeDefinitions was already added in revision
      r16b2de339a5-0-1 (older than base r16b2e6567db-0-1,r16b2e4bae94-0-2), before
      r16b2e65a3ef-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 8:/oak:index/nodetype/:index/rep%3AChildNodeDefinitions/jcr:system/jcr:nodeTypes/rep:root/rep:namedChildNodeDefinitions was already added in revision
      r16b2de339a5-0-1 (older than base r16b2e6567db-0-1,r16b2e4bae94-0-2), before
      r16b2e65a3ef-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 9:/oak:index/nodetype/:index/rep%3AChildNodeDefinitions/jcr:system/jcr:nodeTypes/rep:root/rep:namedChildNodeDefinitions/jcr:system was already added in revision
      r16b2de339a5-0-1 (older than base r16b2e6567db-0-1,r16b2e4bae94-0-2), before
      r16b2e65a3ef-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 2:/oak:index/counter was already added in revision
      r16b2de339a5-0-1 (older than base r16b2e6567db-0-1,r16b2e4bae94-0-2), before
      r16b2e65a3ef-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 2:/oak:index/uuid was already added in revision
      r16b2de339a5-0-1 (older than base r16b2e6567db-0-1,r16b2e4bae94-0-2), before
      r16b2e65a3ef-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 3:/oak:index/uuid/:index was already added in revision
      r16b2de3b67f-0-1 (older than base r16b2e6567db-0-1,r16b2e4bae94-0-2), before
      r16b2e65a3ef-0-1]
      at org.apache.jackrabbit.oak.plugins.document.Commit.checkConflicts(Commit.java:640)
      at org.apache.jackrabbit.oak.plugins.document.Commit.applyToDocumentStore(Commit.java:366)
      at org.apache.jackrabbit.oak.plugins.document.Commit.applyToDocumentStoreWithTiming(Commit.java:280)
      at org.apache.jackrabbit.oak.plugins.document.Commit.applyToDocumentStore(Commit.java:264)
      at org.apache.jackrabbit.oak.plugins.document.Commit.applyInternal(Commit.java:232)
      at org.apache.jackrabbit.oak.plugins.document.Commit.apply(Commit.java:220)
      at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.persist(DocumentNodeStoreBranch.java:318)
      at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.persist(DocumentNodeStoreBranch.java:282)
      at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.access$500(DocumentNodeStoreBranch.java:56)
      at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$InMemory.merge(DocumentNodeStoreBranch.java:546)
      at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge0(DocumentNodeStoreBranch.java:196)
      ... 36 common frames omitted
      

      It also happens on a newly created repo when trying to connect to it (run the code) for a second time.

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mlara Manuel Lara
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: