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

ChangeHistoryBatch.fetchAllChangeItems() fails due to large SQL IN clause

    XMLWordPrintable

Details

    Description

      Symptoms

      JIRA will generate an error when trying to fetch a large number of change groups. This can happen when:

      1. Fetching change history for a large number of issues.
      2. Fetching change history for issues with a lot of change groups.

      The following can be found within the atlassian-jira.log:

      SQL Server
      com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT ID, groupid, FIELDTYPE, FIELD, OLDVALUE, OLDSTRING, NEWVALUE, NEWSTRING FROM dbo.changeitem WHERE (groupid IN (?, ?, ?, ?, ?, ...)
      (Prepared or callable statement has more than 2000 parameter markers.)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByAnd(DefaultOfBizDelegator.java:120)
      	at com.atlassian.jira.issue.changehistory.ChangeHistoryBatch.fetchAllChangeItems(ChangeHistoryBatch.java:160)
      	at com.atlassian.jira.issue.changehistory.ChangeHistoryBatch.access$400(ChangeHistoryBatch.java:39)
      	at com.atlassian.jira.issue.changehistory.ChangeHistoryBatch$BatchingChangeHistory.getChangeItems(ChangeHistoryBatch.java:272)
      
      Oracle
      com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT ID, groupid, FIELDTYPE, FIELD, OLDVALUE, OLDSTRING, NEWVALUE, NEWSTRING FROM changeitem WHERE (groupid IN (?, ?, ?, ?, ?, ...)
      (ORA-01795: maximum number of expressions in a list is 1000)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByAnd(DefaultOfBizDelegator.java:120) 
      	at com.atlassian.jira.issue.changehistory.ChangeHistoryBatch.fetchAllChangeItems(ChangeHistoryBatch.java:160)
      	at com.atlassian.jira.issue.changehistory.ChangeHistoryBatch.access$400(ChangeHistoryBatch.java:39)
      	at com.atlassian.jira.issue.changehistory.ChangeHistoryBatch$BatchingChangeHistory.getChangeItems(ChangeHistoryBatch.java:272)
      

      Cause

      The ChangeHistoryBatch can build SELECT statements with excessively large IN clauses in JIRA 5.1, leading to errors in Activity Streams, GreenHopper, and other plugins that use the ChangeHistoryManager.

      Workaround

      There is no current workaround at this stage.

      Attachments

        Issue Links

          Activity

            People

              edalgliesh Eric Dalgliesh
              ttzidamis Theodore Tzidamis (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: