-
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
Don't seed tenant product features for tenant from remote region #18286
Don't seed tenant product features for tenant from remote region #18286
Conversation
8050f21
to
cfdc7b6
Compare
@carbonin small question, instances of |
cfdc7b6
to
deeed92
Compare
Every database object will belong to a region as it's calculated from the id value. Is that what you're asking @lpichler ? |
yes, thanks! |
app/models/tenant.rb
Outdated
@@ -292,6 +292,8 @@ def allowed? | |||
end | |||
|
|||
def create_miq_product_features_for_tenant_nodes | |||
return [] if !miq_region || MiqRegion.my_region_number != miq_region.region |
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.
I don't understand how this would solve the problem you're seeing. This method is only called by an after_create
hook, right? That isn't triggered when rows are replicated from remote regions so I don't see how this method would ever be called on an instance from a remote region in the global.
Are you sure this isn't being done in the Possibly this line should be Disclaimer though ... I haven't looked through all of this and I definitely don't fully understand it fully. |
Or even better, maybe this should be |
app/models/tenant.rb
Outdated
@@ -292,6 +292,8 @@ def allowed? | |||
end | |||
|
|||
def create_miq_product_features_for_tenant_nodes | |||
return [] if !miq_region || MiqRegion.my_region_number != miq_region.region | |||
|
|||
result = MiqProductFeature.with_tenant_feature_root_features.map.each do |tenant_miq_product_feature| |
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.
@lpichler I might not be understanding the issue fully but wouldn't the fix be to scope this query to the current region like this?
result = MiqProductFeature.in_my_region.with_tenant_feature_root_features.map.each do |tenant_miq_product_feature|
Then it would never involve product features from other regions
deeed92
to
c27f79a
Compare
@gtanzillo @carbonin thanks for leading me to correct fix! I had improper assumption about replication. (that is happening under SQL level) I described it in description. so let's imagine: global region 99: and then when Note:
|
c27f79a
to
f7a39d1
Compare
f7a39d1
to
a4f052d
Compare
Checked commit lpichler@a4f052d with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
👍 Looks like a better approach. MiqProductFeatures are excluded by default so we shouldn't be looping through those from remote regions. |
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.
You all came up with a great solution. nice teamwork
…atures_remote_tenants Don't seed tenant product features for tenant from remote region (cherry picked from commit 7909bf7) https://bugzilla.redhat.com/show_bug.cgi?id=1468795
Hammer backport details:
|
let's assume we replicated remote region to a global region,
then tenant records(from remote region) replicated to global region.
then
MiqProductFeaure.seed
is run on the global region - and it is causing creation of tenant product features also for tenants from remote region.Note: Highlighted features are created on remote tenants which are hidden in tenant tree.
This PR stops creation of such product tenant features for remote tenants.
Links
https://bugzilla.redhat.com/show_bug.cgi?id=1468795 (this PR is not last for the BZ, there is other bug)
#18100 - learn more about tenant product features
@miq-bot assign @gtanzillo
@miq-bot add_label hammer/yes, gaprindashvili/yes,blocker