health: Make cache health check work with mcrouter.

McRouter sends a SERVER_ERROR for keys starting with a double underscore
except for keys in the special "__mcrouter__" namespace. We were ignoring the
cache miss anyway, so lets just check for mcrouter's health everywhere and
we'll still get the desired result.
This commit is contained in:
Ricky Ramirez
2016-01-14 11:53:24 -08:00
parent f7a6940e6c
commit df8bef6962

View File

@@ -69,7 +69,9 @@ class HealthController(MinimalController):
# libmemcached doesn't support UDP get/fetch operations
continue
mc = pylibmc.Client([server], behaviors=behaviors)
mc.get("__health_check_%s__" % server)
# it's ok that not all caches are mcrouter, we'll just ignore
# the miss either way
mc.get("__mcrouter__.version")
results[server] = "OK"
except pylibmc.Error as e:
g.log.warning("Health check for %s FAILED: %s", server, e)