migrating-ravens / RavenMigrations

A small migrations framework to help you manage your RavenDB Instance.
MIT License
53 stars 24 forks source link

Async from top to bottom #36

Closed danielmarbach closed 5 years ago

danielmarbach commented 9 years ago

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 property Version. It is now called ExecutionOrder. Now because everything is async you can have two migrations with the same ExecutionOrder 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 right ExecutionOrder

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

dportzline83 commented 9 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.

danielmarbach commented 8 years ago

Sorry the branch has been deleted. I'll try to restore and and copy paste the solution here

danielmarbach commented 8 years ago

Here is the gist

https://gist.github.com/danielmarbach/bfb06208a74d42306c16

JudahGabriel commented 5 years ago

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.