Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-21059

All VARIABLE_VALUE columns should use clob instead of varchar(4000)

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 7.2.0, 7.1.2
    • 7.1.1
    • Variables
    • None

      Issue Summary

      Some variable related tables still use varchar(4000) while they should use CLOB.

      Steps to Reproduce

      1. Have a version of Bamboo installed, prior to 7.1.1, where it is possible to upgrade to 7.1.1.
      2. Create a password variable with a long value (close to the 4000 char limit).
      3. Upgrade Bamboo to version 7.1.1.

      Expected Results

      Bamboo upgrades with no errors.

      Actual Results

      The upgrade process fails. In the logs we can see: 

      2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
      2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] 70102 : Encrypt data in VARIABLE_CONTEXT table (post-bootstrap)
      2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
      (...)
      2020-08-27 11:58:23,893 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractVariableDataEncryptionTask] Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size
      2020-08-27 11:58:23,897 WARN [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] SQL Error: 0, SQLState: 22001
      2020-08-27 11:58:23,898 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] ERROR: value too long for type character varying(4000)
      2020-08-27 11:58:23,902 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
      org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
      	at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:251)
      	at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:387)
      	at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:350)
      	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$1.doInTransaction(BambooTransactionHibernateTemplate.java:36)
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
      	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:28)
      	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:33)
      	at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.updateVariableValuesByValue(AbstractVariableDataEncryptionTask.java:133)
      (...)	
      Caused by: org.hibernate.exception.DataException: could not execute statement
      	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:118)
      	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
      	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
      	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
      	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178)
      	at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:107)
      	at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1593)
      	at org.hibernate.query.internal.NativeQueryImpl.doExecuteUpdate(NativeQueryImpl.java:292)
      	at org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1594)
      	at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.encryptVariableValue(AbstractVariableDataEncryptionTask.java:176)
      (...)
      Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(4000)
      
      (...)
      
      

      Workaround

      For versions prior 7.1.1: Currently there is no known workaround for this behavior. A workaround will be added here when available

      For version 7.1.1: atlassian-bamboo-web-7.1.1-varsizepatch.jar

      1. Stop Bamboo.
      2. Download the file:
      3. Run the following queries:
        ALTER TABLE VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
        ALTER TABLE VARIABLE_BASELINE_ITEM ALTER COLUMN VARIABLE_VALUE TYPE text;
        ALTER TABLE VARIABLE_SUBSTITUTION ALTER COLUMN VARIABLE_VALUE TYPE text;
        ALTER TABLE STAGE_VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
        
      1. Navigate to the folder <bamboo_server_directory>/atlassian-bamboo/WEB-INF/lib/. You will find a file called atlassian-bamboo-web-7.1.1.jar. Back it up.
      2. Place the new jar in that folder, and change its name to atlassian-bamboo-web-7.1.1.jar, to make it look like the previous one.
      3. Start Bamboo again.

            [BAM-21059] All VARIABLE_VALUE columns should use clob instead of varchar(4000)

            Krzysztof Podsiadło made changes -
            Link New: This issue relates to BAM-21890 [ BAM-21890 ]
            Zuzanna Struczewska made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 599804 ]
            Alexey Chystoprudov made changes -
            Fix Version/s New: 7.2.0 [ 92133 ]
            Marcin Gardias made changes -
            Link New: This issue is duplicated by BAM-14540 [ BAM-14540 ]
            Jan Majkutewicz (Inactive) made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            Marcin Gardias made changes -
            Status Original: In Review [ 10051 ] New: Waiting for Release [ 12075 ]
            Patricio made changes -
            Description Original: h3. Issue Summary

            Some variable related tables still use varchar(4000) while they should use CLOB.
            h3. Steps to Reproduce
             # Have a version of Bamboo installed, prior to 7.1.1, where it is possible to upgrade to 7.1.1.
             # Create a password variable with a long value (close to the 4000 char limit).
             # Upgrade Bamboo to version 7.1.1.

            h3. Expected Results

            Bamboo upgrades with no errors.
            h3. Actual Results

            The upgrade process fails. In the logs we can see: 
            {noformat}
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] 70102 : Encrypt data in VARIABLE_CONTEXT table (post-bootstrap)
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
            2020-08-27 11:58:23,893 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractVariableDataEncryptionTask] Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size
            2020-08-27 11:58:23,897 WARN [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] SQL Error: 0, SQLState: 22001
            2020-08-27 11:58:23,898 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] ERROR: value too long for type character varying(4000)
            2020-08-27 11:58:23,902 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
            org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
            at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:251)
            at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:387)
            at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:350)
            at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$1.doInTransaction(BambooTransactionHibernateTemplate.java:36)
            at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
            at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:28)
            at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:33)
            at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.updateVariableValuesByValue(AbstractVariableDataEncryptionTask.java:133)
            (...)
            Caused by: org.hibernate.exception.DataException: could not execute statement
            at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:118)
            at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
            at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
            at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
            at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178)
            at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:107)
            at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1593)
            at org.hibernate.query.internal.NativeQueryImpl.doExecuteUpdate(NativeQueryImpl.java:292)
            at org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1594)
            at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.encryptVariableValue(AbstractVariableDataEncryptionTask.java:176)
            (...)
            Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(4000)

            (...)

            {noformat}
            h3. Workaround

            For versions prior 7.1.1: Currently there is no known workaround for this behavior. A workaround will be added here when available

            For version 7.1.1: [^atlassian-bamboo-web-7.1.1-varsizepatch.jar]
             # Stop Bamboo.
             # Download the file:
             # Run the following queries:
            {noformat}
            ALTER TABLE VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_BASELINE_ITEM ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_SUBSTITUTION ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE STAGE_VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            {noformat}

             # Navigate to the folder <bamboo_server_directory>/atlassian-bamboo/WEB-INF/lib/. You will find a file called atlassian-bamboo-web-7.1.1.jar. Back it up.
             # Place the new jar in that folder, and change its name to atlassian-bamboo-web-7.1.1.jar, to make it look like the previous one.
             # Start Bamboo again.
            New: h3. Issue Summary

            Some variable related tables still use varchar(4000) while they should use CLOB.
            h3. Steps to Reproduce
             # Have a version of Bamboo installed, prior to 7.1.1, where it is possible to upgrade to 7.1.1.
             # Create a password variable with a long value (close to the 4000 char limit).
             # Upgrade Bamboo to version 7.1.1.

            h3. Expected Results

            Bamboo upgrades with no errors.
            h3. Actual Results

            The upgrade process fails. In the logs we can see: 
            {noformat}
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] 70102 : Encrypt data in VARIABLE_CONTEXT table (post-bootstrap)
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
            (...)
            2020-08-27 11:58:23,893 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractVariableDataEncryptionTask] Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size
            2020-08-27 11:58:23,897 WARN [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] SQL Error: 0, SQLState: 22001
            2020-08-27 11:58:23,898 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] ERROR: value too long for type character varying(4000)
            2020-08-27 11:58:23,902 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
            org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
            at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:251)
            at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:387)
            at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:350)
            at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$1.doInTransaction(BambooTransactionHibernateTemplate.java:36)
            at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
            at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:28)
            at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:33)
            at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.updateVariableValuesByValue(AbstractVariableDataEncryptionTask.java:133)
            (...)
            Caused by: org.hibernate.exception.DataException: could not execute statement
            at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:118)
            at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
            at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
            at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
            at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178)
            at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:107)
            at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1593)
            at org.hibernate.query.internal.NativeQueryImpl.doExecuteUpdate(NativeQueryImpl.java:292)
            at org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1594)
            at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.encryptVariableValue(AbstractVariableDataEncryptionTask.java:176)
            (...)
            Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(4000)

            (...)

            {noformat}
            h3. Workaround

            For versions prior 7.1.1: Currently there is no known workaround for this behavior. A workaround will be added here when available

            For version 7.1.1: [^atlassian-bamboo-web-7.1.1-varsizepatch.jar]
             # Stop Bamboo.
             # Download the file:
             # Run the following queries:
            {noformat}
            ALTER TABLE VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_BASELINE_ITEM ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_SUBSTITUTION ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE STAGE_VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            {noformat}

             # Navigate to the folder <bamboo_server_directory>/atlassian-bamboo/WEB-INF/lib/. You will find a file called atlassian-bamboo-web-7.1.1.jar. Back it up.
             # Place the new jar in that folder, and change its name to atlassian-bamboo-web-7.1.1.jar, to make it look like the previous one.
             # Start Bamboo again.
            Patricio made changes -
            Description Original: h3. Issue Summary

            Some variable related tables still use varchar(4000) while they should use CLOB.
            h3. Steps to Reproduce
             # Have a version of Bamboo installed, prior to 7.1.1, where it is possible to upgrade to 7.1.1.
             # Create a password variable with a long value (close to the 4000 char limit).
             # Upgrade Bamboo to version 7.1.1.

            h3. Expected Results

            Bamboo upgrades with no errors.
            h3. Actual Results

            The upgrade process fails. In the logs we can see: 
            {noformat}
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] 70102 : Encrypt data in VARIABLE_CONTEXT table (post-bootstrap)
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
            (...)
            2020-08-27 11:58:23,893 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractVariableDataEncryptionTask] Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size2020-08-27 11:58:23,893 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractVariableDataEncryptionTask] Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size2020-08-27 11:58:23,897 WARN [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] SQL Error: 0, SQLState: 220012020-08-27 11:58:23,898 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] ERROR: value too long for type character varying(4000)2020-08-27 11:58:23,902 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statementorg.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:251) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:387) at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:350) at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$1.doInTransaction(BambooTransactionHibernateTemplate.java:36) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:28) at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:33) at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.updateVariableValuesByValue(AbstractVariableDataEncryptionTask.java:133)(...) Caused by: org.hibernate.exception.DataException: could not execute statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:118) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178) at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:107) at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1593) at org.hibernate.query.internal.NativeQueryImpl.doExecuteUpdate(NativeQueryImpl.java:292) at org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1594) at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.encryptVariableValue(AbstractVariableDataEncryptionTask.java:176)(...)Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(4000)
            {noformat}
            h3. Workaround

            For versions prior 7.1.1: Currently there is no known workaround for this behavior. A workaround will be added here when available

            For version 7.1.1: [^atlassian-bamboo-web-7.1.1-varsizepatch.jar]
             # Stop Bamboo.
             # Download the file:
             # Run the following queries:
            {noformat}
            ALTER TABLE VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_BASELINE_ITEM ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_SUBSTITUTION ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE STAGE_VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            {noformat}

             # Navigate to the folder <bamboo_server_directory>/atlassian-bamboo/WEB-INF/lib/. You will find a file called atlassian-bamboo-web-7.1.1.jar. Back it up.
             # Place the new jar in that folder, and change its name to atlassian-bamboo-web-7.1.1.jar, to make it look like the previous one.
             # Start Bamboo again.
            New: h3. Issue Summary

            Some variable related tables still use varchar(4000) while they should use CLOB.
            h3. Steps to Reproduce
             # Have a version of Bamboo installed, prior to 7.1.1, where it is possible to upgrade to 7.1.1.
             # Create a password variable with a long value (close to the 4000 char limit).
             # Upgrade Bamboo to version 7.1.1.

            h3. Expected Results

            Bamboo upgrades with no errors.
            h3. Actual Results

            The upgrade process fails. In the logs we can see: 
            {noformat}
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] 70102 : Encrypt data in VARIABLE_CONTEXT table (post-bootstrap)
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
            2020-08-27 11:58:23,893 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractVariableDataEncryptionTask] Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size
            2020-08-27 11:58:23,897 WARN [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] SQL Error: 0, SQLState: 22001
            2020-08-27 11:58:23,898 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] ERROR: value too long for type character varying(4000)
            2020-08-27 11:58:23,902 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
            org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
            at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:251)
            at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:387)
            at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:350)
            at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$1.doInTransaction(BambooTransactionHibernateTemplate.java:36)
            at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
            at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:28)
            at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:33)
            at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.updateVariableValuesByValue(AbstractVariableDataEncryptionTask.java:133)
            (...)
            Caused by: org.hibernate.exception.DataException: could not execute statement
            at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:118)
            at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
            at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
            at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
            at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178)
            at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:107)
            at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1593)
            at org.hibernate.query.internal.NativeQueryImpl.doExecuteUpdate(NativeQueryImpl.java:292)
            at org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1594)
            at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.encryptVariableValue(AbstractVariableDataEncryptionTask.java:176)
            (...)
            Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(4000)

            (...)

            {noformat}
            h3. Workaround

            For versions prior 7.1.1: Currently there is no known workaround for this behavior. A workaround will be added here when available

            For version 7.1.1: [^atlassian-bamboo-web-7.1.1-varsizepatch.jar]
             # Stop Bamboo.
             # Download the file:
             # Run the following queries:
            {noformat}
            ALTER TABLE VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_BASELINE_ITEM ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_SUBSTITUTION ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE STAGE_VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            {noformat}

             # Navigate to the folder <bamboo_server_directory>/atlassian-bamboo/WEB-INF/lib/. You will find a file called atlassian-bamboo-web-7.1.1.jar. Back it up.
             # Place the new jar in that folder, and change its name to atlassian-bamboo-web-7.1.1.jar, to make it look like the previous one.
             # Start Bamboo again.
            Patricio made changes -
            Description Original: h3. Issue Summary

            Some variable related tables still use varchar(4000) while they should use CLOB.
            h3. Steps to Reproduce
             # create long password variable
             # upgrade to 7.1.1

            h3. Expected Results

            Bamboo upgrades.
            h3. Actual Results
            {noformat}
            Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size...
            {noformat}
            h3. Workaround

            For versions prior 7.1.1: Currently there is no known workaround for this behavior. A workaround will be added here when available

            For version 7.1.1: [^atlassian-bamboo-web-7.1.1-varsizepatch.jar]
             # Stop Bamboo.
             # Download the file:
             # Run the following queries:
            {noformat}
            ALTER TABLE VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_BASELINE_ITEM ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_SUBSTITUTION ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE STAGE_VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            {noformat}

             # Navigate to the folder <bamboo_server_directory>/atlassian-bamboo/WEB-INF/lib/. You will find a file called atlassian-bamboo-web-7.1.1.jar. Back it up.
             # Place the new jar in that folder, and change its name to atlassian-bamboo-web-7.1.1.jar, to make it look like the previous one.
             # Start Bamboo again.
            New: h3. Issue Summary

            Some variable related tables still use varchar(4000) while they should use CLOB.
            h3. Steps to Reproduce
             # Have a version of Bamboo installed, prior to 7.1.1, where it is possible to upgrade to 7.1.1.
             # Create a password variable with a long value (close to the 4000 char limit).
             # Upgrade Bamboo to version 7.1.1.

            h3. Expected Results

            Bamboo upgrades with no errors.
            h3. Actual Results

            The upgrade process fails. In the logs we can see: 
            {noformat}
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] 70102 : Encrypt data in VARIABLE_CONTEXT table (post-bootstrap)
            2020-08-27 11:58:22,955 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] ---------------------------------------------------------------
            (...)
            2020-08-27 11:58:23,893 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractVariableDataEncryptionTask] Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size2020-08-27 11:58:23,893 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractVariableDataEncryptionTask] Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size2020-08-27 11:58:23,897 WARN [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] SQL Error: 0, SQLState: 220012020-08-27 11:58:23,898 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] ERROR: value too long for type character varying(4000)2020-08-27 11:58:23,902 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statementorg.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:251) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:387) at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:350) at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$1.doInTransaction(BambooTransactionHibernateTemplate.java:36) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:28) at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:33) at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.updateVariableValuesByValue(AbstractVariableDataEncryptionTask.java:133)(...) Caused by: org.hibernate.exception.DataException: could not execute statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:118) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178) at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:107) at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1593) at org.hibernate.query.internal.NativeQueryImpl.doExecuteUpdate(NativeQueryImpl.java:292) at org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1594) at com.atlassian.bamboo.upgrade.tasks.AbstractVariableDataEncryptionTask.encryptVariableValue(AbstractVariableDataEncryptionTask.java:176)(...)Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(4000)
            {noformat}
            h3. Workaround

            For versions prior 7.1.1: Currently there is no known workaround for this behavior. A workaround will be added here when available

            For version 7.1.1: [^atlassian-bamboo-web-7.1.1-varsizepatch.jar]
             # Stop Bamboo.
             # Download the file:
             # Run the following queries:
            {noformat}
            ALTER TABLE VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_BASELINE_ITEM ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_SUBSTITUTION ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE STAGE_VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            {noformat}

             # Navigate to the folder <bamboo_server_directory>/atlassian-bamboo/WEB-INF/lib/. You will find a file called atlassian-bamboo-web-7.1.1.jar. Back it up.
             # Place the new jar in that folder, and change its name to atlassian-bamboo-web-7.1.1.jar, to make it look like the previous one.
             # Start Bamboo again.
            Patricio made changes -
            Description Original: h3. Issue Summary

            Some variable related tables still use varchar(4000) while they should use CLOB.
            h3. Steps to Reproduce
             # create long password variable
             # upgrade to 7.1.1

            h3. Expected Results

            Bamboo upgrades.
            h3. Actual Results
            {noformat}
            Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size...
            {noformat}
            h3. Workaround

            Currently there is no known workaround for this behavior. A workaround will be added here when available
            New: h3. Issue Summary

            Some variable related tables still use varchar(4000) while they should use CLOB.
            h3. Steps to Reproduce
             # create long password variable
             # upgrade to 7.1.1

            h3. Expected Results

            Bamboo upgrades.
            h3. Actual Results
            {noformat}
            Variable 'variable_name' has value length 3096 and encrypted value length 4152 is more than db column size - 4000 characters. Please decrease its size...
            {noformat}
            h3. Workaround

            For versions prior 7.1.1: Currently there is no known workaround for this behavior. A workaround will be added here when available

            For version 7.1.1: [^atlassian-bamboo-web-7.1.1-varsizepatch.jar]
             # Stop Bamboo.
             # Download the file:
             # Run the following queries:
            {noformat}
            ALTER TABLE VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_BASELINE_ITEM ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE VARIABLE_SUBSTITUTION ALTER COLUMN VARIABLE_VALUE TYPE text;
            ALTER TABLE STAGE_VARIABLE_CONTEXT ALTER COLUMN VARIABLE_VALUE TYPE text;
            {noformat}

             # Navigate to the folder <bamboo_server_directory>/atlassian-bamboo/WEB-INF/lib/. You will find a file called atlassian-bamboo-web-7.1.1.jar. Back it up.
             # Place the new jar in that folder, and change its name to atlassian-bamboo-web-7.1.1.jar, to make it look like the previous one.
             # Start Bamboo again.

              mgardias Marcin Gardias
              mgardias Marcin Gardias
              Affected customers:
              1 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: