Increment times out; set always succeeds after retry

a 夏天 提交于 2019-12-24 13:33:18

问题


I'm getting strange behavior in memcached, in particular, behavior that is strange in its consistency. Here is my test:

@Test
public void testMemc() {
    logger.info("Setting head.");
    memc.set(env.memcachedQueueKeys().head, 3600, 0);
    logger.info("Set head; incrementing.");
    memc.incr(env.memcachedQueueKeys().head, 1);
    logger.info("Incremented.");
}

And here is the output:

28 11:04:52.932 INFO; Setting head.

2014-01-28 11:04:52.933 WARN net.spy.memcached.MemcachedConnection: Could not redistribute to another node, retrying primary node for q:unittest:scannedemails:w.

28 11:04:52.933 INFO; Set head; incrementing.

2014-01-28 11:04:52.935 WARN net.spy.memcached.MemcachedConnection: Could not redistribute to another node, retrying primary node for q:unittest:scannedemails:w.

FAILED: testMemc net.spy.memcached.OperationTimeoutException: Mutate operation timed out,unable to modify counter [q:unittest:scannedemails:w]
at net.spy.memcached.MemcachedClient.mutate(MemcachedClient.java:1484)
at net.spy.memcached.MemcachedClient.incr(MemcachedClient.java:1529)
at me.unroll.emailroller.ActOnScanResultsTest.testMemc(ActOnScanResultsTest.java:295)

Most of my intuition for this kind of error fails me here. The following things are all strange:

  1. Why does it always fail exactly once to set?
  2. Why does it permanently fail to increment after seeming to succeed at set?

This is on a high-load server (yes, it's a little wrong to be running a test on a load-bearing server, but if it catches issues like this there's at least some advantage). What can cause this consistent failure? There is only one node.


回答1:


Problem is I couldn't connect at all. This is a bug in spymemcached, since the set operation did not throw an exception even though it had no memcached server to perform set on.



来源:https://stackoverflow.com/questions/21410829/increment-times-out-set-always-succeeds-after-retry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!