summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Andrews2014-12-14 09:22:13 (GMT)
committerJeremy Andrews2014-12-14 09:22:13 (GMT)
commit63610e49f1896a6921f9af7e660ce5494f562948 (patch)
tree581c780ba5a63f8e587730787e6dfbe18d469070
parent9e48e382a144afa498ba7b64c0670a44bee7c32a (diff)
Issue #2367609: Warn on misconfiguration of stampede protection with core locking
-rw-r--r--README.txt7
-rw-r--r--memcache.install10
2 files changed, 12 insertions, 5 deletions
diff --git a/README.txt b/README.txt
index 4da39ce..b19a585 100644
--- a/README.txt
+++ b/README.txt
@@ -106,7 +106,7 @@ The memcache-lock.inc file included with this module can be used as a drop-in
replacement for the database-mediated locking mechanism provided by Drupal
core. To enable, define the following in your settings.php:
-$conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
+ $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
Locks are written in the 'semaphore' table, which will map to the 'default'
memcache cluster unless you explicitly configure a 'semaphore' cluster.
@@ -116,11 +116,12 @@ memcache cluster unless you explicitly configure a 'semaphore' cluster.
Memcache includes stampede protection for rebuilding expired and invalid cache
items. To enable stampede protection, define the following in settings.php:
-$conf['memcache_stampede_protection'] = TRUE;
+ $conf['memcache_stampede_protection'] = TRUE;
To avoid lock stampedes, it is important that you enable the memacache lock
implementation when enabling stampede protection -- enabling stampede protection
-without enabling the Memache lock implementation can cause worse performance.
+without enabling the Memache lock implementation can cause worse performance and
+can result in dropped locks due to key-length truncation.
Memcache stampede protection is primarily designed to benefit the following
caching pattern: a miss on a cache_get() for a specific cid is immediately
diff --git a/memcache.install b/memcache.install
index 104595f..f3626f9 100644
--- a/memcache.install
+++ b/memcache.install
@@ -142,6 +142,12 @@ function memcache_requirements($phase) {
// An unexpected exception occurred.
$errors[] = $t('Unexpected failure when testing memcache configuration.');
}
+ // Core's lock implementation can cause worse performance together with
+ // stampede protection. Plus, long keys will be truncated resulting in
+ // dropped locks.
+ if (variable_get('memcache_stampede_protection', FALSE) && strpos(variable_get('lock_inc', 'includes/lock.inc'), 'includes/lock.inc') !== FALSE) {
+ $warnings[] = $t('Drupal\'s core lock implementation (%core) is not supported by memcache stampede protection. Enable the memcache lock implementation (%memcache) or disable memcache stampede protection.', array('%core' => 'includes/lock.inc', '%memcache' => drupal_get_path('module', 'memcache') . "/memcache-lock.inc"));
+ }
}
if (!empty($errors)) {
@@ -150,11 +156,11 @@ function memcache_requirements($phase) {
$errors = array_merge($errors, $warnings);
unset($warnings);
$requirements['memcache_extension']['severity'] = REQUIREMENT_ERROR;
- $requirements['memcache_extension']['description'] = $t('There is a problem with your memcache configuration, check the Drupal logs for additional errors. Please review %readme for help resolving the following !issue: !errors', array('%readme' => 'README.txt', '!issue' => format_plural(count($errors), 'issue', 'issues'), '!errors' => '<ul><li>' . implode('<li>', $errors)));
+ $requirements['memcache_extension']['description'] = $t('There is a problem with your memcache configuration, check the Drupal logs for additional errors. Please review %readme for help resolving the following !issue: !errors', array('%readme' => drupal_get_path('module', 'memcache') . '/' . 'README.txt', '!issue' => format_plural(count($errors), 'issue', 'issues'), '!errors' => '<ul><li>' . implode('<li>', $errors)));
}
elseif (!empty($warnings)) {
$requirements['memcache_extension']['severity'] = REQUIREMENT_WARNING;
- $requirements['memcache_extension']['description'] = $t('There is a problem with your memcache configuration. Please review %readme for help resolving the following !issue: !warnings', array('%readme' => 'README.txt', '!issue' => format_plural(count($warnings), 'issue', 'issues'), '!warnings' => '<ul><li>' . implode('<li>', $warnings)));
+ $requirements['memcache_extension']['description'] = $t('There is a problem with your memcache configuration. Please review %readme for help resolving the following !issue: !warnings', array('%readme' => drupal_get_path('module', 'memcache') . '/' . 'README.txt', '!issue' => format_plural(count($warnings), 'issue', 'issues'), '!warnings' => '<ul><li>' . implode('<li>', $warnings)));
}
else {
$requirements['memcache_extension']['severity'] = REQUIREMENT_OK;