[NCBC-81] ExecuteGet() for DictionaryType on multiple keys does not throw a exception if it is not able to connect to a node Created: 28/Jun/12  Updated: 04/Dec/13  Resolved: 04/Dec/13

Status: Resolved
Project: Couchbase .NET client library
Component/s: library
Affects Version/s: 1.1.6
Fix Version/s: 1.3.0

Type: Bug Priority: Critical
Reporter: Alex Ma Assignee: Jeff Morris
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   
For development purposes i'm using a local Couchbase server installation with a single node. So i guess that turning off the CouchbaseServer service means the whole cluster in my case.
Here's a simple demo code:

System.Configuration.Configuration cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ICouchbaseClientConfiguration section = cfg.GetSection("Couchbase") as ICouchbaseClientConfiguration;

using (CouchbaseClient client = new CouchbaseClient(section))
{
IOperationResult res = client.ExecuteStore(Enyim.Caching.Memcached.StoreMode.Set, "Test1", 1);
Console.WriteLine("Set1 Success:{0} StatusCode:{1} Message:{2}", res.Success, res.StatusCode, res.Message);

res = client.ExecuteStore(Enyim.Caching.Memcached.StoreMode.Set, "Test2", 2);
Console.WriteLine("Set2 Success:{0} StatusCode:{1} Message:{2}", res.Success, res.StatusCode, res.Message);

IDictionary<string, IGetOperationResult> multigetRes = client.ExecuteGet(new string[] { "Test1", "Test2" });
Console.WriteLine("Dictionary count: {0}", multigetRes.Count);

foreach (KeyValuePair<string, IGetOperationResult> kvp in multigetRes)
{
Console.WriteLine("Get {0} Success:{1}, StatusCode: {2} Message: {3}", kvp.Key, kvp.Value.Success, kvp.Value.StatusCode, kvp.Value.Message);
}
}

Output with CouchbaseServer service on:
Set1 Success:True StatusCode:0 Message:
Set2 Success:True StatusCode:0 Message:
Dictionary count: 2
Get Test1 Success:True, StatusCode: Message:
Get Test2 Success:True, StatusCode: Message:

Output with CouchbaseServer service off:
Set1 Success:False StatusCode: Message:Failed to locate node
Set2 Success:False StatusCode: Message:Failed to locate node
Dictionary count: 0





Singular gets result in the correct exception error message:
Modified demo:
System.Configuration.Configuration cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ICouchbaseClientConfiguration section = cfg.GetSection("Couchbase") as ICouchbaseClientConfiguration;
using (CouchbaseClient client = new CouchbaseClient(section))
{
IOperationResult res = client.ExecuteStore(Enyim.Caching.Memcached.StoreMode.Set, "Test1", 1);
Console.WriteLine("Set1 Success:{0} StatusCode:{1} Message:{2}", res.Success, res.StatusCode, res.Message);
res = client.ExecuteStore(Enyim.Caching.Memcached.StoreMode.Set, "Test2", 2);
Console.WriteLine("Set2 Success:{0} StatusCode:{1} Message:{2}", res.Success, res.StatusCode, res.Message);
IDictionary<string, IGetOperationResult> multigetRes = client.ExecuteGet(new string[] { "Test1", "Test2" });
Console.WriteLine("Dictionary count: {0}", multigetRes.Count);
foreach (KeyValuePair<string, IGetOperationResult> kvp in multigetRes)
{
Console.WriteLine("MultiGet {0} Success:{1}, StatusCode: {2} Message: {3}", kvp.Key, kvp.Value.Success, kvp.Value.StatusCode, kvp.Value.Message);
}
res = client.ExecuteGet("Test1");
Console.WriteLine("Get1 Success:{0} StatusCode:{1} Message:{2}", res.Success, res.StatusCode, res.Message);
res = client.ExecuteGet("Test2");
Console.WriteLine("Get2 Success:{0} StatusCode:{1} Message:{2}", res.Success, res.StatusCode, res.Message);
}

Output:
Set1 Success:False StatusCode: Message:Failed to locate node
Set2 Success:False StatusCode: Message:Failed to locate node
Dictionary count: 0
Get1 Success:False StatusCode: Message:Unable to locate node
Get2 Success:False StatusCode: Message:Unable to locate node

 Comments   
Comment by Ivars Auzins [ 04/Oct/13 ]
I added pull request in github that would fix this: https://github.com/couchbase/couchbase-net-client/pull/8
Comment by Jeff Morris [ 04/Oct/13 ]
Thanks Ivars! I will review this for the 1.3.0 release.
Comment by Jeff Morris [ 04/Dec/13 ]
http://review.couchbase.org/#/c/30718/
Generated at Thu Apr 17 21:00:06 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.