Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28521

Fix MongoDB upsert retry to avoid duplicate key error

    XMLWordPrintable

    Details

      Description

      When doing assembling blobs for attaching their references to a new document via REST API, this error occurs:

      2020-01-15T03:17:07,918 ERROR [WebEngineExceptionMapper] com.mongodb.MongoWriteException: E11000 duplicate key error collection: nuxeo-insight-cloud-prod.kv.transient_BatchManagerCache index: _id_ dup key: { : "batchId-0f6af904-7922-4ee5-975a-3bff4dc78c2f_0.param.tmpChunkedFilePath" }
      com.mongodb.MongoWriteException: E11000 duplicate key error collection: nuxeo-insight-cloud-prod.kv.transient_BatchManagerCache index: _id_ dup key: { : "batchId-0f6af904-7922-4ee5-975a-3bff4dc78c2f_0.param.tmpChunkedFilePath" }
      	at com.mongodb.client.internal.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:967) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.client.internal.MongoCollectionImpl.executeReplaceOne(MongoCollectionImpl.java:602) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.client.internal.MongoCollectionImpl.replaceOne(MongoCollectionImpl.java:578) ~[mongo-java-driver-3.8.1.jar:?]
      	at com.mongodb.client.internal.MongoCollectionImpl.replaceOne(MongoCollectionImpl.java:573) ~[mongo-java-driver-3.8.1.jar:?]
      	at org.nuxeo.ecm.core.mongodb.kv.MongoDBKeyValueStore.put(MongoDBKeyValueStore.java:350) ~[nuxeo-core-mongodb-10.10.jar:?]
      	at org.nuxeo.ecm.core.mongodb.kv.MongoDBKeyValueStore.put(MongoDBKeyValueStore.java:324) ~[nuxeo-core-mongodb-10.10.jar:?]
      	at org.nuxeo.ecm.core.transientstore.keyvalueblob.KeyValueBlobTransientStore.putParameter(KeyValueBlobTransientStore.java:379) ~[nuxeo-core-cache-10.10-HF12.jar:?]
      	at org.nuxeo.ecm.automation.server.jaxrs.batch.BatchFileEntry.getBlob(BatchFileEntry.java:230) ~[nuxeo-automation-server-10.10-HF15.jar:?]
      

      Some references to the duplicate key error:

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h