manageiq icon indicating copy to clipboard operation
manageiq copied to clipboard

[WIP] Virtual attributes for Containers and friends (performance changes)

Open kbrock opened this issue 1 year ago • 11 comments

depends upon:

  • [x] https://github.com/ManageIQ/activerecord-virtual_attributes/pull/120
  • ~~https://github.com/ManageIQ/activerecord-virtual_attributes/pull/127~~

@agrare Can we outright claim that PersistentVolume#parent is always an Ems? I get that a ContainerVolume#parent is polymorphic, but curious about the child class (i.e.: PersistentVolume). If not, may need to drop that change.

Numbers

ms query qry ms rows comments
347.2 32 53.2 128 /container_node/report_data#node-index
308.8 11 10.3 28 /container_node/report_data#node-after
11.1% 66% 80.6% 78% diff
ms query qry ms rows comments
428.0 32 123.2 88 /container_group/report_data#group-index
336.5 11 65.5 28 /container_group/report_data#group-after
21.4% 66% 46.8% 68% diff
ms query qry ms rows comments
424.3 51 98.7 48 /container_image/report_data
345.1 11 34.4 28 /container_image/report_data
18.7% 78% 65.1% 42% diff

no longer:

ms query qry ms rows comments
278.6 31 12.7 48 /persistent_volume/report_data#before
258.7 11 9.9 28 /persistent_volume/report_data#after
7.1% 65% 22.0% 42% diff

kbrock avatar Jun 21 '23 15:06 kbrock

@kbrock it definitely defaults to the EMS I don't know if that is the only possible option but it does appear like it based on the kubernetes parser

agrare avatar Jun 21 '23 15:06 agrare

update:

  • rebased master
  • updated test to mark now sql friendly virtual attribute as ... sql friendly.

kbrock avatar Aug 01 '23 19:08 kbrock

update:

  • extracted container volume assumption that the persistent volume is always associated with an ems.

The savings are very good, but I am not ready to put my foot down on that one. The other changes are pretty much a no brainer.

UN-WIP: concerning commit around container volume and ems relationships

update:

  • rubocops: add :dependent, :inverse_of

kbrock avatar Aug 01 '23 22:08 kbrock

WIP: confusing CI values

I'm very confused by the failure. This works locally and I can't imagine where this could be going wrong. All test failures are the same. (I wrote the specs at the same time)

The spec(s) only shows partial SQL, but it looks like where(:id => subject.id) is sending the container_node.id as text instead of a numeric.

# rspec ./spec/models/container_group_spec.rb:53
# rspec ./spec/models/container_group_spec.rb:61
# rspec ./spec/models/container_node_spec.rb:50 <==

PG::UndefinedFunction: ERROR:  operator does not exist: bigint = text
LINE 1: ...OM "container_nodes" WHERE "container_nodes"."id" = $1 ORDER...

Again, the sql generated locally is working fine.

Also interesting:

subj = described_class.where(:id => container_group.id)
expect(subj.first.ready_condition_status).to eq("None") # works
expect(subj.select(:ready_condition_status).first.ready_condition_status).to eq("None") # failure

kbrock avatar Aug 01 '23 23:08 kbrock

update:

  • rebase
  • fixed extra file committed (thnx fry)

kbrock avatar Oct 20 '23 16:10 kbrock

Checked commits https://github.com/kbrock/manageiq/compare/53e95561fa104814c198b3480c86930a14d6dd10~...4cb708ab4c8c3ea291b132ddb97b312eaac7219f with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint 8 files checked, 0 offenses detected Everything looks fine. :+1:

miq-bot avatar Oct 31 '23 19:10 miq-bot

Overall LGTM - one real question, and some specs are failing, but maybe they go away with a rebase since Ruby 2.7 is gone now.

Fryguy avatar Nov 01 '23 19:11 Fryguy

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s).

miq-bot avatar Feb 05 '24 00:02 miq-bot

This pull request is not mergeable. Please rebase and repush.

miq-bot avatar Mar 07 '24 16:03 miq-bot

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s).

miq-bot avatar Jun 10 '24 00:06 miq-bot