slimina / spymemcached

Automatically exported from code.google.com/p/spymemcached
0 stars 0 forks source link

warning for "handling node for operation is not set" if any server is down #210

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
lib used: spymemcached-2.7.1.jar

In the class "MemcachedConnection" the method "setTimeout(Operation op, boolean 
isTimeout)" logs a warning for every get if any server is down. Is this the 
expected behaviour, even if FailureMode.Cancel ist set? (I don't want all of 
this messages in the log4j log)
              LoggerFactory.getLogger(MemcachedConnection.class).warn("handling node for operation is not set");

My code (simplified):

ConnectionFactoryBuilder cfb = new ConnectionFactoryBuilder();
cfb.setFailureMode(FailureMode.Cancel);
cfb.setDaemon(true);
cfb.setTimeoutExceptionThreshold(100);
List<InetSocketAddress> list = new ArrayList<InetSocketAddress>();
list.add(new InetSocketAddress("server-1", 11211));
list.add(new InetSocketAddress("server-2", 11211));
MemcachedClient memcachedClient = new MemcachedClient(cfb.build(), list);

try {
  for ( int i=0; i<10; i++ ) {
    Object anyObject = memcachedClient.get("anyKey"+i);
} catch (RuntimeException ignore) {}

thanks in advance
Siegfried

Original issue reported on code.google.com by siegfrie...@gmail.com on 13 Oct 2011 at 4:47

GoogleCodeExporter commented 9 years ago
I see the challenge here.  We could possibly check the failure mode.  Even in 
that case, we may not want to load up people's logs. 

Then again, you could turn up warning on that class.  Let me think about it a 
bit.

Original comment by ingen...@gmail.com on 15 Oct 2011 at 3:18

GoogleCodeExporter commented 9 years ago
My description was not precise enough, but you got the point.

Currently, we are just logging warnings and i want to get relevant (for my 
work) warnings from the MemcachedConnection.class.

We set the FailureMode to Cancel so we want to get warnings like:
1: "Node ist down, temporarily removing from availableServer's list".
2: "Retrying connection to node (attemp n)."
3: "Retrying connection to node (attempt n) failed."
...
4: "Retrying connection to node (attemp n)."
5: "Retrying connection to node (attempt n) successful, adding it to 
avvailbeServer's list."

Currently we get a lot of messages between 3 and 4 and we have to add a filter 
to this messages just before we go live (Otherwise this will mess up our log if 
a node is down) with our spymemcached improved portal.

thanks
Siegfried

Original comment by siegfrie...@gmail.com on 17 Oct 2011 at 3:11

GoogleCodeExporter commented 9 years ago
On our side, the problem is not with the warnings, but with the 
CancellationException which's stack trace is written to the log, e.g.

2014-12-02 14:24:01,586 [qtp1620644597-19] WARN  
com.google.code.ssm.spring.SSMCache- An error has ocurred for cache memCache 
and key 
epgneu_ConfiguredGenericExportService#ermittleUndExportiereSendeplaetze_53f72243
com.google.code.ssm.providers.CacheException: 
java.util.concurrent.ExecutionException: 
java.util.concurrent.CancellationException: Cancelled
    at com.google.code.ssm.providers.spymemcached.MemcacheClientWrapper.set(MemcacheClientWrapper.java:281)
    at com.google.code.ssm.CacheImpl.set(CacheImpl.java:285)
    at com.google.code.ssm.CacheImpl.set(CacheImpl.java:128)
...

Original comment by magnus.n...@gmail.com on 2 Dec 2014 at 1:37