Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-3688

Database "Migration Checksum mismatch" after 5.x upgrade

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.7
    • Fix Version/s: 6.0
    • Component/s: DSpace API
    • Labels:
      None
    • Attachments:
      0
    • Comments:
      1
    • Documentation Status:
      Complete or Committed

      Description

      While upgrading DSpaceDirect customers from DSpace 5.6 to 5.7, we discovered that, during the database migration, database validation would fail with an error similar to:

      Caused by: org.flywaydb.core.api.FlywayException: Validate failed. Found differences between applied migrations and available migrations: Migration Checksum mismatch for migration V5.0_2014.08.08__-DS-1945-_Helpdesk_Request_a_Copy.sql: DB=1316176070, Classpath=-872444192

      After some debugging, we discovered that the line endings of the Flyway SQL migrations changed between the 5.6 and 5.7 releases in the dspace-api.jar file. This line-ending change caused the Flyway checksum validation to calculate a mismatch, per this bug in Flyway v3: https://github.com/flyway/flyway/issues/253 

      You can see this change in line endings by unzipping the 'dspace-api-5.6.jar' and 'dspace-api-5.7.jar' respectively and running a checksum on one (or more) SQL migrations. For example:

      md5sum org/dspace/storage/rdbms/sqlmigration/postgres/V5.0_2014.08.08__DS-1945_Helpdesk_Request_a_Copy.sql

      The md5sum results for this command are:

      • DSpace 5.5 : a50877528391f8913a1f5036f2773686
      • DSpace 5.6 : a50877528391f8913a1f5036f2773686 (same as 5.5)
      • DSpace 5.7:  2af7f9c96814f7f6bee1e8cf708502bc
      • DSpace 5.8:  2af7f9c96814f7f6bee1e8cf708502bc  (same as 5.7)

      The file line endings seem to have accidentally changed because 5.6 and 5.7 were released on different OSes (with 5.5 and 5.6 seemingly released on a Mac/Linux machine and 5.7 and 5.8 seemingly released on a Windows machine).

      At this time, there are two known solutions / workarounds:

      1. Run dspace database repair to tell your database to simply accept the new checksum of the SQL file(s) that have new line endings. This is not harmful to your database in this scenario, since the SQL files are unaltered (except for the new line endings). However, please be aware that you will need to run "dspace database repair" again if the checksums change back in a future 5.x release.
      2. Or, upgrade all the way to DSpace 6.x. DSpace 6 uses Flyway v4, which has fixed this checksum calculation bug in Flyway.

      As of DSpace 6, this issue no longer occur, as we have upgraded to Flyway 4 which fixes this line-ending checksum mismatch issue (see DS-3268).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                tdonohue Tim Donohue
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: