Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-81

ExecuteGet() for DictionaryType on multiple keys does not throw a exception if it is not able to connect to a node

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.1.6
    • Fix Version/s: 1.3.0
    • Component/s: library
    • Labels:
      None

      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

      No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

          • Assignee:
            jmorris Jeff Morris
            Reporter:
            alex Alex Ma
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Gerrit Reviews

              There are no open Gerrit changes