[
https://issues.apache.org/jira/browse/OAK-8158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Amit Jain reassigned OAK-8158:
------------------------------
Assignee: Amit Jain
> DuplicateKeyException
> ---------------------
>
> Key: OAK-8158
> URL: https://issues.apache.org/jira/browse/OAK-8158
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: documentmk
> Affects Versions: 1.4.24, 1.8.12, 1.10.2
> Reporter: Dmitry
> Assignee: Amit Jain
> Priority: Major
> Attachments: oak-test.zip
>
>
> Cannot migrate from 1.4.8 due to DuplicateKeyException
> If nodes are created concurrently with the same content DuplicateKeyException
> is thown see stacktrace below.
> It seems to be some race condition because it does not happen 100% of the
> time.
> Nodes that are created in parallel have the same content. If we change the
> content to be different for each node it runs successfully.
> After comparing 1.4.8 and 1.8.11 versions, we discovered that the code at
> o.a.j.o.p.d.m.MongoBlobStore.storeBlock (..) has changed under the following
> revision
> [https://svn.apache.org/viewvc?view=revision&revision=1828502]
> or github
> [https://github.com/apache/jackrabbit-oak/commit/012e7529a6b8e34836f2fe22bcab3861b9d7192d#diff-1e1cd3443fc4e611259407cdf0ed6ebcL105]
> in 1.4.8 DuplicateKeyException is ignored. in 1.8.11 you catch any
> MongoException and wrap it into IOException.
> Amit Jain explained to us that it is not necessary to catch
> DuplicateKeyException anymore, because upsert is used.
> However, we now get the exception which is propagated to our layer that does
> not know anything about mongo exceptions.
> we have created a small project that reproduces the issue, see attachment.
> [^oak-test.zip]
> some additional info:
> we use mongo 3.6 for testing 1.8.11 and our current implementation is based
> on mongo 3.2
> we use mongo-java-driver 3.10.1 driver for 1.8.11 testing, and current driver
> version is 3.3.0
> how we created db to be used by jackrabbit: "C:\Program
> Files\MongoDB\Server\3.6\bin\mongo.exe" -u admin --authenticationDatabase
> admin test --eval
> "db.createUser(\{user:""test"",pwd:""test"",roles:[{role:""readWrite"",db:""test""},\{role:""clusterMonitor"",db:""admin""}]})"
> stacktrace:
> Caused by: java.io.IOException: Write failed with error code 11000 and error
> message 'E11000 duplicate key error collection: test.blobs index: _id_ dup
> key: \{ : "c3d471c99bd0a96030dc0f8b6951021b1333d4bcb11d8c9e16743a5d8a11cc60"
> }'
> at
> org.apache.jackrabbit.oak.plugins.document.mongo.MongoBlobStore.storeBlock(MongoBlobStore.java:103)
> ~[oak-store-document-1.8.11.jar:1.8.11]
> at
> org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.convertBlobToId(AbstractBlobStore.java:386)
> ~[oak-blob-1.8.11.jar:1.8.11]
> at
> org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.writeBlob(AbstractBlobStore.java:195)
> ~[oak-blob-1.8.11.jar:1.8.11]
> at
> org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.createBlob(DocumentNodeStore.java:1865)
> ~[oak-store-document-1.8.11.jar:1.8.11]
> at
> org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.createBlob(DocumentNodeStore.java:133)
> ~[oak-store-document-1.8.11.jar:1.8.11]
> at
> org.apache.jackrabbit.oak.core.MutableRoot.createBlob(MutableRoot.java:326)
> ~[oak-core-1.8.11.jar:1.8.11]
> at
> org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl.createBinaryValue(ValueFactoryImpl.java:296)
> ~[oak-store-spi-1.8.11.jar:1.8.11]
> at
> org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl.createBinary(ValueFactoryImpl.java:288)
> ~[oak-store-spi-1.8.11.jar:1.8.11]
> ... 40 more
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)