Commit 63610e49 authored by Jeremy's avatar Jeremy

Issue #2367609: Warn on misconfiguration of stampede protection with core locking

parent 9e48e382
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment