Tuesday, February 9, 2010

Setting JIRA maxClauseCount

Have you ever seen the following exception in your JIRA's logs?

org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 65000

You probably have not. But if you had, chances are your JIRA is so populated that Lucene is throwing this exception when performing a text based search and you really need to get rid of it. I recently saw a very (very!) big JIRA instance running showing this symptom: when this exception started to appear in the logs many things began to break: some plugins, even some gadget configuration screens, some AJAX-based searches, they all started to malfunction.

This particular JIRA instance was suffering because of a poor deployment strategy and an even poorer project creation strategy. Nevertheless, the problem had to be fixed. JIRA by default sets Lucene's maxClauseCount parameter to 65000, which is good for most (if not all...) workloads. If you want to override this parameters you'll have to edit the jira-application.properties file, which is located at:

$JIRA_HOME/atlassian-jira/WEB-INF/classes/jira-application.properties

and edit the jira.search.maxclauses property. If you follow the official Lucene JavaDoc advice, that is, using the org.apache.lucene.maxClauseCount system property (for example, by setting it in the $JIRA_HOME/bin/setenv.sh script), won't work for JIRA: it probably sets it up programmatically during startup.


No comments: