[ 
https://issues.apache.org/jira/browse/OAK-8393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16861064#comment-16861064
 ] 

Marcel Reutegger commented on OAK-8393:
---------------------------------------

It most likely means the repository is not shut down properly and the first 
startup created the initial nodes, committed them, but they are not yet visible 
to the second repository instance.

Are you shutting down the node store with {{DocumentNodeStore.dispose()}}?

If you are using a DocumentNodeStore and not running in an OSGi container, then 
you also have to take care of some background jobs that need to be running. See 
the registration methods here: 
https://github.com/apache/jackrabbit-oak/blob/jackrabbit-oak-1.14.0/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java#L363-L365

More specifically, the LastRevRecoveryJob takes care of a crashed or 
non-gracefully shutdown DocumentNodeStore.

> Oak won't work on PGSQL, keeps reindexing and fails
> ---------------------------------------------------
>
>                 Key: OAK-8393
>                 URL: https://issues.apache.org/jira/browse/OAK-8393
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>    Affects Versions: 1.12.0
>            Reporter: Manuel Lara
>            Priority: Blocker
>
> 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:
>  
> {code:java}
> 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();
> {code}
> 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:
> {code:java}
> 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
> {code}
> It also happens on a newly created repo when trying to connect to it (run the 
> code) for a second time.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to