Closed danielmarbach closed 5 years ago
Thanks for the heads-up! I'm not using RavenMigrations much these days, but others at my organization are, so they may be interested in what's going on here. I'll make sure to add them as collaborators.
Sorry the branch has been deleted. I'll try to restore and and copy paste the solution here
Here is the gist
I'm considering moving the next major version of Raven Migrations to be fully async. It's going to be a breaking change, however.
For now, I'm closing this issue, as the gist above runs against an old Raven that is no longer applicable.
Hi all,
I just wanted to give a heads-up that I have been playing around with the Raven.Migrations codebase again and wrote a custom infrastructure which is async from top to bottom. You can find the code here:
https://github.com/Particular/ServiceControl/tree/ReworkMigrations/src/ServiceControl.Migrations/Infrastructure
It's not done, currently I haven't added the necessary attributions to Raven.Migrations but I hope you forgive my sloppiness when you actually contribute ideas back...
I did a behavioral change as well in order to improve performance. Basically the
MigrationAttribute
has no longer a propertyVersion
. It is now calledExecutionOrder
. Now because everything is async you can have two migrations with the sameExecutionOrder
and they are run in Parallel behind the scenes for you. We all now RavenDB is not the fastest when it comes to migrations. And this improves performance a lot while still making sure that Migrations which should be executed after each other are still executed in the rightExecutionOrder
You can see an example of that https://github.com/Particular/ServiceControl/blob/ReworkMigrations/src/ServiceControl.Migrations/ProcessedMessageMigration.cs#L9 https://github.com/Particular/ServiceControl/blob/ReworkMigrations/src/ServiceControl.Migrations/FailedMessageMigration.cs#L11
And the beautiful code which makes that happen ;)
https://github.com/Particular/ServiceControl/blob/ReworkMigrations/src/ServiceControl.Migrations/Infrastructure/Runner.cs#L22
Feel free to copy the ideas back if you like it