Problem/Motivation

It is now necessary that a module is enabled, so that the service exists to use it.

I don't think that is bad but I think we could handle the fact that the service doesn't exist much more nicely and simply fall back to the default if not provided.

Proposed resolution

In CacheFactory::get(), check if the specified service in $cache_settings exists before calling it (bin specific and default). Don't check the default backends. Should be possible to simply specify that inline in the existing if cases.

Add a hook_requirements() to tell people something is wrong.

Remaining tasks

User interface changes

API changes

CommentFileSizeAuthor
#104 2429321-104.patch8.69 KBshubhangi1995
#102 core-9.5.x-cache-factory-service-check-2429321-102.patch17.3 KBhswong3i
#98 2429321-nr-bot.txt154 bytesneeds-review-queue-bot
#94 2429321-94-TEST-ONLY.patch8.93 KBdanflanagan8
#92 2429321-92-TEST-ONLY.patch8.84 KBdanflanagan8
#88 warnings.png30.13 KBdanflanagan8
#85 interdiff_75-85.txt15.26 KBdanflanagan8
#85 2429321-85.patch16.05 KBdanflanagan8
#75 2429321-9.1-75.patch6.87 KBaleevas
#73 2429321-8.9-73.patch6.87 KBaleevas
#70 interdiff.2429321.69-70.txt1022 bytesaleevas
#70 2429321-9.0-70.patch6.87 KBaleevas
#69 interdiff_65-69.txt925 bytesRade
#69 cache-factory-service-check-2429321-69.patch6.93 KBRade
#65 cache-factory-service-check-2429321-65.patch6.92 KBRade
#65 reroll_diff_62-65.txt1.56 KBRade
#62 interdiff_58-62.txt1.61 KBNeslee Canil Pinto
#62 2429321-62.patch6.97 KBNeslee Canil Pinto
#60 2429321-56.patch7.05 KBprabha1997
#60 interdiff_50-56.txt2.29 KBprabha1997
#58 2429321-58.patch6.72 KBNeslee Canil Pinto
#55 2429321-55.patch6.68 KBprabha1997
#54 2429321-54.patch6.7 KBprabha1997
#53 2429321-53.patch6.62 KBprabha1997
#50 2429321-cache-factory-service-check-50.patch7.06 KBxavier.masson
#49 2429321-cache-factory-service-check-49.patch6.99 KBxavier.masson
#48 2429321-48.patch6.98 KBravi.shankar
#46 2429321-cache-factory-service-check-46.patch6.97 KBmpotter
#43 2429321-cache-factory-service-check-43.patch6.93 KBAnonymous (not verified)
#38 2429321-cache-factory-service-check-38.patch6.96 KBimpalash
#30 interdiff-2429321-22-28.do-not-test.diff3.12 KBkalpaitch
#30 2429321-cache-factory-service-check-28.patch6.98 KBkalpaitch
#22 2429321-cache-factory-service-check-22.patch3.62 KBMiSc
#14 2429321-cache-factory-service-check-12.patch3.4 KBmgifford
#12 interdiff-2429321-8-12.txt1.05 KBhimanshupathak3
#12 2429321-cache-factory-service-check-12.patch3.4 KBhimanshupathak3
#8 interdiff-2429321-8.txt1.78 KBjoshi.rohit100
#8 2429321-cache-factory-service-check-8.patch3.41 KBjoshi.rohit100
#5 2429321-cache-factory-service-check-5.patch2.35 KBjoshi.rohit100
#1 2429321-cache-factory-service-check-1.patch907 bytesjoshi.rohit100

Issue fork drupal-2429321

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joshi.rohit100’s picture

Status: Active » Needs review
FileSize
907 bytes

patch attached

Berdir’s picture

Status: Needs review » Needs work
Issue tags: +needs test

Thanks, looks good.

A test would be great, somewhere. Write a bogus value in settings ($this->settingSet() in tests), and then verify that you get the default implementation back (DatabaseBackend).

joshi.rohit100’s picture

Should there be unit-test case for this or a simpletest as I am only able to find a place to write test case for this and I am not sure its right or wrong - \Drupal\Tests\Core\Cache\CacheFactoryTest also I am not able to find set a value in settings as settings doesn't have set() method. Please help me on this.

Berdir’s picture

unit test sounds good to me, adding it to that existing class makes sense. See how it's done in that class, you just create a new settings object and pass in the configuration to the constructor.

joshi.rohit100’s picture

Status: Needs work » Needs review
FileSize
2.35 KB

Updated patch with unit test. I think this will only cover first IF condition.

Berdir’s picture

Test looks good, let's do the same for the default bin. Just copy it again and specify configuration for the default backend instead.

Berdir’s picture

Status: Needs review » Needs work
Issue tags: -needs test +Needs tests
joshi.rohit100’s picture

Status: Needs work » Needs review
FileSize
3.41 KB
1.78 KB

Updated patch with unit test for default bin.

Berdir’s picture

+++ b/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php
@@ -106,4 +106,68 @@ public function testCacheFactoryWithSpecifiedPerBinBackend() {
+   * Test that the cache factory falls back to the built-in default service if
+   * specified bin service doesn't exist.
...
+   * Test that the cache factory falls back to the built-in default service if
+   * specified default bin service doesn't exist.

Not sure about the coding standard for this, standard dictates that the first sentence must only be a single line.

However, for unit tests, we often don't even include a description at all, and instead have a self-speaking method, which I think we have in this case.

Berdir’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests

Needs work for changing the description there.

cilefen’s picture

Issue tags: +Needs beta evaluation
himanshupathak3’s picture

Status: Needs work » Needs review
FileSize
3.4 KB
1.05 KB

Modified documentation as suggested on #9. Adding interdiff for #8 and #12

Manjit.Singh’s picture

Issue tags: +SrijanSprintDay
mgifford’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

kalpaitch’s picture

This works, this does what I want, let's get this in...

Currently it takes two passes to install an alternative cache backed, this should have been merged years ago.

kalpaitch’s picture

Status: Needs review » Reviewed & tested by the community
marcelovani’s picture

I've been following this issue for ages and I have been using this patch from #14. I forgot to mention before, but it seems to do the job.

MiSc’s picture

Version: 8.3.x-dev » 8.4.x-dev
Status: Reviewed & tested by the community » Needs work

Patch does not work against 8.4.x, so it needs some work.

MiSc’s picture

Status: Needs work » Needs review
marcelovani’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

Are we sure we want to do this? Doesn't this mean that you might not detect that you are missing the service?

I can imagine this causing quite a few lost hours of wondering why the expected backend is not being used.

alexpott’s picture

Status: Needs review » Needs work
Issue tags: -Needs beta evaluation +Needs issue summary update

Discussed with @Berdir on IRC. We agreed that this "fix" might hide errors. Does anyone have any real use cases for the current code?

@Berdir suggests that maybe an

alternative option would be a clear exception that says something like cache factory X not available for cache bin Y, with some hints on how to fix it?
kalpaitch’s picture

The critical use case is when enabling a new cache backend, the setting will get read and throw an exception in the CacheFactory before the module has a chance to be enabled. This means its not possible to do one seamless deployment.

If hiding errors is the only issue?? Surely it would be much better for this to be clearly indicated in system_requirements()??

marcelovani’s picture

The real use is when we want to use Memcache

Following the instruction on the Readme http://cgit.drupalcode.org/memcache/tree/README.txt?h=8.x-2.x#n37

We enable the module, export the configuration, which goes into core.extension.yml
Then we added

$settings['cache']['default'] = 'cache.backend.memcache';

to settings.php

The problem is that before the configuration is loaded, the backend is switched and causes a fatal error.

This patch helps to temporarily fallback to database until the configuration is imported and the module is effectively loaded.

Berdir’s picture

But all kinds of things could go wrong if at a later point, memcache is for some reason accidently disabled and it would then again fall back to database caches, which might be very outdated and could break your site.

You have a bunch of options, one is to do two deployments, first enable the module and then set the memcache backend, depending on how the memcache module works, you can also explicitly loads its services.yml file so that the services are loaded even if the module is not enabled (yet). This is also necessary to support the container cache bin. This is documented for redis here: https://docs.platform.sh/frameworks/drupal8/redis.html, something similar might also work for memcache, but again, I don't know that module in 8.x

kalpaitch’s picture

Also spotted that the ChainedFastBackendFactory was using the default bin without checking. IMO I think this is important not to throw errors if incorrectly configured or if the module isn't yet enabled, the warning should satisfy if this is the only concern...

kalpaitch’s picture

@berdir fair enough, just to run with this idea though...

But all kinds of things could go wrong if at a later point, memcache is for some reason accidently disabled and it would then again fall back to database caches, which might be very outdated and could break your site.

The same would be true if you removed the cache settings at a 'later point' then. Also disabling a module clears the caches after it's run...

marcelovani’s picture

These "includes" via settings.php might do the job, but what happens if for some reason we want to disable the memcache module?
How about if I decide to disable memcache and enable redis instead?
Do we have to make multiple deployments?
In my opinion, its a lot more elegant to fail gracefully with some sort of alert rather than a fatal error

kalpaitch’s picture

Status: Needs work » Needs review
MiSc’s picture

@Berdir for us that works with automated deploys of drupal, this is a big issue. And we would really like to have this solved in core.

O'Briat’s picture

My 2c about enabling redis after initial deployment :
In settings.php add comments around the redis settings that contain a placeholder, so the install process use the default bdd backend.

At the end of your deploy script, just remove the comments with a sed command :

//settings.php
/*//TO-REMOVE-AFTER-INITIAL-DEPLOY
  $settings['cache']['default'] = 'cache.backend.redis';
  (...)
//TO-REMOVE-AFTER-INITIAL-DEPLOY*/
#my_deploy_script.sh
(...)
drush site-install config_installer -y 2>&1 | tee -a my_log_file.log
(...)
echo "Post-install : Uncomment cache settings" 2>&1 | tee -a my_log_file.log
sed -i -e 's/.*TO-REMOVE-AFTER-INITIAL-DEPLOY.*/\/\/REMOVED-COMMENTS/g'  "$WEB_DIR/sites/default/settings.php"

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

impalash’s picture

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dbjpanda’s picture

Status: Needs review » Reviewed & tested by the community

I applied the patch from #38 It works perfectly. Marking it RTBC. However I haven't gone through the logic or code quality of the patch.

+++ b/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php
@@ -145,4 +145,66 @@ public function testCacheFactoryWithSpecifiedPerBinBackend() {
+ ¶

Space needs to be removed.

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

#26 and ##2 still have not been addressed. We really need to understand why hiding the missing service is the correct behaviour here.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Anonymous’s picture

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

mpotter’s picture

Not sure I'd say that its "hiding" the service. This is fallback behavior: If the desired cache backend does not exist, use the Drupal default rather than breaking the site. The patch already adds a message to the Drupal Status page like we do for many other requirements.

Without this patch it is very difficult to add Memcache to a site without breaking it. It requires a 2-step deployment (first enable module, then update settings.php). If the module gets disabled accidentally, the site breaks with no way to re-install the module other than via another deployment.

I agree that some sort of test is needed.

mpotter’s picture

Rolled patch for Drupal 8.8.

When re-rolling this, I see two Test functions. So along with those tests and the warning on the status page, I think the issues mentioned in #41 are resolved.

Status: Needs review » Needs work

The last submitted patch, 46: 2429321-cache-factory-service-check-46.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

ravi.shankar’s picture

Status: Needs work » Needs review
FileSize
6.98 KB

Here this patch might fix failed tests.

xavier.masson’s picture

Rolled patch for Drupal 8.8.x.

In the reroll patch of the comment #46 there was a problem with duplicatre PluralTranslatableMarkup in the system.install.

xavier.masson’s picture

Status: Needs review » Needs work

The last submitted patch, 50: 2429321-cache-factory-service-check-50.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

prabha1997’s picture

Assigned: Unassigned » prabha1997
prabha1997’s picture

Assigned: prabha1997 » Unassigned
Status: Needs work » Needs review
FileSize
6.62 KB

/var/lib/drupalci/workspace/jenkins-drupal_patches-40654/source/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php
155 Short array syntax must be used to define arrays
156 Short array syntax must be used to define arrays
157 Short array syntax must be used to define arrays
187 Short array syntax must be used to define arrays
188 Short array syntax must be used to define arrays
I found deprecation function
\Drupal\Tests\PhpunitCompatibilityTrait::getMock() is deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use \Drupal\Tests\PhpunitCompatibilityTrait::createMock() instead. See https://www.drupal.org/node/2907725

Here i upload a new patch .Please review patch and i resolve coding standard issues and deprecation functions in latest patch

prabha1997’s picture

FileSize
6.7 KB

I upload a patch for wrong version Kindly review new patch

prabha1997’s picture

Assigned: Unassigned » prabha1997
Status: Needs review » Needs work
FileSize
6.68 KB

I upload a patch with no coding standard issues in core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php file

jungle’s picture

@prabha1997 thank you!

To make reviewing easier, would you attach an interdiff.txt? See https://www.drupal.org/documentation/git/interdiff

jungle’s picture

Issue tags: +Needs reroll
Neslee Canil Pinto’s picture

Status: Needs work » Needs review
FileSize
6.72 KB

Rerolled the patch for 8.9.x

Neslee Canil Pinto’s picture

Assigned: prabha1997 » Unassigned
prabha1997’s picture

jungle’s picture

A review of #58

  1. +++ b/core/modules/system/system.install
    @@ -316,6 +316,33 @@ function system_requirements($phase) {
    +  if ($phase == 'install' || $phase == 'runtime') {
    

    prefer using === instead of ==

  2. +++ b/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php
    @@ -145,4 +145,67 @@ public function testCacheFactoryWithSpecifiedPerBinBackend() {
    +    $render_bin = $this->createMock('\Drupal\Core\Cache\CacheBackendInterface');
    +    $builtin_default_backend_factory->expects($this->once())
    +      ->method('get')
    +      ->with('render')
    +      ->will($this->returnValue($render_bin));
    ...
    +    $render_bin = $this->createMock('\Drupal\Core\Cache\CacheBackendInterface');
    +    $builtin_default_backend_factory->expects($this->once())
    +      ->method('get')
    +      ->with('render')
    +      ->will($this->returnValue($render_bin));
    

    Prefer Mocking with Prophecy in PHPUnit https://www.drupal.org/docs/8/phpunit/using-prophecy

  3. +++ b/core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php
    @@ -145,4 +145,67 @@ public function testCacheFactoryWithSpecifiedPerBinBackend() {
    +   * Test that the cache factory falls back to the built-in default service if specified bin service does not exist.
    ...
    +   * Test that the cache factory falls back to the built-in default service if
    +   * specified default bin service does not exist.
    

    Better to use "tests that ..." and the first one exceeds 80 chars, the second one, there should have a blank line between the first line and the second line.

    Suggestion:

    • Tests cache factory that specified bin service does not exist.
    • Tests cache factory that specified default bin service does not exist.
Neslee Canil Pinto’s picture

ravi.shankar’s picture

Status: Needs review » Needs work
Neslee Canil Pinto’s picture

Status: Needs work » Needs review
Rade’s picture

Rerolling patch from #62 to apply to 8.8.x.

benroy’s picture

This issue seems to be similar to the https://www.drupal.org/project/drupal/issues/2766509, can somebody tell me if I'm wrong ? And if the two issues are doing the same, which one choose ?

jungle’s picture

Status: Needs review » Needs work

Thanks, @benroy! Agree with you. This one was filed earlier than that one, so I think that one should be closed. Commented there. Tests did not pass. Setting back to NW.

longwave’s picture

Personally I think the approach of using the "null" cache service as taken in the other issue is perhaps a bit better for this special case.

Tagging to get the opinion of a cache maintainer.

Rade’s picture

Small fix to patch from #65 since it had missing parenthesis in method calls.

aleevas’s picture

Trying to re-roll latest patch

xjm’s picture

Version: 9.0.x-dev » 8.8.x-dev

We should keep bugs filed against the bugfix branch (currently 8.8.x; soon to be 8.9.x). We don't need to change the version selector to queue tests because the UI also has a selector to queue tests against any branch when uploading the patch. Thanks!

xjm’s picture

Version: 8.8.x-dev » 8.9.x-dev

I guess it's more a minor-only fix since there's a new public method.

aleevas’s picture

FileSize
6.87 KB

Added patch for 8.9.x

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

aleevas’s picture

FileSize
6.87 KB

Added patch for 9.1 branch

jofitz’s picture

Issue tags: -Needs reroll

Removed "Needs reroll" tag

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

mpotter’s picture

Been using this very important patch on many sites to prevent problems when a site is initially deployed and the memcache module hasn't yet been enabled (until config-import runs). Using the README instructions in the memcache module for "preloading" the cache service in settings.php results in very bad performance issues, whereas this patch just solves the problem simply by ignoring the cache settings when the module isn't enabled.

Would really like to see this get the subsystem review it needs and get pushed forward. It solves a very real problem on every one of our Drupal projects.

tyler36’s picture

Status: Needs review » Reviewed & tested by the community

#75 prevents WSOD as intended on 9.1

After 6 years, someone needs to make a call; should it fail gracefully or not? Fixed or Closed(won't fix)?

catch’s picture

Issue summary: View changes
Issue tags: -Needs subsystem maintainer review

I'm currently the only maintainer of the cache system in MAINTAINERS.txt, and I'm fine with the overall approach here given we have the system_requirements() check to inform people something is wrong.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/lib/Drupal/Core/Cache/CacheFactory.php
    @@ -65,7 +65,7 @@ public function __construct(Settings $settings, array $default_bin_backends = []
    -    if (isset($cache_settings['bins'][$bin])) {
    +    if (isset($cache_settings['bins'][$bin])  && $this->container->has($cache_settings['bins'][$bin])) {
           $service_name = $cache_settings['bins'][$bin];
         }
         // Second, use the default backend specified by the cache bin.
    @@ -73,7 +73,7 @@ public function get($bin) {
    
    @@ -73,7 +73,7 @@ public function get($bin) {
           $service_name = $this->defaultBinBackends[$bin];
         }
         // Third, use configured default backend.
    -    elseif (isset($cache_settings['default'])) {
    +    elseif (isset($cache_settings['default'])  && $this->container->has($cache_settings['default'])) {
           $service_name = $cache_settings['default'];
         }
         else {
    

    I think rather then do this we can be even safer and remove the final else and do..

        if (!isset($service_name) || !$this->container->has($service_name)) {
          // Fall back to the database backend if nothing else is configured.
          $service_name = 'cache.backend.database';
        }
    
  2. +++ b/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php
    @@ -66,6 +66,17 @@ public function __construct(Settings $settings = NULL, $consistent_service_name
    +  /**
    +   * Getter for the consistent service name.
    +   *
    +   * @return string
    +   *   The service name of the consistent backend factory.
    +   */
    +  public function getConsistentServiceName() {
    +    return ($this->consistentServiceName && $this->container->has($this->consistentServiceName)) ?
    +      $this->consistentServiceName : 'cache.backend.database';
    +  }
    

    This doesn't need to be public API. I think also this logic could be inlined into the ::get() method. Then we wouldn't have to check if $this->consistentServiceName is set because that method assumes the constructor has correctly set it.

  3. +++ b/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php
    @@ -80,13 +91,13 @@ public function get($bin) {
         if (isset($this->fastServiceName)) {
           return new ChainedFastBackend(
    -        $this->container->get($this->consistentServiceName)->get($bin),
    +        $this->container->get($this->getConsistentServiceName())->get($bin),
             $this->container->get($this->fastServiceName)->get($bin),
             $bin
           );
         }
         else {
    -      return $this->container->get($this->consistentServiceName)->get($bin);
    +      return $this->container->get($this->getConsistentServiceName())->get($bin);
         }
    

    This is not tested.

  4. +++ b/core/modules/system/system.install
    @@ -293,7 +293,7 @@ function system_requirements($phase) {
    -  if ($phase == 'install' || $phase == 'runtime') {
    +  if ($phase === 'install' || $phase === 'runtime') {
    

    This is an out-of-scope change.

  5. +++ b/core/modules/system/system.install
    @@ -348,6 +348,33 @@ function system_requirements($phase) {
    +  if ($phase === 'install' || $phase === 'runtime') {
    

    Are we sure we want a warning on install for this? This change could break automated tests of install profiles which have the memcache module.

  6. +++ b/core/modules/system/system.install
    @@ -348,6 +348,33 @@ function system_requirements($phase) {
    +          'The configured Cache Backend %backend is not available.',
    +          'The configured Cache Backends %backend are not available.',
    

    I don't think Cache Backend needs to be capitalised.

    Also this message could be more helpful and say with bin is incorrectly configured - or if it the default settings.

    It would nice if the message pointing at least to settings.php where it is likely the misconfiguration is.

    Also this requirement is untested.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

star-szr’s picture

Issue tags: -Novice

Not currently a good novice issue so removing the tag.

danflanagan8’s picture

Status: Needs work » Needs review
FileSize
16.05 KB
15.26 KB

Here's an attempt to wrap up all the loose ends here. This addresses all of the feedback in #81. It includes a couple new test classes to specifically address 81.3 and 81.6.

It looks like ChainedFastBackendFactory doesn't have any direct test coverage currently. So I added a unit test mostly based on CacheFactoryTest. The final of the five test cases fails without the fix. I can post that as a test only patch if anyone wants.

Status: Needs review » Needs work

The last submitted patch, 85: 2429321-85.patch, failed testing. View results

danflanagan8’s picture

Status: Needs work » Needs review

Hmmm, that test passes locally. I'm going to set this back to NR to get eyes on it maybe.

danflanagan8’s picture

FileSize
30.13 KB

Here's a screenshot of what the warnings on the status page look like. This is what happens if you install the cache_test module on your site and go to the status report page. (After applying the patch of course.)

hswong3i made their first commit to this issue’s fork.

hswong3i’s picture

PR created from #85

danflanagan8’s picture

I'm posting a test-only patch to investigate that failing test. ChainedFastBackendFactoryTest is hard to unit test because there are a couple places it doesn't use service injection. So I'm explicitly unsetting some global values that may be different on the test runner than they are for me locally?

I'm hoping that only the fifth test case fails here. Fingers crossed!

Status: Needs review » Needs work

The last submitted patch, 92: 2429321-92-TEST-ONLY.patch, failed testing. View results

danflanagan8’s picture

I think I had myself confused. Let's try setting the variable instead of unsetting it.

danflanagan8’s picture

Status: Needs work » Needs review

Well I'm stumped with this test fail. Maybe this is why there aren't tests for ChainedFastBackendFactory to begin with.

I'm going to set back to NR to maybe get some eyes on the patch in #85.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
154 bytes

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

larowlan’s picture

Issue tags: +Bug Smash Initiative

What's left here? Getting it passing?

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

hswong3i’s picture

ThirstySix’s picture

#102 Patch works well with D9.5.x version.

shubhangi1995’s picture

FileSize
8.69 KB

Patch as per 10.1.x