Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MigrationInfoImpl (still) violates compareTo contract #1890

Closed
lgoldstein opened this issue Jan 8, 2018 · 7 comments
Closed

MigrationInfoImpl (still) violates compareTo contract #1890

lgoldstein opened this issue Jan 8, 2018 · 7 comments

Comments

@lgoldstein
Copy link

@lgoldstein lgoldstein commented Jan 8, 2018

What version of Flyway are you using?

5.0.5

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)

Java API

What database are you using (type & version)?

PostgreSQL 9.3/9.5/9.6

What operating system are you using?

Fedora 25/26/27

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
Simply ran a standard migrate call with default locations (db/migration), settings (SQL scripts), etc.

What did you expect to see?

Successful upgrade - Note: the same code works just find in version 4.x

What did you see instead?
java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.util.ComparableTimSort.mergeHi(ComparableTimSort.java:866)
        at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:483)
        at java.util.ComparableTimSort.mergeForceCollapse(ComparableTimSort.java:422)
        at java.util.ComparableTimSort.sort(ComparableTimSort.java:222)
        at java.util.Arrays.sort(Arrays.java:1312)
        at java.util.Arrays.sort(Arrays.java:1506)
        at java.util.ArrayList.sort(ArrayList.java:1454)
        at java.util.Collections.sort(Collections.java:141)
        at org.flywaydb.core.internal.info.MigrationInfoServiceImpl.refresh(MigrationInfoServiceImpl.java:261)
        at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:198)
        at org.flywaydb.core.internal.command.DbMigrate.access$300(DbMigrate.java:50)
        at org.flywaydb.core.internal.command.DbMigrate$4.call(DbMigrate.java:177)
        at org.flywaydb.core.internal.command.DbMigrate$4.call(DbMigrate.java:174)
        at org.flywaydb.core.internal.database.postgresql.PostgreSQLAdvisoryLockTemplate.execute(PostgreSQLAdvisoryLockTemplate.java:71)
        at org.flywaydb.core.internal.database.postgresql.PostgreSQLConnection.lock(PostgreSQLConnection.java:110)
        at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:144)
        at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:174)
        at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:143)
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:1206)
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:1168)
        at org.flywaydb.core.Flyway.execute(Flyway.java:1650)
        at org.flywaydb.core.Flyway.migrate(Flyway.java:1168)

If I could I would have re-opened issue #1249. Note that the exception is intermittent - which leads me to believe that it depends on the order that the migration script candidates are scanned on the disk/JAR (and also makes it extremely difficult to pin-point which exact 2 scripts are failing - especially due to the total lack of logging messages).
The core problem though seems to be that the comparison is inconsistent - worth reading https://dertompson.com/2012/11/23/sort-algorithm-changes-in-java-7/ which demonstrates a common pitfall.

@lgoldstein
Copy link
Author

@lgoldstein lgoldstein commented Jan 8, 2018

Here is some more information about the result when it does succeed:

+------------+-----------+---------------------------------------------------------------+----------+---------------------+----------------+
| Category   | Version   | Description                                                   | Type     | Installed On        | State          |
+------------+-----------+---------------------------------------------------------------+----------+---------------------+----------------+
| Repeatable |           | 01-Users                                                      | SQL      | 2018-01-07 12:19:38 | Missing        |
| Repeatable |           | 02-UserRoles                                                  | SQL      | 2018-01-07 12:19:39 | Missing        |
| Repeatable |           | 03-Presets                                                    | SQL      | 2018-01-07 12:19:39 | Missing        |
| Repeatable |           | 04-SequencersInitialization                                   | SQL      | 2018-01-07 12:19:39 | Missing        |
| Repeatable |           | 11-DeployPresets                                              | SQL      | 2018-01-07 12:19:39 | Missing        |
| Repeatable |           | 12-DeployColumns                                              | SQL      | 2018-01-07 12:19:39 | Missing        |
| Repeatable |           | 13-DeviceUserRoles                                            | SQL      | 2018-01-07 12:19:39 | Missing        |
| Repeatable |           | 14-ResultColumns                                              | SQL      | 2018-01-07 12:19:39 | Missing        |
| Repeatable |           | 15-InfoGraphs                                                 | SQL      | 2018-01-07 12:19:39 | Missing        |
| Repeatable |           | 16-TableMeta                                                  | SQL      | 2018-01-07 12:19:39 | Missing        |
| Repeatable |           | 17-AllocationFields                                           | SQL      | 2018-01-07 12:19:39 | Missing        |
| Repeatable |           | 18-Reasons                                                    | SQL      | 2018-01-07 12:19:39 | Missing        |
| Versioned  | 3.2.0.1   | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.0.2   | SchemaUpdates                                                 | SQL      |                     | Below Baseline |
| Versioned  | 3.2.1.1   | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.1.2   | SetNotNullWatchParameter                                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.2.1   | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.3.1   | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.4.4   | SetRecurrencesResultColumn                                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.5.1   | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.6.8   | CreateRecommendationPatternFeaturesTable                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.6.9   | CreateRecommendationCasesTable                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.6.10  | AddTotalMonthlyRevenueInfoGraph                               | SQL      |                     | Below Baseline |
| Versioned  | 3.2.7.1   | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.7.3   | UpdateRecommendationRelatedEntitiesStructure                  | SQL      |                     | Below Baseline |
| Versioned  | 3.2.7.4   | RemoveRecommendationDsiIdResultColumn                         | SQL      |                     | Below Baseline |
| Versioned  | 3.2.7.6   | AddNotNullColumnsConstraints                                  | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.2   | AddFavoritesTableIndexes                                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.3   | ServeRecommendationsFromApplication                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.4   | CreateRecommendationDistributionsTable                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.5   | CreateRecommendationValuesTable                               | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.6   | UpdateDeploymentRelatedTables                                 | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.8   | UseIndependentFavoritesTableSequencer                         | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.10  | AddGuidColumnToDeviceUsers                                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.12  | AddPostAnalysisRetrievalTrackingFields                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.13  | FixRecommendationsCountInfoGraphValueType                     | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.15  | AddResultMetadataSupportTables                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.17  | UsePrimitivesForStoreCategoriesPojos                          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.19  | AddRecommendationInsightId                                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.20  | AddEnabledColumnToDeviceUsers                                 | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.21  | CorrectlyImportRecommendationsFromEngine                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.3  | ResurrectDisabledUsers                                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.4  | AddActionItemGuid                                             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.6  | PresetTableUniqueConstraintToBeInitiallyDeferred              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.7  | PresetTableColumnsRestrictionsUpdate                          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.8  | AddRecommendationSimilarStoresValuesColumns                   | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.10 | AddTargetSalesAndUnitsDeployColumns                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.11 | AddPastAndSimilarStoresSalesAndUnitsDeployColumns             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.12 | CreateDeviceUsersAliasTable                                   | SQL      |                     | Below Baseline |
| Versioned  | 3.2.11.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.11.3  | AddBqModelRecoveryStatusTracking                              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.11.7  | AddMissingForeignKeysIndexes                                  | SQL      |                     | Below Baseline |
| Versioned  | 3.2.11.8  | AddQueriesRelatedIndexes                                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.11.9  | UseStandardAccessibleResourceProperties                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.11.10 | RestartRecommendationSequencerWith15Digits                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.2  | C-B4ToCB4AnalystRoleGroupRename                               | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.7  | AddViewedToActionItem                                         | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.10 | DefineAccessibleResourceTables                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.13 | UpdateAccessibleResourceTables                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.17 | AddReasonOrder                                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.13.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.13.2  | AddMobileAppVersionToDeviceUser                               | SQL      |                     | Below Baseline |
| Versioned  | 3.2.13.3  | AddLastStatusUpdateDateToDeviceUser                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.13.5  | UpdateLastRecurrenceColumnNullsToEpochZero                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.5  | AddResponseRetrivalDateToActionItem                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.6  | DeleteAllStatusRetrivalTriggers                               | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.9  | AddDayOfWeekToDS                                              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.14 | AddWeeklyPotentialRevenueToRecommendations                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.15 | AddWeeklyPotentialUnitsToRecommendations                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.16 | AddResendResponseToActionItem                                 | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.18 | AddEffectiveDeployDateToDeploymentAction                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.19 | updateExpiredActionItems                                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.20 | AddExpiredDateToActionItem                                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.6  | AddViewDashboardRoleAndMapping                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.7  | CascadeReasonDeletionToLocalesTable                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.8  | AddViewReasonsBtnsRoleAndMapping                              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.10 | StandardizeCustomerActivityMetadataTable                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.11 | ChangeCustomerActivityTable                                   | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.13 | AddReasonOtherIndicator                                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.2  | StandardizeUsersTable                                         | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.3  | AddUserPublicKeyColumn                                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.5  | AddLastUserResponseDate                                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.7  | AddReasonGroup                                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.17.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.17.2  | AddRecommendationReducedProductFactorKey                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.18.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.18.4  | RenameDataSourceSchedulerAutoRefresh                          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.18.5  | DropCustomerActivityMetadataForeignKey                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.19.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.19.5  | FixDefaultStoreAndProductKeyAllocationFieldsNames             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.19.9  | RemoveIndexesOverlappingUniqueConstraintsDefinitions          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.2  | AddTimeIntervalDeployColumnForMobile                          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.3  | StoreToDsIdNamingConvention                                   | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.6  | AddInventoryLatestDateToRecommendation                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.7  | AddColorColumnToCustormerActivity                             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.8  | InsertInventoryLatestDateResultColumn                         | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.10 | InsertInventoryDateDeployColumn                               | SQL      |                     | Below Baseline |
| Versioned  | 3.2.21    | << Flyway Baseline >>                                         | BASELINE | 2018-01-07 12:19:24 | Baseline       |
| Versioned  | 3.2.21.1  | Baseline                                                      | SQL      | 2018-01-07 12:19:28 | Success        |
| Versioned  | 3.2.21.2  | AddWeeksWithoutSalesResultColumn                              | SQL      | 2018-01-07 12:19:35 | Success        |
| Versioned  | 3.2.21.3  | EstablishResultBasket                                         | SQL      | 2018-01-07 12:19:35 | Success        |
| Versioned  | 3.2.21.4  | CascadeDeletionsOfBQsAndBQIs                                  | SQL      | 2018-01-07 12:19:35 | Success        |
| Versioned  | 3.2.21.5  | QuicklyEliminateDuplicateRecommendationsInSameBasket          | SQL      | 2018-01-07 12:19:35 | Success        |
| Versioned  | 3.2.21.6  | AddBqiRecommendationCounts                                    | SQL      | 2018-01-07 12:19:35 | Success        |
| Versioned  | 3.2.21.7  | AddDeviceUserNameToCustomerActivity                           | SQL      | 2018-01-07 12:19:35 | Success        |
| Versioned  | 3.2.1.3   | SetNotNullColumnPojoVisibilityFlags                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.4.1   | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.4.5   | UpdateBusinessQuestionModelsNotNullableFields                 | SQL      |                     | Below Baseline |
| Versioned  | 3.2.5.2   | DedupAndAddUniqueConstraintToBaseDataSourceAvailableTimeUnits | SQL      |                     | Below Baseline |
| Versioned  | 3.2.5.3   | AddMobileVersionColumnsToDeploymentMetadata                   | SQL      |                     | Below Baseline |
| Versioned  | 3.2.6.1   | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.6.3   | CreateRecommendationsTable                                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.6.4   | CreateNegativeEffectsTable                                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.6.5   | CreateRecommendationIdentifiersTable                          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.6.6   | CreateRecommendationPatternsTable                             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.6.7   | CreateRecommendationPatternSourcesTable                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.7.2   | RefactorRecommendationIdentifiersTable                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.7.5   | ShortenInfographHeaders                                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.8.1   | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.8.2   | AddBusinessQuestionModelsImportTrackingFields                 | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.1   | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.7   | IntroduceNotDeployedStatus                                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.9   | DeleteOrphanFavorites                                         | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.11  | CreateInfoGraphsSupportDataTable                              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.14  | FixInfoGraphsTableColumnsDefinitions                          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.16  | UsePrimitivesForResultColumnFlags                             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.9.18  | UsePrimitivesForFilteredStoreCategories                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.2  | AddRecommendationRecurrenceFields                             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.5  | AddRecommendationTargetValuesColumns                          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.10.9  | TaskRequestBuilderColumnsUpdates                              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.11.2  | UpdateBqFilterFields                                          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.11.4  | AddBqInstanceRecoveryStatusTracking                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.11.5  | UpdateFixedJPAFieldsDefinitions                               | SQL      |                     | Below Baseline |
| Versioned  | 3.2.11.6  | AddMissingIdentifierIndexes                                   | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.3  | AddStoresRelatedTables                                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.4  | AddDataLoadEntitiesRetrievalDefinitions                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.5  | AddVersionToActionItem                                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.6  | AddLifeCycleToActionItem                                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.8  | AddDeployedOnlyToPreset                                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.9  | ChangeStateNewToOpenInActionItems                             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.14 | UnlinkReasonFromDeploymentReason                              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.15 | AddDsIdTDeviceUser                                            | SQL      |                     | Below Baseline |
| Versioned  | 3.2.12.16 | ChangeOtherReasonsToStatusDone                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.13.4  | RenameDeployedColumnAndSetNotNull                             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.13.6  | AdjustNegativeEffectPrimitiveValuesDefinitions                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.2  | AddCalculateNegativeEffect                                    | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.3  | CreateCustomerActivityMetadataTable                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.4  | CreateCustomerActivityTable                                   | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.7  | AddProductsRelatedTables                                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.8  | TriggerProductsRecovery                                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.10 | AddDayOfWeekToDSI                                             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.11 | AvgMonthlyPotentialReveueInfoGraphRename                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.12 | EnforceVisibleRecommendationsHaveActions                      | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.13 | InsertWeeklyPotentialsResultColumn                            | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.17 | setDeviceUserLastRetrivalDateOneWeekAgo                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.14.21 | ActivateQuartzJobsAutoRecovery                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.2  | FixDeploymentsForeignKeysCascades                             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.3  | AddWeeksWithoutSales                                          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.4  | CreatePriorityWeights                                         | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.5  | DeletePriorityValuesDataSource                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.9  | AddViewPriorityValuesRoleAndMapping                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.12 | AddReasonFreeTextColumn                                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.15 | ActivateQuartzJobsAutoRecovery                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.16 | ActionItemSentToDashboardFalse                                | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.17 | AddCustomerActivityStoreEffectiveDeployDateIndex              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.15.18 | AddCustomerActivityStoreIdentifierIndex                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.4  | AddReasonEscalate                                             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.6  | AddPlanogramsToCustomerActivityMetadataTable                  | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.8  | AddCustomerActivityStoreEffectiveDeployDateIndex              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.9  | AddCustomerActivityStoreIdentifierIndex                       | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.10 | AddRemoveAbsentSalesEntriesFlag                               | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.11 | ActionItemStateNotNull                                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.12 | CustomerActivityStateNotNull                                  | SQL      |                     | Below Baseline |
| Versioned  | 3.2.16.13 | AddRecommendationIdDeployColumnForFashion                     | SQL      |                     | Below Baseline |
| Versioned  | 3.2.18.2  | AddCalculateClearOut                                          | SQL      |                     | Below Baseline |
| Versioned  | 3.2.18.3  | CustomerActivityGroupsValuesNotNull                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.19.2  | DeleteUnDeployedCustomerActivity                              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.19.3  | PersistEngineGeneratedUniqueRecommendationIdValue             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.19.4  | UseNonPrimaryKeysJoinForRecommendationIdentifiers             | SQL      |                     | Below Baseline |
| Versioned  | 3.2.19.6  | AddReferenceDsi                                               | SQL      |                     | Below Baseline |
| Versioned  | 3.2.19.7  | AddVirtualFlagToDSI                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.19.8  | CoordinateUniqueConstraintsDefinitions                        | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.1  | BaselinePlaceholder                                           | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.4  | Hibernate5StricterDefinitions                                 | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.5  | AddDashboardSectorKeyTables                                   | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.9  | InsertInventoryLevelDeployColumn                              | SQL      |                     | Below Baseline |
| Versioned  | 3.2.20.11 | UpdateNumIterationInMonthColumn                               | SQL      |                     | Below Baseline |
+------------+-----------+---------------------------------------------------------------+----------+---------------------+----------------+

One thing stands out (to me) - the repeatable scripts are marked as Missing even though they have been applied (as indicated by the Installed on timestamp).

Loading

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 8, 2018

The missing status is actually possible as missing means was applied, but file is no longer there.

The odd things are

  • all those below baseline migrations being sorted after the baseline
  • the missing repeatable migrations being sorted after the baseline

I must admit I am a little bit at a loss as to what could be causing this. Any reproducible test case would be immensely useful to fix this.

Loading

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 8, 2018

I have just pushed a commit which simplifies the compare logic slightly. Could you build Flyway from source (it's easy) and let me know if the problem persists?

Loading

@lgoldstein
Copy link
Author

@lgoldstein lgoldstein commented Jan 8, 2018

I wish I could - however it is an intermittent problem - so much so that re-running the command without any changes usually succeeds (which indicates some non-deterministic order...). Furthermore, it happens relative rarely (especially since we added -Djava.util.Array.legacySort=true) so I could try it 100 times and maybe have it fail once. And even if it does not fail, it does not mean that bug is fixed - it may just be harder to time it correctly...

I have not had enough time to really dwell into the comparison logic, but it seems quite complex. Perhaps one should first brainstorm from scratch (as if writing it for the 1st time), decide on the exact list of the comparison "tie-breakers" and then implement them - e.g.:

  • Ranked comes before/after un-ranked - if both ranked, then rank decides order
  • Versioned before non-versioned - if both versioned then version decides order
  • Repeatable before/after whatever other, etc.
  • State X comes before state Y (if state is an enum than exact order of all states)
  • Finally, if both of same type then description decides order

Loading

@axelfontaine axelfontaine removed this from the Flyway 5.1.0 milestone Jan 16, 2018
@axelfontaine axelfontaine added this to the Flyway 5.0.6 milestone Jan 16, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 16, 2018

I am assuming this is fixed. Please reopen if not.

Loading

axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Jan 16, 2018
@lgoldstein
Copy link
Author

@lgoldstein lgoldstein commented Jan 16, 2018

I will be able to know better once you release a new version and we start using it. Meanwhile, thanks for the effort.

Loading

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 16, 2018

5.0.6 was released today.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants