Re-indexing is taking over an hour after upgrade from Jira Server 7.7.0 to 8.x versions
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
要約
After an upgrade from Jira Server 7.7.0 to any version of Jira higher than 8.0, the reindex progress is not moving forward and spends hours in 1% status.
環境
All Jira 8 versions and upwards.
診断
We can see from the atlassian-jira.log
that there isn't a complete index available after the upgrade. The index is in a state of inconsistency:
2021-05-27 22:10:47,022-0400 Structure-Jobs49a07818 Queue-Thread#7 WARN anonymous [c.a.j.issue.index.IndexConsistencyUtils] Index consistency check failed for index 'Issue': expectedCount=61085; actualCount=19329
When trying to perform a Full Reindex, Jira is running into a ScriptRunner error to load custom fields with Scriptrunner's ComponentManager:
2021-06-01 07:51:41,354-0400 JiraTaskExecutionThread-12 ERROR admin 462x121189x1 test1 /secure/admin/IndexReIndex!reindex.jspa [c.o.scriptrunner.customfield.GroovyCustomField] *************************************************************************************
2021-06-01 07:51:41,354-0400 JiraTaskExecutionThread-12 ERROR admin 462x121189x1 test1 /secure/admin/IndexReIndex!reindex.jspa [c.o.scriptrunner.customfield.GroovyCustomField] Script field failed on issue: TEST-1234, field: Last Comment
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script93274.groovy: 1: unable to resolve class com.atlassian.jira.ComponentManager
@ line 1, column 1.
import com.atlassian.jira.ComponentManager
原因
ComponentManager
has been deprecated since JIRA 7.11, which is the reason that this class cannot be resolved in Jira 8.x versions any longer.
The ScriptRunner error will not prevent the index from starting or completing, however, it will contribute to log spam and slow down the reindex.
回避策
Please follow best practices for Change Management and test and validate these settings in a Test/Development and Staging environment prior to rolling any changes into a Production environment. This is to validate these changes and ensure that they will function well within your infrastructure prior to placing these changes in production.
1. Visit Jira Admin -> Manage Apps -> Manage Apps
2. Find ScriptRunner in the list, then Disable it
3. Perform the Full Reindex again
4. Once the reindex is finished, re-enable ScriptRunner
Check if the reindex progress is faster with ScriptRunner disabled.
This may result in the index proceeding, but, ScriptRunner fields won't be added to the index and therefore may not be available in search results. Therefore, to fully workaround the issue we recommend:
5. Visit Jira Admin -> Apps -> Script Runner -> Browse
6. Click Fields
7. Locate any Scripted Custom fields that include in them com.atlassian.jira.ComponentManager
8. Update or temporarily remove these scripts
9. Perform the Full Reindex again
ソリューション
ScriptRunner's vendor Adaptavist recommends migrating all scripts that still use com.atlassian.jira.ComponentManager to ComponentAccessor.
For support on how to migrate and re-write the code, we recommend reaching out to Adaptavist.