Old clients fail to read new client data

#1

If I add an item with the 2.0 client like this

        using (var cluster = new Cluster(config))
        using (var bucket = cluster.OpenBucket("UPS"))
        {
            var data = new Dictionary<string, string>() {{"Testing New Item", "This is the new item"}};
            bucket.Upsert("N-01", data);
        }

I get an exception reading with a 1.3.10 client

        var client = new CouchbaseClient(config);
        var data = client.ExecuteGetJson<Dictionary<string, string>>("N-01");

at System.Runtime.Serialization.Formatters.Binary.SerializationHeaderRecord.Read(__BinaryParser input)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadSerializationHeaderRecord()
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at Enyim.Caching.Memcached.DefaultTranscoder.DeserializeObject(ArraySegment`1 value)
at Enyim.Caching.Memcached.DefaultTranscoder.Deserialize(CacheItem item)
at Enyim.Caching.Memcached.DefaultTranscoder.Enyim.Caching.Memcached.ITranscoder.Deserialize(CacheItem item)
at Couchbase.CouchbaseClient.PerformTryGet(String key, UInt64& cas, Object& value)
at Enyim.Caching.MemcachedClient.ExecuteTryGet(String key, Object& value)
at Enyim.Caching.MemcachedClient.ExecuteGet[T](String key)
at Couchbase.Extensions.CouchbaseClientExtensions.ExecuteGetJson[T](ICouchbaseClient client, String key)

#2

@Kevin_Willford -

The problem is that the new client uses what we call “common flags” so that their consistency transcoding data across the suite of 2.0 SDKs. The older clients all use different transcoders; the 2.0 SDKs do support reading of data created by older SDK’s, but the reverse isn’t always true. In this case the newer client transcodes the body of the memcached packet as JSON, but the older client tries to transcode it as binary.

This should be resolvable by creating a custom transcoder or perhaps a provide additional logic within the older client to interpret the newer flags when they are present. I am sorry I don’t have a solution atm, but i’ll look into it a bit deeper.

Thanks,

Jeff

#3

@Kevin_Willford -

I created a bug ticket for this: https://issues.couchbase.com/browse/NCBC-830

Thanks,

-Jeff

#4

Jeff,

Thanks for the reply. Could you point me at the api documentation about the “flags” and using a custom transcoder so that I can look into this?

#5

@Kevin_Willford

At the moment you cannot override the default transcoder, there is a ticket to change this that was backlogged, but I moved it to the next release: https://issues.couchbase.com/browse/NCBC-822

-Jeff

#6

Since 822 has been resolved, how exactly could we use a custom transcoder to resolve this?

#7

@jklein -

You would take a similar approach as outlined in this blog post, accept you would be creating a custom transcoder which has the logic to support the differences between the two SDK’s wrt type transcoding. If you did so, it would be cool if you share your work by contributing to the couchbase contrib project.

If you need assistance or have any questions, feel free to ping me on Skype (jeffscottmorris) or twitter.

-Jeff