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

Repair dry-run: java.lang.IndexOutOfBoundsException #1950

Closed
bohalloran-chwy opened this issue Mar 12, 2018 · 3 comments
Closed

Repair dry-run: java.lang.IndexOutOfBoundsException #1950

bohalloran-chwy opened this issue Mar 12, 2018 · 3 comments

Comments

@bohalloran-chwy
Copy link

@bohalloran-chwy bohalloran-chwy commented Mar 12, 2018

Which version and edition of Flyway are you using?

Flyway Trial Edition 5.0.7 by Boxfuse

If this is not the latest version, can you reproduce the issue with the latest one as well?

(Many bugs are fixed in newer releases and upgrading will often resolve the issue)
N/A

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

Command-line

Which database are you using (type & version)?

PostgreSQL 9.6

Which operating system are you using?

Client host
BOS1002962L:flyway bohalloran$ uname -a
Darwin BOS1002962L 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
BOS1002962L:flyway bohalloran$

Server host
CentOS Linux release 7.3.1611 (Core)

What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)

BOS1002962L:flyway bohalloran$ ./flyway repair -url=jdbc:postgresql://xxx.chewy.com:5432/denver -X
Flyway Trial Edition 5.0.7 by Boxfuse
WARNING: You are using the 30 day limited Flyway Trial Edition. After 30 days you must remove this version and either upgrade to Flyway Pro Edition or Flyway Enterprise Edition or downgrade to Flyway Community Edition.

DEBUG: Java 1.8.0_161 (Oracle Corporation)
DEBUG: Mac OS X 10.13.3 x86_64

DEBUG: Loading config file: /Users/bohalloran/flyway/conf/flyway.conf
DEBUG: Unable to load config file: /Users/bohalloran/flyway.conf
DEBUG: Unable to load config file: /Users/bohalloran/flyway/flyway.conf
Database password: 
DEBUG: Using configuration:
DEBUG: flyway.baselineOnMigrate -> true
DEBUG: flyway.mixed -> true
DEBUG: flyway.locations -> filesystem:/Users/bohalloran/flyway/sql
DEBUG: flyway.password -> ************
DEBUG: flyway.table -> schema_version
DEBUG: flyway.dryRunOutput -> /Users/bohalloran/flyway/output/test.sql
DEBUG: flyway.url -> jdbc:postgresql://xxx.chewy.com:5432/denver
DEBUG: flyway.user -> bohalloran
DEBUG: flyway.jarDirs -> /Users/bohalloran/flyway/jars
...
...
...
DEBUG: Adding location to classpath: /Users/bohalloran/flyway/drivers/hsqldb-2.4.0.jar
WARNING: Overwriting existing dry run out file /Users/bohalloran/flyway/output/test.sql ...
=================================================================================================================================
Dry Run: Database will NOT be modified. The following messages only represent what would happen in a normal Flyway migration run.
=================================================================================================================================
Database: jdbc:postgresql://xxx.chewy.com:5432/denver (PostgreSQL 9.6)
DEBUG: DDL Transactions Supported: true
DEBUG: Schema: public
DEBUG: Spring Jdbc available: false
DEBUG: Scanning for SQL callbacks ...
DEBUG: Scanning for filesystem resources at '/Users/bohalloran/flyway/sql' (Prefix: '', Suffixes: '.sql')
DEBUG: Scanning for resources in path: /Users/bohalloran/flyway/sql (/Users/bohalloran/flyway/sql)
...
...
...
DEBUG: Rolling back transaction...
DEBUG: Transaction rolled back
ERROR: Unexpected error
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
	at java.util.ArrayList.rangeCheck(ArrayList.java:657)
	at java.util.ArrayList.set(ArrayList.java:448)
	at org.flywaydb.core.internal.schemahistory.pro.InMemorySchemaHistory.update(InMemorySchemaHistory.java:139)
	at org.flywaydb.core.internal.command.DbRepair.alignAppliedMigrationsWithResolvedMigrations(DbRepair.java:160)
	at org.flywaydb.core.internal.command.DbRepair.access$300(DbRepair.java:44)
	at org.flywaydb.core.internal.command.DbRepair$2.call(DbRepair.java:121)
	at org.flywaydb.core.internal.command.DbRepair$2.call(DbRepair.java:117)
	at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:75)
	at org.flywaydb.core.internal.command.DbRepair.repair(DbRepair.java:117)
	at org.flywaydb.core.Flyway$7.execute(Flyway.java:1373)
	at org.flywaydb.core.Flyway$7.execute(Flyway.java:1366)
	at org.flywaydb.core.Flyway.execute(Flyway.java:1655)
	at org.flywaydb.core.Flyway.repair(Flyway.java:1366)
	at org.flywaydb.commandline.Main.executeOperation(Main.java:174)
	at org.flywaydb.commandline.Main.main(Main.java:108)
BOS1002962L:flyway bohalloran$ 
What did you expect to see?

Successful repair

What did you see instead?

java.lang.IndexOutOfBoundsException

@axelfontaine axelfontaine changed the title flyway repair: java.lang.IndexOutOfBoundsException Repair dry-run: java.lang.IndexOutOfBoundsException Mar 12, 2018
@axelfontaine axelfontaine added this to the Flyway 5.1.0 milestone Mar 12, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Mar 12, 2018

Thanks for reporting. This only seems to be affecting the dry-run case. Unsetting flyway.dryRunOutput will result in a successful repair.

@bohalloran-chwy
Copy link
Author

@bohalloran-chwy bohalloran-chwy commented Mar 13, 2018

Thanks, that worked, it's safe to go ahead and close this issue.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Mar 13, 2018

Reopening until this is fixed.

axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Apr 3, 2018
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
2 participants
You can’t perform that action at this time.