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

org.sonatype.nexus.datastore.api.DuplicateKeyException in org.sonatype.nexus.repository.content.browse.store.BrowseNodeStore.mergeBrowseNode

    XMLWordPrintable

    Details

      Description

      During a migration process from 2.14.13 to 3.33.1 Postgresql 12, the following ERROR was logged in the repository 3 nexus.log:
       

      2021-08-25 16:52:03,249+0000 ERROR [event-13-thread-604]  admin com.google.common.eventbus.EventBus.nexus.async - Could not dispatch event org.sonatype.nexus.repository.content.browse.BrowseEventHandler$FlushEvent@2acbcaa1 to subscriber org.sonatype.nexus.repository.content.browse.BrowseEventHandler$FlushEventReceiver@2caad9f0 method [public void org.sonatype.nexus.repository.content.browse.BrowseEventHandler$FlushEventReceiver.on(org.sonatype.nexus.repository.content.browse.BrowseEventHandler$FlushEvent)]
      org.sonatype.nexus.datastore.api.DuplicateKeyException: Duplicate key
      	at org.sonatype.nexus.datastore.mybatis.EntityExecutor.update(EntityExecutor.java:86)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:194)
      	at org.sonatype.nexus.datastore.mybatis.DataAccessSqlSession.update(DataAccessSqlSession.java:76)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:181)
      	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
      	at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145)
      	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
      	at com.sun.proxy.$Proxy161.mergeBrowseNode(Unknown Source)
      	at org.sonatype.nexus.repository.content.browse.store.BrowseNodeStore.mergeBrowseNode(BrowseNodeStore.java:90)
      	at org.sonatype.nexus.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:49)
      	at org.sonatype.nexus.repository.content.browse.store.BrowseNodeManager.doCreateBrowseNodes(BrowseNodeManager.java:104)
      	at org.sonatype.nexus.repository.content.browse.store.BrowseNodeManager.lambda$0(BrowseNodeManager.java:85)
      	at org.sonatype.nexus.transaction.OperationPoint.lambda$0(OperationPoint.java:53)
      	at org.sonatype.nexus.transaction.OperationPoint.proceed(OperationPoint.java:64)
      	at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:57)
      	at org.sonatype.nexus.transaction.Operations.proceedWithTransaction(Operations.java:232)
      	at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:223)
      	at org.sonatype.nexus.transaction.Operations.run(Operations.java:175)
      	at org.sonatype.nexus.repository.content.browse.store.BrowseNodeManager.createBrowseNodes(BrowseNodeManager.java:85)
      	at org.sonatype.nexus.repository.content.browse.BrowseFacetImpl.createBrowseNodes(BrowseFacetImpl.java:185)
      	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
      	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
      	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
      	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
      	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
      	at org.sonatype.nexus.repository.content.browse.BrowseFacetImpl.addPathsToAssets(BrowseFacetImpl.java:122)
      	at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
      	at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:272)
      	at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:54)
      	at org.sonatype.nexus.repository.content.browse.BrowseEventHandler.lambda$3(BrowseEventHandler.java:289)
      	at java.util.Optional.ifPresent(Optional.java:159)
      	at org.sonatype.nexus.repository.content.browse.BrowseEventHandler.lambda$2(BrowseEventHandler.java:288)
      	at java.util.Map.forEach(Map.java:630)
      	at org.sonatype.nexus.repository.content.browse.BrowseEventHandler.flushPageOfAssets(BrowseEventHandler.java:287)
      	at org.sonatype.nexus.repository.content.browse.BrowseEventHandler$FlushEventReceiver.on(BrowseEventHandler.java:245)
      	at sun.reflect.GeneratedMethodAccessor1282.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:87)
      	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:72)
      	at org.sonatype.nexus.thread.internal.MDCAwareRunnable.run(MDCAwareRunnable.java:40)
      	at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120)
      	at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "uk_maven2_browse_node_repository_path"
        Detail: Key (repository_id, request_path)=(89, /segment_yumrepo/) already exists.
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323)
      	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481)
      	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401)
      	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164)
      	at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:153)
      	at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
      	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
      	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
      	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
      	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
      	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
      	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
      	at org.sonatype.nexus.datastore.mybatis.EntityExecutor.update(EntityExecutor.java:81)
      	... 51 common frames omitted
       

      Expected

      Determine the impact of the exception and the steps required to mitigate it from happening.

        Attachments

          Activity

            People

            Assignee:
            mmartz Michael Martz
            Reporter:
            plynch Peter Lynch
            Last Updated By:
            Michael Martz Michael Martz
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title