Skip to content

Backport Magento 2.2 Set cache id prefix on installation #22439

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

Conversation

Ctucker9233
Copy link

Original Pull Request #18641

Description (*)

The undocumented id_prefix option for the cache frontend is used to prefix cache keys. If it is not set, Magento uses the first 12 bits of the md5 hash of the absolute path to Magentos app/etc directory. But if this is not exactly the same on all web servers, cache invalidation does not work.

Source: https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php#L121-L130

To prevent this issue, the value shall be set on installation, so that the fall back on the fly does not happen anymore. Optionally, the value can be specified explicitly.

Fixed Issues (if relevant)

#15828: Multisite installation, default website slow

Manual testing scenarios (*)

  1. Install Magento via CLI or Web Wizard
  2. There should be new options "cache-id-prefix" and "page-cache-id-prefix"
  3. The value is saved in env.php at cache/frontend/{default,page_cache}/id_prefix

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@m2-assistant
Copy link

m2-assistant bot commented Apr 20, 2019

Hi @Ctucker9233. 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.2-develop instance - deploy vanilla Magento instance

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

Copy link
Contributor

@orlangur orlangur left a comment

Choose a reason for hiding this comment

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

@Ctucker9233 well, commit message could be better :)

@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-4791 has been created to process this Pull Request

@soleksii
Copy link

✔️ QA Passed

@@ -116,6 +122,60 @@ public function testCreateConfigWithRedisConfig()
$this->assertEquals($expectedConfigData, $configData->getData());
}

<<<<<<< HEAD
Copy link
Author

Choose a reason for hiding this comment

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

@orlangur I think this line is causing the Travis CL build to fail. Correct me if I'm wrong but this preserves the authorship so I don't think it can simply be removed.

@@ -36,6 +39,9 @@ protected function setUp()
$this->configOptionsList = new CacheConfigOptionsList($this->validatorMock);
}

/**
* testGetOptions
Copy link
Contributor

Choose a reason for hiding this comment

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

@nmalevanec why need to add such useless annotations? Tests were ignored before, what caused such a bug?

Copy link
Contributor

Choose a reason for hiding this comment

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

@orlangur, I've moved this comment from 2.3-develop. But, ok I'll remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

@nmalevanec no need to remove, they must be not needed in 2.3-develop as well.

@m2-assistant
Copy link

m2-assistant bot commented Apr 23, 2019

Hi @Ctucker9233, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants