-
Notifications
You must be signed in to change notification settings - Fork 897
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
[GAPRINDASHVILI] Use AREL for custom_attributes virtual_attributes in MiqReport ONLY #17629
[GAPRINDASHVILI] Use AREL for custom_attributes virtual_attributes in MiqReport ONLY #17629
Conversation
@miq-bot add_label blocker, core, enhancement, fine/yes |
a56d063
to
8df68fd
Compare
@NickLaMuro can you ping someone to review. |
@JPrause Tests are failing, so not worth their time at the moment. I am working on them as we speak. |
8df68fd
to
f466d4b
Compare
@@ -284,7 +295,11 @@ def _generate_table(options = {}) | |||
:skip_counts => true, | |||
) | |||
|
|||
rbac_opts[:extra_cols] = va_sql_cols unless va_sql_cols.nil? || va_sql_cols.empty? | |||
if va_sql_cols.present? || custom_attributes_sql_cols.present? |
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.
At a glance, this probably looks like redundant if checks, but basically we want to have rbac_opts[:extra_cols
to be either not set, or a populated array. Otherwise this fails in ar_virtual.rb
with the over written .select
with have code around.
f466d4b
to
138c3ce
Compare
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.
nice job Nick
Don't Merge! Looks like I have one thing to fix causing the specs to fail. Will get to it shortly. Update: Should be fixed now. |
https://bugzilla.redhat.com/show_bug.cgi?id=1594027 https://bugzilla.redhat.com/show_bug.cgi?id=1594027 This is a reworking of all of the commits in: ManageIQ#17626 Previous commits include: 0ad75c2 e7fd484 065405d * * * Allows MiqReport generation to a form of SQL for the custom_attribute columns, but not use virtual_attributes as the mechanism for it since they are not supported in other places (like `MiqExpression`) in this version of the application. See ManageIQ#17626 for more details.
138c3ce
to
ae523a7
Compare
Checked commit NickLaMuro@ae523a7 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
…a_cols_for_miq_reports_gapindashvili [GAPRINDASHVILI] Use AREL for custom_attributes virtual_attributes in MiqReport ONLY (cherry picked from commit d7d0f96) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1594028
Fine backport details:
|
Backport rework of #17615 for gapindashvili
https://bugzilla.redhat.com/show_bug.cgi?id=1594027
https://bugzilla.redhat.com/show_bug.cgi?id=1594027
This is a reworking of all of the commits in:
Previous commits include:
0ad75c2
e7fd484
065405d
Allows MiqReport generation to use Arel columns for the custom_attribute cols, but not use virtual_attributes as the mechanism for it, since they are not supported in other places (like
MiqExpression
) in this version of the application.This is a single commit for the changes, since they are not really the mechanism we want going forward, and allow for an easier backport for fine.
Original commit message below
Converts the
virtual_column
definitions inCustomAttributeMixin
to support thearel
attribute, and allowMiqReport#generate
to take advantage of this, and avoid needing an extra include.Other notable changes:
custom_attributes
have arel backedvirtual_attribute
(akavirtual_column
) methods, then the includes of:custom_attributes => {}
will be removed from theRbac
query. A helper method was added to assist with thisvirtual_attribute
from the instance will now check the attributes hash prior to executing the rest of the method, and return something if it has a keyvirtual_attribute
method definition and would be in thecustom_attribute_arel
method have been extracted out so it is only calculated once (minor performance benefit).Benchmarks
These benchmarks are currently a work in progress, and contain some incomplete data. Most of those inconsistencies are noted in below.
Tested on a local machine with the DB running on the same machine, so next to no network based latency for queries is observed.
Before
50 uniq query types executed. 212961 are just the N+1 fetching
custom_attributes
Raw
Benchmark.measure
numbers:After
While that patch was present during the benchmarks, most of what is done in this patch negates it's usefulness, so almost everything seeing here is from the changes in this pull request.
NOTE: 10141 of the total queries and ~3580ms of the
query (ms)
here areINSERT
statements intomiq_report_result_details
.Raw
Benchmark.measure
numbers:Links