IGNITE-10273: Thin clents now getting the last affinity mapping in all cases.
This closes #5399 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/64b19a99 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/64b19a99 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/64b19a99 Branch: refs/heads/ignite-10043 Commit: 64b19a99abdc4e253d0aeb53ba860c8a2f30c51d Parents: eed26bc Author: Igor Sapego <isap...@apache.org> Authored: Fri Nov 16 15:40:24 2018 +0300 Committer: Igor Sapego <isap...@apache.org> Committed: Fri Nov 16 15:40:24 2018 +0300 ---------------------------------------------------------------------- .../cache/ClientCacheNodePartitionsRequest.java | 3 +-- .../thin-client-test/src/cache_client_test.cpp | 27 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/64b19a99/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheNodePartitionsRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheNodePartitionsRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheNodePartitionsRequest.java index b9bf80e..377d26f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheNodePartitionsRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheNodePartitionsRequest.java @@ -50,8 +50,7 @@ public class ClientCacheNodePartitionsRequest extends ClientCacheRequest { IgniteCache cache = cache(ctx); GridDiscoveryManager discovery = ctx.kernalContext().discovery(); - Collection<ClusterNode> nodes = discovery.cacheNodes(cache.getName(), - new AffinityTopologyVersion(discovery.topologyVersion())); + Collection<ClusterNode> nodes = discovery.discoCache().cacheNodes(cache.getName()); Affinity aff = ctx.kernalContext().affinity().affinityProxy(cache.getName()); http://git-wip-us.apache.org/repos/asf/ignite/blob/64b19a99/modules/platforms/cpp/thin-client-test/src/cache_client_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/thin-client-test/src/cache_client_test.cpp b/modules/platforms/cpp/thin-client-test/src/cache_client_test.cpp index 24ff48f..4031d46 100644 --- a/modules/platforms/cpp/thin-client-test/src/cache_client_test.cpp +++ b/modules/platforms/cpp/thin-client-test/src/cache_client_test.cpp @@ -814,6 +814,33 @@ BOOST_AUTO_TEST_CASE(CacheClientDefaultDynamicCache) } } +BOOST_AUTO_TEST_CASE(CacheClientDefaultDynamicCacheThreeNodes) +{ + StartNode("node1"); + StartNode("node2"); + + IgniteClientConfiguration cfg; + cfg.SetEndPoints("127.0.0.1:11110..11120"); + + IgniteClient client = IgniteClient::Start(cfg); + + cache::CacheClient<std::string, int64_t> cache = + client.CreateCache<std::string, int64_t>("defaultdynamic3"); + + cache.RefreshAffinityMapping(); + + for (int64_t i = 1; i < 1000; ++i) + cache.Put(ignite::common::LexicalCast<std::string>(i * 39916801), i * 5039); + + for (int64_t i = 1; i < 1000; ++i) + { + int64_t val; + LocalPeek(cache, ignite::common::LexicalCast<std::string>(i * 39916801), val); + + BOOST_CHECK_EQUAL(val, i * 5039); + } +} + BOOST_AUTO_TEST_CASE(CacheClientGetAllContainers) { IgniteClientConfiguration cfg;