Fix number of events stored in EventStore and adjust aggregation methods #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before:
Earlier, each and every event occurring during migration was stored in
EventStore
. It was not problematic for small migrations, as most types of events are emitted only once per collection migration.But there are two events -
DumpUpdateEvent
andRestoreUpdateEvent
which are emitted every single time that mongodump/mongorestore writes on stdout. It occurs a lot of times (for long-taking migrations of large databases).As number of events in
EventStore
grew up more and more, it was taking much more time to aggregate all the events, and calculate current state of migration.After:
The most important change in this PR is the fact, that event of given type, can be stored only once in
EventStore
, and if there was earlier an event of a given type, it will be overriden.Thanks to that, number of events will be reduced to max of
number_of_migrated_collections * types_of_events
, which will significantly improve aggregation time.