If using memcache.inc and the memcache daemon goes away, millions of watchdog entries mean instant death of the database:
function dmemcache_set($key, $value, $exp = 0, $bin = 'cache') {
global $_memcache_statistics;
$_memcache_statistics['set'][] = $key;
$_memcache_statistics['bins'][] = $bin;
if ($mc = dmemcache_object($bin)) {
$full_key = dmemcache_key($key, $bin);
if (!$mc->set($full_key, $value, TRUE, $exp)) {
///// DATABASE DEATH!!!
watchdog('memcache', 'Failed to set key: ' . $full_key, WATCHDOG_ERROR);
}
else {
return TRUE;
}
}
return FALSE;
}
Comments
Comment #1
jvandyk commentedI think the code you cite is from the 5.x branch? In the 6.x branch of dmemcache.inc, the code has been changed because, with multiple watchdog implementations possible (dblog, syslog, etc) watchdog is not online early enough for the recording to be done anyway. (See issue for that here: http://drupal.org/node/319844). In the 6.x branch dmemcache_set() is as follows:
Comment #2
robertdouglass commentedYes. My mistake. Was looking over my client's shoulder while filing the report.
Comment #3
jaydub commentedrolled the one-liner patch for d5.
Comment #4
robertdouglass commentedcommitted it to DRUPAL-5. Thanks.