Jira upgrade - Indexation errors on Jira 8: "cannot change DocValues type from SORTED to SORTED_SET for field"


Table of contents



Symptoms

You are performing a reindex after upgrading to Jira 8 and find the following error in the logs:



 java.lang.IllegalArgumentException: cannot change DocValues type from SORTED to SORTED_SET for field "customfield_xxxxx"
	at org.apache.lucene.index.FieldInfos$FieldNumbers.verifyConsistent(FieldInfos.java:289)
	at org.apache.lucene.index.FieldInfos$FieldNumbers.setDocValuesType(FieldInfos.java:337)
	at org.apache.lucene.index.DefaultIndexingChain.indexDocValue(DefaultIndexingChain.java:524)
	at org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:466)
	at org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:392)
	at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:240)
	at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:497)
	at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1729)
	at com.atlassian.jira.index.WriterWrapper.updateDocuments(WriterWrapper.java:85)
	at com.atlassian.jira.index.Operations$Update.perform(Operations.java:176)
	at com.atlassian.jira.index.Operations$Completion.perform(Operations.java:280)
	at com.atlassian.jira.index.QueueingIndex$CompositeOperation.perform(QueueingIndex.java:187)
	at com.atlassian.jira.index.DefaultIndexEngine$FlushPolicy.perform(DefaultIndexEngine.java:76)
	at com.atlassian.jira.index.DefaultIndexEngine.write(DefaultIndexEngine.java:138)
	at com.atlassian.jira.index.DefaultIndex.perform(DefaultIndex.java:28)
	at com.atlassian.jira.index.QueueingIndex$Task.perform(QueueingIndex.java:132)
	at com.atlassian.jira.index.QueueingIndex$Task.index(QueueingIndex.java:144)
	at com.atlassian.jira.index.QueueingIndex$Task.run(QueueingIndex.java:111)
	at java.lang.Thread.run(Thread.java:748)




Cause

This error is very random and is related to Lucene (Jira search engine) conversion errors with huge volume of data (the bigger your instance the more likely you will encounter this error).



Resolution

Multiple work arounds may be applicable, here are the ones we are aware of:

  • Disabling then enabling search for the field which appears in the logs
  • Performing an index recovery if you have a backup