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

Order in which callbacks are executed #1296

Closed
ridiekel opened this issue Apr 26, 2016 · 1 comment
Closed

Order in which callbacks are executed #1296

ridiekel opened this issue Apr 26, 2016 · 1 comment
Labels
Milestone

Comments

@ridiekel
Copy link

@ridiekel ridiekel commented Apr 26, 2016

Hi,

In Flyway 4.0.0 we are using callback to do validation and other tasks that need to be executed after every migration.
We would expect those callbacks to be executed in the order we give them to Flyway. However they are executed in random order.

We looked at flyway code and found that the callbacks are being put in a HashSet. We think this causes the callbacks to be put in random order (Set flywayCallbacks = new HashSet(Arrays.asList(callbacks)); in Flyway.java at 1348)

For now we can work around this issue by creating a callback that contains callbacks and executes them in the correct order, but we doubt this is a good practice.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented May 6, 2016

Good catch! Changed to LinkedHashSet instead.

@axelfontaine axelfontaine added this to the Flyway 4.0.1 milestone May 6, 2016
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue May 6, 2016
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.