Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-9853

Creating a second "duplicate" blobstore errors and deletes the path

    Details

    • Story Points:
      1
    • Sprint:
      Sprint 65 - Föhn

      Description

      While testing the new provisioning API, I created a blobstore for a second time in a test to make sure updates could not be made.
      Script was:

      blobStore.createFileBlobStore('test6','/Users/jtom/Documents/Work/temp')
      

      The second time I ran this it gave the below error.
      In addition to this, I noticed that the location I gave /Users/jtom/Documents/Work/temp was deleted (folder and contents).
      The error didn't concern me as much as the deletion, which caused a bunch of test/temp data to be removed. In a real world scenario, it seems possible to accidentially delete your entire blobstore this way.

      This occurs if you do this from the UI as well as if you do this from the provisioning script. In the event you do this, you also see an error on the screen. I did not include this below but can if you like.
      I did not check this in older versions of NX3. Blobstores did not exist in NX2 so there's no check there.

      Note, you MUST use the same name and location. If you use a distinct name, no deletion/error occurs.

      Please be very careful reproing/testing this and make sure you don't care about the contents of whatever path you use. Luckily I didn't do /Users/jtom/ or something more broad spanning. Scary stuff.

      2016-02-23 13:04:56,246-0500 ERROR [Karaf local console user karaf] org.apache.karaf.shell.support.ShellUtil - Exception caught while executing command
      javax.script.ScriptException: javax.script.ScriptException: com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record repository_blobstore

      Unknown macro: {name}

      : found duplicated key 'test6' in index 'repository_blobstore_name_idx' previously assigned to the record #20:6 RID=#20:6
      at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:130) [na:na]
      at org.sonatype.nexus.internal.script.ScriptServiceImpl.eval(ScriptServiceImpl.java:153) [na:na]
      at org.sonatype.nexus.common.script.ScriptService$eval$1.call(Unknown Source) [na:na]
      at org.sonatype.nexus.internal.script.ScriptAction.execute(ScriptAction.groovy:119) [na:na]
      at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:83) [na:na]
      at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:67) [na:na]
      at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:87) [na:na]
      at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480) [na:na]
      at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406) [na:na]
      at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) [na:na]
      at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182) [na:na]
      at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119) [na:na]
      at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94) [na:na]
      at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:270) [na:na]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
      Caused by: javax.script.ScriptException: com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record repository_blobstore

      Unknown macro: {name}

      : found duplicated key 'test6' in index 'repository_blobstore_name_idx' previously assigned to the record #20:6 RID=#20:6
      at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:326) [na:na]
      at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:124) [na:na]
      ... 14 common frames omitted
      Caused by: com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record repository_blobstore

      Unknown macro: {name}

      : found duplicated key 'test6' in index 'repository_blobstore_name_idx' previously assigned to the record #20:6
      at com.orientechnologies.orient.core.index.OIndexTxAwareOneValue.checkEntry(OIndexTxAwareOneValue.java:224) [na:na]
      at com.orientechnologies.orient.core.index.OClassIndexManager.checkIndexedPropertiesOnCreation(OClassIndexManager.java:341) [na:na]
      at com.orientechnologies.orient.core.index.OClassIndexManager.checkIndexes(OClassIndexManager.java:592) [na:na]
      at com.orientechnologies.orient.core.index.OClassIndexManager.onRecordBeforeCreate(OClassIndexManager.java:410) [na:na]
      at com.orientechnologies.orient.core.hook.ODocumentHookAbstract.onTrigger(ODocumentHookAbstract.java:226) [na:na]
      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.callbackHooks(ODatabaseDocumentTx.java:1069) [na:na]
      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.executeSaveRecord(ODatabaseDocumentTx.java:1966) [na:na]
      at com.orientechnologies.orient.core.tx.OTransactionNoTx.saveRecord(OTransactionNoTx.java:159) [na:na]
      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:2568) [na:na]
      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:121) [na:na]
      at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1768) [na:na]
      at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1759) [na:na]
      at org.sonatype.nexus.orient.entity.EntityAdapter.writeEntity(EntityAdapter.java:187) [na:na]
      at org.sonatype.nexus.orient.entity.EntityAdapter.addEntity(EntityAdapter.java:215) [na:na]
      at org.sonatype.nexus.internal.blobstore.BlobStoreConfigurationStoreImpl.create(BlobStoreConfigurationStoreImpl.java:82) [na:na]
      at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39) [na:na]
      at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:270) [na:na]
      at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:53) [na:na]
      at org.sonatype.nexus.internal.blobstore.BlobStoreManagerImpl.create(BlobStoreManagerImpl.java:139) [na:na]
      at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39) [na:na]
      at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:270) [na:na]
      at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:53) [na:na]
      at org.sonatype.nexus.blobstore.api.BlobStoreManager$create$6.call(Unknown Source) [na:na]
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [na:na]
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [na:na]
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [na:na]
      at org.sonatype.nexus.internal.provisioning.BlobStoreApiImpl.createFileBlobStore(BlobStoreApiImpl.groovy:40) [na:na]
      at org.sonatype.nexus.BlobStoreApi$createFileBlobStore.call(Unknown Source) [na:na]
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [na:na]
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [na:na]
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) [na:na]
      at Script34.run(Script34.groovy:10) [na:na]
      at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:323) [na:na]
      ... 15 common frames omitted
      Error executing command: javax.script.ScriptException: com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record repository_blobstore{name:test6,type:File,attributes:[1]}: found duplicated key 'test6' in index 'repository_blobstore_name_idx' previously assigned to the record #20:6 RID=#20:6

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dwallace Dulani Wallace
              Reporter:
              jtom Joe Tom
              Last Updated By:
              Peter Lynch Peter Lynch
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  tigCommentSecurity.panel-title