Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-40394

Space export fails with error: "Couldn't backup database data"

    XMLWordPrintable

Details

    Description

      Summary

      Exporting selected pages of a relatively large space to XML will failed and the error message: "Couldn't backup database data" is shown in the UI

      Environment

      • Oracle 11g
      • Oracle 12
      • SQL Server
      • Microsoft SQL Server

      Steps to Reproduce

      1. Have Confluence connected to Oracle 11g
      2. Have a relatively large space (with 1000+ deleted pages in Oracle)
      3. Go to Space Tools > Content Tools > Export > XML
      4. Custom Export > Choose few pages
      5. Export

      Expected Results

      Export was successful

      Actual Results

      Export was not successful

      2015-12-08 14:36:48,837 ERROR [Long running task: Export Space] [confluence.importexport.impl.AbstractXmlExporter] backupEntities Couldn't backup database data.
       -- referer: https://www-test.wiki.ed.ac.uk/spaces/exportspacexml.action?key=GenePool | url: /spaces/doexportspace.action | userName: aforres3 | action: doexportspace
      org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: Could not execute query; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-01795: maximum number of expressions in a list is 1000
      ...
      Caused by: java.sql.SQLSyntaxErrorException: ORA-01795: maximum number of expressions in a list is 1000
      ...
      

      This has also been observed with SQL Server:

      2018-10-22 23:08:42,036 WARN [Long running task: Export Space] [hibernate.query.internal.QueryParameterBindingsImpl] expandListValuedParameters HHH000443: Dialect [com.atlassian.confluence.impl.hibernate.dialect.SQLServerDialect] limits the number of elements in an IN predicate to 2100 entries.  However, the given parameter list [exclusions] contained 20701 entries, which will likely cause failures to execute the query in the database
      

      For the Confluence running on the MSSQL server, the error message in the logs is this one:

       2020-05-26 17:44:23,744 ERROR [Long running task: Export Space] [engine.jdbc.spi.SqlExceptionHelper] logExceptions The incoming request has too many parameters. The server supports a maximum of 2100 parameters. Reduce the number of parameters and resend the request.
       – url: /spaces/doexportspace.action | referer: [https://xxxxxxxxxxxxxxxx:spaces/exportspacexml.action?key=SPACE] | traceId: 116358ab22940a24 | userName: xxxxxxx | action: doexportspace
       2020-05-26 17:44:23,745 ERROR [Long running task: Export Space] [confluence.importexport.impl.AbstractXmlExporter] backupEntities Couldn't backup database data.
       – url: /spaces/doexportspace.action | referer: [https://xxxxxxxxx/spaces/exportspacexml.action?key=SPAPCE] | traceId: 116358ab22940a24 | userName: XXXXXXXX | action: doexportspace
       org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
       at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:224)
       at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:368)
       at org.springframework.orm.hibernate5.HibernateTemplate.execute(HibernateTemplate.java:315)
       ...
       at java.lang.Thread.run(Thread.java:748)
       Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
       ....
       Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The incoming request has too many parameters. The server supports a maximum of 2100 parameters. Reduce the number of parameters and resend the request.

      Notes

      This is caused by some methods in confluence that returns more than 1000 entities/object. Oracle has a limitation of maximum acceptable number of entities in a list to be 1000

      On the MSSQL there is a hard-coded limit (2100) for the number of entries in the IN statement:

      https://github.com/Microsoft/msphpsql/blob/v4.2.0-preview/source/shared/core_sqlsrv.h#L172

      https://github.com/microsoft/msphpsql/issues/410

      Workaround

      Exporting the whole space to XML works alright. As such, by copying the pages to a new (empty) Space, and exporting the entire new Space, the pages should be exported successfully.

      Attachments

        Issue Links

          Activity

            People

              bhyde Bradley Hyde
              jwaihou Jonathan Soo
              Votes:
              42 Vote for this issue
              Watchers:
              74 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: