Magento2: Running bin/magento setup:upgrade re-enables layout, block_html and full_page caches

Created on 11 May 2020  Â·  21Comments  Â·  Source: magento/magento2

Preconditions (*)

1.Magento 2.4-develop

Steps to reproduce (*)

  1. Disable the caches by running: bin/magento cache:disable block_html full_page layout
  2. Run: bin/magento setup:upgrade

Expected result (*)

  1. After setup:upgrade completes execution, the block_html, full_page, and layout caches are still disabled

Actual result (*)

  1. An "enabling caches" message appears in the CLI output of setup:upgrade:
Enabling caches:
Current status:
Array
(
    [layout] => 1
    [block_html] => 1
    [full_page] => 1
)
  1. Those caches are re-enabled:
magento235$ bin/magento cache:status
Current status:
                        config: 1
                        layout: 1
                    block_html: 1
                   collections: 1
                    reflection: 1
                        db_ddl: 1
               compiled_config: 1
                           eav: 1
         customer_notification: 1
            config_integration: 1
        config_integration_api: 1
                google_product: 1
                     full_page: 1
             config_webservice: 1
                     translate: 1
                        vertex: 1
Cache Console Fixed in 2.4.x Confirmed Format is valid Ready for Work P3 done Reported on 2.4.0 Reproduced on 2.4.x S3 Dev.Experience

All 21 comments

Hi @markshust. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

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

@markshust do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

We've just noticed this too. Came here to write a report but you beat me to it @markshust :)

@magento give me 2.4-develop instance

Magento instance deployment temporary unavailable due to service maintenance.

Hi @engcom-Alfa. 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:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

@magento give me 2.4-develop instance

Magento instance deployment temporary unavailable due to service maintenance.

The issue is reproducible on fresh 2.4-develop.

:white_check_mark: Confirmed by @engcom-Alfa
Thank you for verifying the issue. Based on the provided information internal tickets MC-34331 were created

Issue Available: @engcom-Alfa, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

@magento I am working on this

Hi @gauravharsh15! :wave:
Thank you for joining. Please accept team invitation :point_right: here :point_left: and add your comment one more time.

@magento I am working on this

Hello @markshust ,
According to current functionality, three caches(block_html, full_page, layout) are being disabled and then enabled again and if there are no cache disabled from (block_html, full_page, layout) then it disable all caches and enable all caches, please help to suggest the expected behaviour.
there must be some reason we are disabling and enabling all caches in Upgrade command.

The desired functionality is that whatever caches are disabled/enabled
before running the setup:upgrade command, should be re-applied after
running the command. So, the cache statuses should not change whatsoever
when running setup:upgrade.

On Sun, May 17, 2020 at 7:22 AM gauravharsh15 notifications@github.com
wrote:

Hello @markshust https://github.com/markshust ,
According to current functionality, three caches(block_html, full_page,
layout) are being disabled and then enabled again and if there are no cache
disabled from (block_html, full_page, layout) then it disable all caches
and enable all caches, please help to suggest the expected behaviour.
there must be some reason we are disabling and enabling all caches in
Upgrade command.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/magento/magento2/issues/28186#issuecomment-629781370,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AADKWJIAQH252LH2VSYAGNLRR7CGFANCNFSM4M55RXAQ
.

The desired functionality is that whatever caches are disabled/enabled before running the setup:upgrade command, should be re-applied after running the command. So, the cache statuses should not change whatsoever when running setup:upgrade.
…
On Sun, May 17, 2020 at 7:22 AM gauravharsh15 @.*> wrote: Hello @markshust https://github.com/markshust , According to current functionality, three caches(block_html, full_page, layout) are being disabled and then enabled again and if there are no cache disabled from (block_html, full_page, layout) then it disable all caches and enable all caches, please help to suggest the expected behaviour. there must be some reason we are disabling and enabling all caches in Upgrade command. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#28186 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADKWJIAQH252LH2VSYAGNLRR7CGFANCNFSM4M55RXAQ .

Thanks @markshust , can you please help to guide on these pointers as well :

  1. As per current feature, we are first disabling cache[_block_html, full_page, layout_] and later enabling these cache, do we need to change it with first enabling the current disabled cache and later disabling them once the command execution is about to end ?

  2. If we just want it to make it as it is then do we really need to disable/enable or update any cache ?

  3. if no cache is disabled, what should be the behaviour ? should it disable or enable any cache ?

PS: Newbie here, your help would be appreciated.

In case this helps, we're using the following patch for this:

diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php
index 535040f942..8aee179b5f 100644
--- a/setup/src/Magento/Setup/Model/Installer.php
+++ b/setup/src/Magento/Setup/Model/Installer.php
@@ -875,6 +875,19 @@ class Installer
             LayoutCache::TYPE_IDENTIFIER,
         ];

+// PATCH START disable/enable only enabled frontend caches during setup:upgrade
+        $cacheManager = $this->objectManagerProvider->get()->create(\Magento\Framework\App\Cache\Manager::class);
+        /* @var \Magento\Framework\App\Cache\Manager $cacheManager */
+        $status = $cacheManager->getStatus();
+        $filteredFrontendCaches = [];
+        foreach ($frontendCaches as $cache)
+        {
+            if ($status[$cache] ?? null)
+                $filteredFrontendCaches[] = $cache;
+        }
+        $frontendCaches = $filteredFrontendCaches;
+// PATCH END
+
         /** @var \Magento\Framework\Registry $registry */
         $registry = $this->objectManagerProvider->get()->get(\Magento\Framework\Registry::class);
         //For backward compatibility in install and upgrade scripts with enabled parallelization.

The upgrade functionality should be tested manually

@ktruehl Can you show how to implement this patch? I tried "by manual" but setup/src/Magento/Setup/Model/Installer.php file not changed.

I'm having the same issue on 2.3.5-p1

Was this page helpful?
0 / 5 - 0 ratings