Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-71233

Custom fields with stale values break reindexing

XMLWordPrintable

      Reindex will fail for single-value custom fields having multiple values stored in DB.

      Steps to reproduce

      1. Have multiple values for the single-value custom field - this may happen under race conditions (see JSDSERVER-5299)
      2. Trigger foreground reindex

      Expected Results
      Reindex finishes without any errors

      Actual results
      Reindex fails with the error and there will be an exception in atlassian-jira.log:
       

      [c.a.jira.index.AccumulatingResultBuilder] java.lang.IllegalStateException: Duplicate key customfield_10000 (attempted merging values com.atlassian.jira.issue.customfields.CustomFieldPrefetchedData@276c0604 and com.atlassian.jira.issue.customfields.CustomFieldPrefetchedData@276c0604)
      java.lang.RuntimeException: java.lang.IllegalStateException: Duplicate key customfield_10000 (attempted merging values com.atlassian.jira.issue.customfields.CustomFieldPrefetchedData@276c0604 and com.atlassian.jira.issue.customfields.CustomFieldPrefetchedData@276c0604)
      	at com.atlassian.jira.index.DefaultIndex$Failure.<init>(DefaultIndex.java:100)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$EntityOperation.perform(DefaultIssueIndexer.java:725)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer.lambda$null$1(DefaultIssueIndexer.java:424)
      	at com.atlassian.jira.index.SimpleIndexingStrategy.apply(SimpleIndexingStrategy.java:7)
      	at com.atlassian.jira.index.SimpleIndexingStrategy.apply(SimpleIndexingStrategy.java:5)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer.lambda$perform$2(DefaultIssueIndexer.java:422)
      	at com.atlassian.jira.util.collect.CollectionUtil.foreach(CollectionUtil.java:39)
      	at com.atlassian.jira.issue.util.IssueIdsIssueIterable.foreach(IssueIdsIssueIterable.java:24)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer.perform(DefaultIssueIndexer.java:396)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer.reindexIssues(DefaultIssueIndexer.java:259)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.lambda$reIndexIssues$5(DefaultIndexManager.java:618)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.executeWithIndexLock(DefaultIndexManager.java:825)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:618)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:597)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:581)
      	at jdk.internal.reflect.GeneratedMethodAccessor1492.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      	at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:38)
      	at com.sun.proxy.$Proxy179.reIndexIssues(Unknown Source)
      	at com.atlassian.jira.imports.project.DefaultProjectImportPersister.reIndexProject(DefaultProjectImportPersister.java:234)
      	at com.atlassian.jira.imports.project.DefaultProjectImportManager.doImport(DefaultProjectImportManager.java:659)
      	at com.atlassian.jira.bc.imports.project.DefaultProjectImportService.doImport(DefaultProjectImportService.java:416)
      	at com.atlassian.jira.web.action.admin.importer.project.ProjectImportSummary$ProjectImportCallable.call(ProjectImportSummary.java:285)
      	at com.atlassian.jira.web.action.admin.importer.project.ProjectImportSummary$ProjectImportCallable.call(ProjectImportSummary.java:236)
      	at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:533)
      	at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:491)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:216)
      	at java.base/java.lang.Thread.run(Thread.java:832)
      Caused by: java.lang.IllegalStateException: Duplicate key customfield_10000 (attempted merging values com.atlassian.jira.issue.customfields.CustomFieldPrefetchedData@276c0604 and com.atlassian.jira.issue.customfields.CustomFieldPrefetchedData@276c0604)
      	at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:133)
      	at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)
      	at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
      	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
      	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1624)
      	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
      	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
      	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
      	at com.atlassian.jira.issue.customfields.persistence.DefaultNonnullCustomFieldProvider.getCustomFieldInfo(DefaultNonnullCustomFieldProvider.java:27)
      	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory$IdentityBasedProvider.getCustomFieldInfo(DefaultIssueDocumentFactory.java:150)
      	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.lambda$getPersistedFieldsWithData$3(DefaultIssueDocumentFactory.java:195)
      	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
      	at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1694)
      	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
      	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
      	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
      	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
      	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.getPersistedFieldsWithData(DefaultIssueDocumentFactory.java:207)
      	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.createDocument(DefaultIssueDocumentFactory.java:95)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$DefaultDocumentCreationStrategy.get(DefaultIssueIndexer.java:1137)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssuesOperation.createDocument(DefaultIssueIndexer.java:826)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$EntityOperation.perform(DefaultIssueIndexer.java:712)
      	... 30 more

      Workaround
      Remove older value from customfieldvalue DB table manually.

              pbruski Przemek Bruski
              dkedzierski DK
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: