Skip to content

#21853: Allow mview indexers to use different entity columns. #21857

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

Merged
merged 25 commits into from
Jan 24, 2021

Conversation

nikunjkotecha
Copy link

@nikunjkotecha nikunjkotecha commented Mar 20, 2019

Fixes: #21853

Related Pull Requests

https://github.com/magento/partners-magento2ee/pull/413

This is not final expected change and only here to show the issue and proposed direction for the fix.

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Mar 20, 2019

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @nikunjkotecha. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@orlangur
Copy link
Contributor

@akaplya could you check if current behavior is intentional?

@aleron75
Copy link
Contributor

aleron75 commented Jul 8, 2019

Hello, I just experiencing the same issue and IMO it's not an intentional behavior since the result changes depending on the way you set the indexing mode on all the indexes or on a single one.

@aleron75 aleron75 marked this pull request as ready for review August 19, 2019 07:28
@josefbehr
Copy link
Contributor

@magento-engcom-team How shall we proceed with this? Merge this proposed change for the time being, or is further work required?

@josefbehr josefbehr self-assigned this Aug 23, 2019
@sidolov sidolov changed the base branch from 2.3-develop to 2.4-develop December 5, 2019 17:21
@ihor-sviziev
Copy link
Contributor

@sdzhepa @slavvka,
This PR got stuck for almost 1 year.
Could you check what's wrong with it? Should we get approval?

@ihor-sviziev
Copy link
Contributor

@slavvka you moved this PR to "on hold", could you describe why and what we're waiting for?

@ihor-sviziev ihor-sviziev self-assigned this Mar 3, 2020
@slavvka
Copy link
Member

slavvka commented Mar 3, 2020

@ihor-sviziev sorry for not having added the explanation. We are waiting for the review from Magento architect team

@ihor-sviziev
Copy link
Contributor

@nikunjkotecha while we're waiting for Architecture team review - could you sign Adobe CLA?

@nikunjkotecha
Copy link
Author

done

Copy link
Contributor

@lenaorobei lenaorobei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please change the logic in order to read the correct column name in the buildStatement method instead of create and delete.

The issue is caused because thе changelog is missing subscription column name.

@@ -117,8 +117,19 @@ public function create()

// Add statements for linked views
foreach ($this->getLinkedViews() as $view) {
// Store current column name for reverting back later.
$originalColumnName = $this->getColumnName();
Copy link
Contributor

@lenaorobei lenaorobei Mar 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solution looks like we are trying to hack the subscription logic by changing object property and misuse the columnName .
What we actually need is subscription column name, not the changelog column name (which is all the time the same).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lenaorobei I looked at the code again and your comment and it's a bit confusing
1/ It seems we both agree we need to use the subscription column name
2/ I'm not sure why you mention not the changelog column name, we need two column names - changelog column is for the changelog table and that's not going to change (even you mentioned same). What we need is to change how we read the subscription column name

My understanding, Subscription is created once for all the subscribers together and whichever subscription we modify last - columnName is used from that and re-used for all the triggers.

I've tried to simplify the code to make it look not (or less) hacky but to me it seems changes are required in the same direction as I've taken or a major rework would be required in how the subscriptions are created (refactor how the statement is built for linked views)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, we need both changelog and subscription column names, but $this->getColumnName() is changelog column, not the subscription one.
I recommended to move the logic of getting its name to the buildStatement method in order to cover both cases - create and delete.

Copy link
Author

@nikunjkotecha nikunjkotecha Apr 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have any object / data available as of now in buildStatement to get the column name of the linked view for which buildStatement is called.

We can pass full view object or the way I've done to pass the subscription name, please advice

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we can get view from the changelog.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not at-least as per the interface

https://github.com/magento/magento2/blob/2.4-develop/lib/internal/Magento/Framework/Mview/View/ChangelogInterface.php

I may be wrong, please guide if I'm missing something here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.
Let's pass the view object then.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

# Conflicts:
#	lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionTest.php
#	lib/internal/Magento/Framework/Mview/View/Subscription.php
@engcom-Charlie
Copy link
Contributor

@magento run all tests

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-8474 has been created to process this Pull Request

@engcom-Bravo
Copy link
Contributor

✔️ QA Passed

The result is the same as in the report above #21857 (comment)

@gabrieldagama
Copy link
Contributor

@magento run all tests

@gabrieldagama
Copy link
Contributor

@magento run Functional Tests EE

@gabrieldagama
Copy link
Contributor

@magento run Functional Tests B2B

@gabrieldagama
Copy link
Contributor

@magento run Functional Tests EE

@gabrieldagama
Copy link
Contributor

@magento run Functional Tests B2B

@gabrieldagama
Copy link
Contributor

@magento run Functional Tests EE

@gabrieldagama
Copy link
Contributor

@magento run all tests

@magento-engcom-team magento-engcom-team merged commit 7327dc0 into magento:2.4-develop Jan 24, 2021
@m2-assistant
Copy link

m2-assistant bot commented Jan 24, 2021

Hi @nikunjkotecha, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: bug fix Award: category of expertise Component: Mview Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not possible to use different column name in multiple indexers for subscription