You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Markus Nolte (Jira)" <ji...@apache.org> on 2022/04/06 16:22:00 UTC

[jira] [Commented] (OAK-8917) Thousands ConflitException on .createRepository()

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

Markus Nolte commented on OAK-8917:
-----------------------------------

I have had exactly the same problem. The reason was that I created the database on Linux where "UTF-8" collation is the default.

I could fix it by re-creating the postgres database with collaction 'C'.

see [https://jackrabbit.apache.org/oak/docs/nodestore/document/rdb-document-store.html#database-creation]

I recommend that anyone who stumbles across the same problem should first check the collation (and carefully read the documentation).

 

> Thousands ConflitException on .createRepository()
> -------------------------------------------------
>
>                 Key: OAK-8917
>                 URL: https://issues.apache.org/jira/browse/OAK-8917
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.24.0
>            Reporter: Olivier Jolit
>            Priority: Minor
>         Attachments: effective-pom.xml, output
>
>
> I use OAK in my Spring Boot application to store user content (bookmarks). Users will write to OAK via REST calls.
> So I create a repository (in a Spring Bean) on my application startup with:
> {code:java}
> public OakBookmarkService() {
>     RDBDocumentNodeStoreBuilder.newRDBDocumentNodeStoreBuilder()
>         .setRDBConnection(RDBDataSourceFactory.forJdbcUrl("jdbc:postgresql://" + host + ":" + port + "/" + db + "?currentSchema= " + schema, user, password, sqlDriverClassName)).build()
>     SecurityProvider securityProvider = new BookmarksSecurityProvider(rolesProvider);
>     ThreeWayConflictHandler threeWayConflictHandler = new BookmarkConflictHandler();
>     repository = new Jcr(new Oak(store)).with(securityProvider).with(threeWayConflictHandler).createRepository(); 
> ...
> }{code}
> The issue I have is that this creation of the repository throws thousands of ConflitExceptions like:
> {code:java}
> The node 1:/jcr:system already existed in revision
> r170631ac223-0-1 (older than base r17063a941e2-0-1), commit revision: r17063a95314-0-1 {code}
> Which prevent my application from starting.
> Deleting all the tables in my PostgreSQL database between each startup of my server fixes this issue but is obviously not expected. So it seems to me that OAK tries to recreate the default nodes in the database even though they already exist.
> I see in the documentation ([https://jackrabbit.apache.org/oak/docs/construct.html]) that I need to logout and dispose of the node store after each use. Do I have to do this when the server stops ? How to ensure this is done even when the server crashes in this case ?
> Or should I create the node store at the beginning of each REST call and dispose of it at the end every time ? For now I only create a session and close it for each call and am assuming creating the store each time is too expensive.
> Also, my conflict handler (that always returns Resolution.OURS for now) does not seem to be called in this scenario, which surprises me.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)