JIRA indexing failure - 'The issue null has serious data integrity issues'
The queries on this page only apply if the instance is on a version prior to 6.1. The pkey data is separated into new columns and the original is nullified as part of an upgrade task. Please see https://developer.atlassian.com/display/JIRADEV/Preparing+for+JIRA+6.1#PreparingforJIRA6.1-editprojectkeydb for further information.
症状
Attempting to index JIRA will fail with a java.lang.NullPointerException
.
The following appears in the indexing screen:
java.util.concurrent.ExecutionException: java.lang.NullPointerException
Task completed in 17 minutes, 42 seconds with unexpected error.
Started Today 08:18 AM.
Finished Today 08:35 AM.
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.atlassian.jira.index.FutureResult.await(FutureResult.java:35)
at com.atlassian.jira.index.CompositeResultBuilder$CompositeResult.await(CompositeResultBuilder.java:82)
...
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at com.atlassian.jira.index.FutureResult.await(FutureResult.java:31)
...
Caused by: java.lang.NullPointerException
at java.util.ArrayList.addAll(ArrayList.java:472)
at com.atlassian.jira.issue.index.DefaultChangeHistoryRetriever.filterChangeItems(DefaultChangeHistoryRetriever.java:120)
at com.atlassian.jira.issue.index.DefaultChangeHistoryRetriever.createChangeGroupsFromChangeItems(DefaultChangeHistoryRetrieve
The following appears Using the Database Integrity Checker:
ERROR: ALF-14729 - The workflow entry with id 146727 has an incorrect state. (JRA-4241)
ERROR: null - The workflow entry with id 154773 has an incorrect state. (JRA-4241)
ERROR: null - The workflow entry with id 154772 has an incorrect state. (JRA-4241)
ERROR: null - The workflow entry with id 154771 has an incorrect state. (JRA-4241)
ERROR: null - The workflow entry with id 154770 has an incorrect state. (JRA-4241)
ERROR: null - The workflow entry with id 154769 has an incorrect state. (JRA-4241)
ERROR: null - The workflow entry with id 154762 does not have a corresponding current step. (JRA-4539)
ERROR: null - The workflow entry with id 154763 does not have a corresponding current step. (JRA-4539)
ERROR: null - The workflow entry with id 154764 does not have a corresponding current step. (JRA-4539)
ERROR: null - The workflow entry with id 154765 does not have a corresponding current step. (JRA-4539)
ERROR: null - The workflow entry with id 154766 does not have a corresponding current step. (JRA-4539)
atlassian-jira.log
に次のメッセージが表示される。
2012-09-11 06:22:35,085 IssueIndexer:thread-7 WARN xxxxxxx 360x7021178x1 1nl6hn8 82.0.214.230 /secure/admin/jira/IndexReIndex.jspa [jira.issue.history.AbstractDateRangeBuilder] The issue null has serious data integrity issues
java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
at com.atlassian.jira.issue.changehistory.ChangeHistoryItem$Builder.on(ChangeHistoryItem.java:389)
at com.atlassian.jira.issue.history.ReporterDateRangeBuilder.createInitialChangeItem(ReporterDateRangeBuilder.java:35)
at com.atlassian.jira.issue.history.AbstractDateRangeBuilder.buildDateRanges(AbstractDateRangeBuilder.java:38)
診断
- Using the Database Integrity Checker check if the JIRA instance is exhibited the same errors as above.
- If you happen to encounter an error while running Integrity Checker, please see if it is a similar error and follow the workaround suggested JRA-4714 - Getting issue details... STATUS
Run the following SQL against the JIRA database to see if it returns issues:
select * from jiraissue where pkey is null;
原因
There are data integrity issues in the database due to a null issue key. It's currently unknown at this stage what causes this.
回避策
This workaround will simulate the same process that is run by JIRA when deleting an issue.
データベースの変更を行う場合は 必ず事前にバックアップを取得してください。可能な場合はテスト サーバーで変更を試すことをおすすめします。
- Jira をシャットダウンします。
Identify problematic issues with the below SQL:
select * from jiraissue where pkey is null;
Remove them from the database with the following queries:
DELETE FROM jiraaction WHERE issueid in (<issue id from previous SQL>); DELETE FROM worklog WHERE issueid in (<issue id from previous SQL>); DELETE FROM changegroup WHERE issueid in (<issue id from previous SQL>); DELETE FROM nodeassociation WHERE SOURCE_NODE_ID in (<issue id from previous SQL>) AND SOURCE_NODE_ENTITY='Issue'; DELETE FROM userassociation WHERE SINK_NODE_ID in (<issue id from previous SQL>) AND SINK_NODE_ENTITY='Issue'; DELETE FROM customfieldvalue WHERE ISSUE in (<issue id from previous SQL>); DELETE FROM jiraissue WHERE ID in (<issue id from previous SQL>); DELETE FROM notificationinstance WHERE SOURCE in (<issue id from previous SQL>);
例:
DELETE FROM jiraissue WHERE ID in (1234,5678,9101,2131);
- Jira を起動します。
- Reindex JIRA, which will now complete successfully.
If there are any problems, restore the previous database backup immediately.