-
Notifications
You must be signed in to change notification settings - Fork 898
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
Concurent safe batch saver #15247
Concurent safe batch saver #15247
Conversation
@miq-bot add_label enhancement |
@Ladas 'enhancement' is an invalid assignee, ignoring... |
@miq-bot add_label enhancement |
Helper methods for building batch SQL create/update. For create method, we also have a build_multi_selection_query that is able to fetch the batch created objects, using their unique indexes.
Fix rubocop issue if -> next
Include SqlHelper module to a saver base class
Extract batch_size to a base class
Extract delete_record method to a base class
Use base class delete_record method
Use a base class methods in concurent_safe saver
Add concurrent_batch_safe saver
1a268ed
to
25840aa
Compare
Checked commits Ladas/manageiq@0e2a1f9~...25840aa with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM for now until we can implement it in arel
Depends on:
Concurent batch safe saver strategy. Allowing us to do create&update in batched SQL queries, which will save a lot o time, using a remote db. (having 5ms network latency, we save ~1.5h on 1M of records being created/updated)
TBD:
A possbile candidate for replacing the INSERT ON CONFLICT UPDATE query is https://github.com/zdennis/activerecord-import/wiki/On-Duplicate-Key-Update
Also filled issue in Arel, since that would be the best to use:
rails/arel#485