magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.54k stars 9.32k forks source link

2.4.4-p10-Set indexers invalid during next immediate deployment after the key rotation #39206

Open senthilengg opened 1 month ago

senthilengg commented 1 month ago

Preconditions and environment

No response

Steps to reproduce

  1. Apply Patch 2.4.4-P10
  2. Run Key Rotation command
  3. Try to deploy again
  4. Indexers will set as invalid and if the store has more than a million customer then setup:upgrade will take a lot of time

Expected result

Setup Upgrade should complete it in few mins if there are no schema changes

Actual result

Setup:upgrade takes more than 30 min and increase based on the number of customers

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 month ago

Hi @senthilengg. 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.

m2-assistant[bot] commented 3 days ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 3 days ago

Hello @senthilengg,

Thanks for the report and collaboration!

We have tried to reproduce the issue in the latest 2.4-develop branch with extra_large.xml performance toolkit.

We have 10 lakhs customers and same numbers of products. Please refer to the below screenshot:

image

image

We have followed the below steps to reproduce the issue:

  1. Run below command for key rotation: bin/magento encryption:key:change

  2. Deploy again: bin/magento setup:static-content:deploy -f

  3. Then run bin/magento setup:upgrade, which took some seconds to complete.

Please let us know if we missed anything.

Thanks

senthilengg commented 3 days ago

@engcom-Hotel Thank you for working on this issue. It was taking 30-40+ mins for a 6 million customer DB. Fundamentally speaking there is no point in setting indexer invalid for this case.

More than reproducing this issue what i would suggest as part of the Key Rotation command, it should reupdate hash of indexer so the experience will be seamless given that we know no modification to the indexer schema.

Thank you

engcom-Hotel commented 2 days ago

Hello @senthilengg,

Thanks for the reply!

We have investigated this issue further. We ran bin/magento indexer:status, which does not show any index to reindex:

image

After running bin/magento encryption:key:change, we get the same index status: image

After that, we ran time bin/magento setup:upgrade, which took almost 18 mins to complete: image

But as the issue description, the bin/magento encryption:key:change command does not invalid the index status.

senthilengg commented 1 day ago

@engcom-Hotel Thank you for the update. The indexer will get invalidated and data get refreshed during the next deployment after the key rotation.

Step 1 : Deploy P10 patch Step 2 : Rotate Encryption Key Step 3: Deploy again with some changes (You can find all the indexer last updated date will be almost the same time)

Line of code that creates this issue : https://github.com/magento/magento2/blob/2.4.4-p10/app/code/Magento/Indexer/Setup/Recurring.php#L108

Hope this provide more details.