Sure, but I'll have to go through all the existing prod code that uses the 
client and change it to set. It would be nicer in the future if add was 
supported. I noticed there is a github issue for 
that https://github.com/elasticsearch/elasticsearch-transport-memcached/issues/7

Also, in my test scenario I'm now having other issues with the spy.memcache 
client. It's a little obscure and happens on a get:
2014-10-02 09:53:08.931 INFO net.spy.memcached.MemcachedConnection: 
 Reconnecting due to exception on {QA sa=localhost/127.0.0.1:11211, 
#Rops=1, #Wops=0, #iq=0, topRop=Cmd: 0 Opaque: 3 Key: foo, topWop=null, 
toWrite=0, interested=1}
java.lang.ArrayIndexOutOfBoundsException: 0
at 
net.spy.memcached.protocol.binary.OperationImpl.decodeInt(OperationImpl.java:257)
at 
net.spy.memcached.protocol.binary.GetOperationImpl.decodePayload(GetOperationImpl.java:51)
at 
net.spy.memcached.protocol.binary.OperationImpl.finishedPayload(OperationImpl.java:178)
at 
net.spy.memcached.protocol.binary.OperationImpl.readFromBuffer(OperationImpl.java:162)
at 
net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:463)
at 
net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:380)
at 
net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:242)
at net.spy.memcached.MemcachedConnection.run(MemcachedConnection.java:836)

Looks like it's happening in a method that is reading the binary data:

static int decodeInt(byte[] data, int i) {
    return (data[i] & 0xff) << 24
      | (data[i + 1] & 0xff) << 16
      | (data[i + 2] & 0xff) << 8
      | (data[i + 3] & 0xff);
  }

I'll try and dig in a little more and also maybe try another client like 
the Whalin client.

Ryan




On Thursday, October 2, 2014 9:36:02 AM UTC-5, Tanguy Leroux wrote:
>
> You don't need to write your own client, just to use SET commands instead 
> of ADD.
>
> For example, with the spymemcached library you should do something like:
>
> MemcachedClient c=new MemcachedClient(
>     new InetSocketAddress("hostname", portNum));
>
> // Store a value (async) for one hour
> c.set("someKey", 3600, someObject);
> // Retrieve a value (synchronously).
> Object myObject=c.get("someKey");
>
>
> -- Tanguy
>
> Le jeudi 2 octobre 2014 16:12:29 UTC+2, Ryan Bergman a écrit :
>>
>> I'm using 1.3.3 with a transport of 2.3.0
>>
>> I was attempting to use one of the standard common Memcache client 
>> libraries that already exist. I was hoping that they would "just work" 
>> without having to write my own client (or modifying one of them). It sounds 
>> like that's not an option. Is there a plan for the transport to support ADD 
>> in the future?
>>
>> Ryan
>>
>>
>> On Thursday, October 2, 2014 2:27:58 AM UTC-5, Tanguy Leroux wrote:
>>>
>>> Hi,
>>>
>>> Which versions of elasticsearch / elasticsearch-transport-memcached / 
>>> memcached are you using?
>>>
>>> It looks like the memcached client is trying to execute a 0x02 ADD 
>>> command whereas the elasticsearch-transport-memcached only supports 
>>> get/set/delete/quit commands and disconnects for all others (see 
>>> documentation here: 
>>> https://github.com/elasticsearch/elasticsearch-transport-memcached) 
>>>
>>> You may try a "set" instead.
>>>
>>> -- Tanguy
>>>
>>> Le mercredi 1 octobre 2014 15:35:40 UTC+2, Ryan Bergman a écrit :
>>>>
>>>> Hi,
>>>>    I've been trying to play with Elasticsearch as a drop in replacement 
>>>> for Memcached. I've installed the memcached transport and it looks like it 
>>>> started fine and is on the right port. However if I attempt to use the 
>>>> java 
>>>> spy.memcahed client library I'm not able to cache things.
>>>>
>>>> Instead I get errors like:
>>>>
>>>> 2014-10-01 08:22:31.579 INFO net.spy.memcached.MemcachedConnection: 
>>>>  Added {QA sa=localhost/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, 
>>>> topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
>>>> 2014-10-01 08:22:31.586 INFO net.spy.memcached.MemcachedConnection: 
>>>>  Connection state changed for sun.nio.ch.SelectionKeyImpl@76fb509a
>>>> 2014-10-01 08:22:31.679 INFO net.spy.memcached.MemcachedConnection: 
>>>>  Reconnecting due to exception on {QA sa=localhost/127.0.0.1:11211, 
>>>> #Rops=2, #Wops=0, #iq=0, topRop=Cmd: 2 Opaque: 2 Key: foo Cas: 0 Exp: 1000 
>>>> Flags: 0 Data Length: 3, topWop=null, toWrite=0, interested=1}
>>>> java.io.IOException: Disconnected unexpected, will reconnect. 
>>>>
>>>> over and over.
>>>>
>>>> On the Elasticsearch side I get an error of
>>>> [2014-10-01 08:22:31,675][ERROR][memcached.netty          ] [Living 
>>>> Hulk] Unsupported opcode [0x2], ignoring and closing connection
>>>>
>>>> Here is my client configuration:
>>>> ConnectionFactoryBuilder factory =  new ConnectionFactoryBuilder();
>>>>         factory.setProtocol(ConnectionFactoryBuilder.Protocol.BINARY);
>>>>         SerializingTranscoder t = new SerializingTranscoder(1000000);
>>>>         t.setCompressionThreshold(1024);
>>>>         factory.setTranscoder(t);
>>>>         factory.setOpTimeout(1000);
>>>>         factory.setTimeoutExceptionThreshold(1998);
>>>>         factory.setHashAlg(DefaultHashAlgorithm.KETAMA_HASH);
>>>>         
>>>> factory.setLocatorType(ConnectionFactoryBuilder.Locator.CONSISTENT);
>>>>         factory.setFailureMode(FailureMode.Redistribute);
>>>>         factory.setUseNagleAlgorithm(false);
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/ba738dbb-b325-4df1-8f75-47faeafa38a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to