-
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
Compare decimal columns correctly in batch saver #17020
Conversation
attribute_type = @model_class.type_for_attribute(key.to_s) | ||
pg_type = @pg_types[key.to_sym] | ||
|
||
if inventory_collection.use_ar_object? | ||
# When using AR object, lets make sure we type.serialize(value) every value, so we have a slow but always | ||
# working way driven by a configuration | ||
obj[key.to_sym] = attribute_type | ||
@serializable_keys[key.to_sym] = attribute_type | ||
@deserializable_keys[key.to_sym] = attribute_type |
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.
Initially I thought this unnecessary, but then I wrote the test and it failed with {:saver_strategy=>:batch, :use_ar_object=>true}
(duh, that's the one container refresh tests don't exercise 😉).
Turns out map_ids_to_inventory_objects
ignores use_ar_object and takes values from DB directly anyway (unless it has to use fallback query mode, with unrelated conditions).
So I set deserializable_keys
in use_ar_object mode too.
Should I rewrite map_ids_to_inventory_objects
to check use_ar_object
?
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.
Should I rewrite map_ids_to_inventory_objects to check use_ar_object?
Yeah, sound like we have to do it. And we should add 'use_ar_object' to containers specs.
Will allow container_quota_items.quota_* columns to be used in manager_ref. https://bugzilla.redhat.com/show_bug.cgi?id=1504560
36b78c3
to
500fb84
Compare
Checked commit cben@500fb84 with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0 spec/models/manager_refresh/save_inventory/saver_strategies_spec.rb
|
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.
looks good
@agrare the point is to do simple backportable change for now. For upstream we will refactor this to more generic solution. Problem is that the generic solution will be slower, so it would be nice if we could enable the parallel saving.
Compare decimal columns correctly in batch saver (cherry picked from commit d3f7348) https://bugzilla.redhat.com/show_bug.cgi?id=1559544
Gaprindashvili backport details:
|
After discussing with @agrare, reverted the backport from Gaprindashvili branch.
|
Marking as |
…zable_keys"" This reverts commit 9eab6ed, again merging pull request ManageIQ#17020 from cben/deserializable_keys Compare decimal columns correctly in batch saver (cherry picked from commit d3f7348) https://bugzilla.redhat.com/show_bug.cgi?id=1559544
…zable_keys"" This reverts commit 9eab6ed, again merging pull request ManageIQ#17020 from cben/deserializable_keys Compare decimal columns correctly in batch saver (cherry picked from commit d3f7348) https://bugzilla.redhat.com/show_bug.cgi?id=1559544
Backported to Gaprindashvili via #17214 |
Extracted from #16722. Will allow
container_quota_items.quota_*
decimal columns to be used in manager_ref.@Ladas Thanks for pointers last week! Please review.
cc @agrare
https://bugzilla.redhat.com/show_bug.cgi?id=1504560
@miq-bot add-label enhancement, gaprindashvili/yes