Skip to content
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

2.4.5 EE Graphql Product Collection flat table disabled #37334

Open
1 of 5 tasks
alexmtch opened this issue Apr 5, 2023 · 5 comments
Open
1 of 5 tasks

2.4.5 EE Graphql Product Collection flat table disabled #37334

alexmtch opened this issue Apr 5, 2023 · 5 comments
Assignees
Labels
Area: Catalog Component: Catalog Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: dev in progress Project: GraphQL Reported on 2.4.5 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@alexmtch
Copy link

alexmtch commented Apr 5, 2023

Preconditions and environment

  • Magento version : 2.4.5 EE
  • Anything else that would help a developer reproduce the bug

Steps to reproduce

Go on vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php in the addAttributeToSelect method.

On my project $this->isEnabledFlat() is always to false causing on some graphql request (add to cart) large execution times dues to vendor/magento/module-quote/Model/ResourceModel/Quote/Item/Collection.php method _assignProducts loading all quote_item attributes.

I found out that in the vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php constructor, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState is passed.

And the $catalogProductFlatState->isAvailable() method is alway false dues to the $isAvailable instruction in the constructor false by default.

I found out that in vendor/magento/module-catalog/etc/frontend/di.xml it's set to true :

<type name="Magento\Catalog\Model\Indexer\AbstractFlatState">
    <arguments>
        <argument name="isAvailable" xsi:type="boolean">true</argument>
    </arguments>
</type>
<type name="Magento\Catalog\Model\Indexer\Product\Flat\State">
    <arguments>
        <argument name="isAvailable" xsi:type="boolean">true</argument>
    </arguments>
</type>

Or this is not set in any [...]/etc/graphql/di.xml

Fixing this on the module-catalog-graphql fix both issues. I dot found the correlation between $catalogProductFlatState and $_flatEnabled but it fix the issue. Maybe someone could give me more explanations...

Steps

  1. Enable Use Flat Catalog Category and Use Flat Catalog Product from admin panel on path Stores -> Settings -> Configuration -> Catalog -> Catalog -> Storefront

image

  1. Clear the cache.
  2. Try to add the product to the cart from the frontend, it will return true for isAvailable:

image

  1. But in GraphQL it is returning false:

image

Expected result

Flat should be enabled for collections on graphql scope

Actual result

Flat is not enabled for collections on graphql scope

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Apr 5, 2023

Hi @alexmtch. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@m2-community-project m2-community-project bot added this to Ready for Confirmation in Issue Confirmation and Triage Board Apr 5, 2023
@engcom-Bravo engcom-Bravo added Reported on 2.4.5 Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it labels Apr 5, 2023
@engcom-Hotel
Copy link
Contributor

Hello @alexmtch,

Thanks for the report and collaboration!

We have tried to reproduce the issue in latest development branch i.e. 2.4-develop. It seems that the issue is reproducible for us. In order to reproduce the issue we have performed the below steps:

  1. Enable Use Flat Catalog Category and Use Flat Catalog Product from admin panel on path Stores -> Settings -> Configuration -> Catalog -> Catalog -> Storefront

image

  1. Clear the cache.
  2. Try to add the product in cart from frontend, it will return true for isAvailable:

image

  1. But in GraphQL it is returning false:

image

Hence confirming the issue.

Thanks

@engcom-Hotel engcom-Hotel added Component: Catalog Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Project: GraphQL Area: Catalog and removed Issue: ready for confirmation labels Apr 6, 2023
@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog Apr 6, 2023
@m2-community-project m2-community-project bot removed this from Ready for Confirmation in Issue Confirmation and Triage Board Apr 6, 2023
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-8463 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Apr 6, 2023

✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@nihara47
Copy link

@magento I am working on this

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Catalog Component: Catalog Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: dev in progress Project: GraphQL Reported on 2.4.5 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
High Priority Backlog
  
Dev In Progress
Development

No branches or pull requests

5 participants