Jackrabbit conflict during the restart of the repository

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Jackrabbit conflict during the restart of the repository

gabriele
I have a problem while re-starting the repository oak

Environment:
Jackrabbit Oak 1.6.1
RDBDocumentStore instantiated for database PostgreSQL 9.5.6 (9.5), using driver: PostgreSQL Native Driver PostgreSQL 9.4 JDBC4 (build 1204) (9.4),
Without using sling/felix/spring

This is my test:


        public void testModel() {
        try {
              Assert.assertEquals(createDataNode(),true);  //step1
              Assert.assertEquals(createDataNode(),false); //step2
        } catch (Exception e){
            fail(e.getMessage());
        }
    }

    private boolean createDataNode() throws Exception {
        boolean result = false;
        InitialContext ctx = new InitialContext();
        Object dataSource = ctx.lookup("jdbc/modules");
        final javax.sql.DataSource ds = (javax.sql.DataSource) dataSource;
       
        RDBOptions options = new RDBOptions();
        options.tablePrefix("JCR_");
        DocumentMK.Builder builder = new DocumentMK.Builder();
        builder.setRDBConnection(ds,options);
                   
        DocumentNodeStore nodeStore = builder.getNodeStore();
        Jcr jcr = new Jcr(nodeStore);
        jcr.with( new OpenSecurityProvider());
        Repository repository = jcr.createRepository();
        Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
        Node root = session.getRootNode();
        if (!root.hasNode("data")) {
            root.addNode( "root", JcrConstants.NT_FOLDER);
            result = true;
            session.save();
        }
        session.logout();
        ((JackrabbitRepository)repository).shutdown();
        nodeStore.dispose();
        return result;
    }




Step1: it works correctly
Step2: instead when creating the repository I get conflict problems.

Log:

org.apache.jackrabbit.oak.api.CommitFailedException: OakMerge0004: OakMerge0004: Following exceptions occurred during the bulk update operations: [org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 1:/jcr:system was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 2:/jcr:system/rep:namespaces was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 3:/jcr:system/rep:namespaces/rep:nsdata was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 2:/jcr:system/rep:documentStore was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 3:/jcr:system/rep:documentStore/bundlor was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 4:/jcr:system/rep:documentStore/bundlor/nt:file was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 2:/jcr:system/jcr:activities was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 2:/jcr:system/jcr:versionStorage was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 2:/jcr:system/jcr:nodeTypes was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 3:/jcr:system/jcr:nodeTypes/rep:Unstructured was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 4:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:namedPropertyDefinitions was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 5:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:namedPropertyDefinitions/rep:mixinTypes was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 6:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:namedPropertyDefinitions/rep:mixinTypes/NAMES was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 5:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:namedPropertyDefinitions/rep:primaryType was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 6:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:namedPropertyDefinitions/rep:primaryType/NAME was already added in revision
r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
r15bf40435e1-0-1, org.apache.jackrabbit.oak.plugins.document.ConflictException: The node 4:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:residualChildNodeDefinitions was already added in revision


 I want to solve this problem, please can you help me?




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jackrabbit conflict during the restart of the repository

Clay Ferguson
I'm not familiar with this part of oak but, check these links:

line 468 is a hint:
https://apache.googlesource.com/jackrabbit-oak/+/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java

https://issues.apache.org/jira/browse/OAK-3733

https://issues.apache.org/jira/browse/OAK-3400


Best regards,
Clay Ferguson
[hidden email]


On Wed, May 10, 2017 at 4:19 PM, gabriele <[hidden email]>
wrote:

> I have a problem while re-starting the repository oak
>
> Environment:
> Jackrabbit Oak 1.6.1
> RDBDocumentStore instantiated for database PostgreSQL 9.5.6 (9.5), using
> driver: PostgreSQL Native Driver PostgreSQL 9.4 JDBC4 (build 1204) (9.4),
> Without using sling/felix/spring
>
> This is my test:
>
>
>         public void testModel() {
>         try {
>               Assert.assertEquals(createDataNode(),true);  //step1
>               Assert.assertEquals(createDataNode(),false); //step2
>         } catch (Exception e){
>             fail(e.getMessage());
>         }
>     }
>
>     private boolean createDataNode() throws Exception {
>         boolean result = false;
>         InitialContext ctx = new InitialContext();
>         Object dataSource = ctx.lookup("jdbc/modules");
>         final javax.sql.DataSource ds = (javax.sql.DataSource) dataSource;
>
>         RDBOptions options = new RDBOptions();
>         options.tablePrefix("JCR_");
>         DocumentMK.Builder builder = new DocumentMK.Builder();
>         builder.setRDBConnection(ds,options);
>
>         DocumentNodeStore nodeStore = builder.getNodeStore();
>         Jcr jcr = new Jcr(nodeStore);
>         jcr.with( new OpenSecurityProvider());
>         Repository repository = jcr.createRepository();
>         Session session = repository.login(new SimpleCredentials("admin",
> "admin".toCharArray()));
>         Node root = session.getRootNode();
>         if (!root.hasNode("data")) {
>             root.addNode( "root", JcrConstants.NT_FOLDER);
>             result = true;
>             session.save();
>         }
>         session.logout();
>         ((JackrabbitRepository)repository).shutdown();
>         nodeStore.dispose();
>         return result;
>     }
>
>
>
>
> Step1: it works correctly
> Step2: instead when creating the repository I get conflict problems.
>
> Log:
>
> org.apache.jackrabbit.oak.api.CommitFailedException: OakMerge0004:
> OakMerge0004: Following exceptions occurred during the bulk update
> operations: [org.apache.jackrabbit.oak.plugins.document.ConflictException:
> The node 1:/jcr:system was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 2:/jcr:system/rep:namespaces was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 3:/jcr:system/rep:namespaces/rep:nsdata was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 2:/jcr:system/rep:documentStore was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 3:/jcr:system/rep:documentStore/bundlor was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 4:/jcr:system/rep:documentStore/bundlor/nt:file was already added in
> revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 2:/jcr:system/jcr:activities was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 2:/jcr:system/jcr:versionStorage was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 2:/jcr:system/jcr:nodeTypes was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 3:/jcr:system/jcr:nodeTypes/rep:Unstructured was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 4:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:namedPropertyDefinitions
> was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 5:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:
> namedPropertyDefinitions/rep:mixinTypes
> was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 6:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:
> namedPropertyDefinitions/rep:mixinTypes/NAMES
> was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 5:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:
> namedPropertyDefinitions/rep:primaryType
> was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 6:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:
> namedPropertyDefinitions/rep:primaryType/NAME
> was already added in revision
> r15bf3f33640-0-1 (older than base r15bf3f61336-0-1), before
> r15bf40435e1-0-1,
> org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
> 4:/jcr:system/jcr:nodeTypes/rep:Unstructured/rep:
> residualChildNodeDefinitions
> was already added in revision
>
>
>  I want to solve this problem, please can you help me?
>
>
>
>
>
>
>
>
> --
> View this message in context: http://jackrabbit.510166.n4.
> nabble.com/Jackrabbit-conflict-during-the-restart-
> of-the-repository-tp4666842.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
Loading...