Uploaded image for project: 'Hot Rod Native client'
  1. Hot Rod Native client
  2. HRCPP-363

Near cache of different remote clients is not properly invalidated

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 8.1.0.CR1
    • .NET, Core
    • None

      It looks like the sibling clients receive full data (instead of just remove it from their near cache) and so they don't have to go to the remote server when the data is invalidated by different clients.

      [Test]
              public void ClientsInvalidatedTest()
              {
                  var cache1 = remoteManager1.GetCache<string, string>();
                  var cache2 = remoteManager2.GetCache<string, string>();
                  cache1.Clear();
                  cache2.Clear();
                  var k = "k";
                  Assert.IsNull(cache1.Get(k));
                  Assert.IsNull(cache2.Get(k));
                  cache1.Put(k, "v1");
                  var stats1 = cache2.Stats();
                  //Get needs to go remotely because this is first time cache2 client reads the value
                  Assert.AreEqual("v1", cache2.Get(k));
                  //Get is only local now
                  Assert.AreEqual("v1", cache2.Get(k));
                  var stats2 = cache2.Stats();
                  Assert.AreEqual(stats1.GetIntStatistic("hits") + 1, stats2.GetIntStatistic("hits"), "Client 2 did not reach the server!");
      //^^^----fails here
                  cache1.Put(k, "v2");
                  //Get needs to go remotely
                  Assert.AreEqual("v2", cache2.Get(k));
                  var stats3 = cache2.Stats();
                  Assert.AreEqual(stats2.GetIntStatistic("hits") + 1, stats3.GetIntStatistic("hits"), "Client 2 did not reach the server for new value!");
                  var cache1Stats1 = cache1.Stats();
                  cache2.Put(k, "v3");
                  //Get needs to go remotely
                  Assert.AreEqual("v3", cache1.Get(k));
                  var cache1Stats2 = cache1.Stats();
                  Assert.AreEqual(cache1Stats1.GetIntStatistic("hits") + 1, cache1Stats2.GetIntStatistic("hits"), "Client 1 did not reach the server for new value!");
              }
      

            vrigamon@redhat.com Vittorio Rigamonti
            mgencur Martin Gencur
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: