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

Audit Log export is empty when exporting more than 2000 records on MSSQL

    XMLWordPrintable

Details

    Description

      When exporting the audit log, the export file is empty. The prompt will give you a number of entries that will be exported (truncated to the 100,000 newest events), yet when you open the export file, it is empty. I have attached the audit log zip file.

      Edit with root cause:

      In tomcat logs there are following exceptions:

      SEVERE: Servlet.service() for servlet default threw exception
      com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT ID, LOG_ID, OBJECT_TYPE, OBJECT_ID, OBJECT_NAME, OBJECT_PARENT_ID, OBJECT_PARENT_NAME FROM jiraschema.audit_item WHERE (LOG_ID IN  [...]
      (Prepared or callable statement has more than 2000 parameter markers.)
              at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findListIteratorByCondition(DefaultOfBizDelegator.java:534)
              at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findListIteratorByCondition(WrappingOfBizDelegator.java:349)
              at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:234)
              at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.visitWith(SelectQueryImpl.java:253)
              at com.atlassian.jira.auditing.AuditingStoreImpl.getItems(AuditingStoreImpl.java:293)
              at com.atlassian.jira.auditing.AuditingStoreImpl.getAuditRecords(AuditingStoreImpl.java:249)
              at com.atlassian.jira.auditing.AuditingStoreImpl.getRecords(AuditingStoreImpl.java:195)
              at com.atlassian.jira.auditing.AuditingManagerImpl.getRecords(AuditingManagerImpl.java:108)
              at com.atlassian.jira.auditing.AuditingManagerImpl.getRecords(AuditingManagerImpl.java:82)
              at sun.reflect.GeneratedMethodAccessor2802.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.java:129)
              at com.sun.proxy.$Proxy296.getRecords(Unknown Source)
              at sun.reflect.GeneratedMethodAccessor2802.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
      [...]
      
      
      

      This is reproducible only with MSSQL when exporting more than 2000 records, because MSSQL allows only for 2000 placeholder values in prepared statements. Also it affects Audit Log only in JIRA 6.3.5 and above since from that point there is an optimization introduced that results in prepare statements with long lists of place holders.

      Attachments

        Issue Links

          Activity

            People

              pbugalski Pawel Bugalski (Inactive)
              chris.solgat Chris Solgat
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: