[ 
https://issues.apache.org/jira/browse/GEODE-9576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17413013#comment-17413013
 ] 

ASF GitHub Bot commented on GEODE-9576:
---------------------------------------

jvarenina commented on a change in pull request #864:
URL: https://github.com/apache/geode-native/pull/864#discussion_r705952887



##########
File path: cppcache/integration/test/FunctionExecutionTest.cpp
##########
@@ -175,6 +181,58 @@ TEST(FunctionExecutionTest,
   cache.close();
 }
 
+void populateRegion(const std::shared_ptr<Region> &region) {
+  for (int i = 0; i < 113; i++) {
+    region->put("KEY--" + std::to_string(i), "VALUE--" + std::to_string(i));
+  }
+}
+
+TEST(FunctionExecutionTest, FunctionExecutionSingleHopNonHA) {
+  Cluster cluster{
+      LocatorCount{1}, ServerCount{3},
+      CacheXMLFiles(
+          {std::string(getFrameworkString(FrameworkVariable::TestCacheXmlDir)) 
+
+               "/func_cacheserver1_pool_nonHA.xml",
+           std::string(getFrameworkString(FrameworkVariable::TestCacheXmlDir)) 
+
+               "/func_cacheserver2_pool_nonHA.xml",
+           std::string(getFrameworkString(FrameworkVariable::TestCacheXmlDir)) 
+
+               "/func_cacheserver3_pool_nonHA.xml"})};
+
+  cluster.start([&]() {
+    cluster.getGfsh()
+        .deploy()
+        .jar(getFrameworkString(FrameworkVariable::JavaObjectJarPath))
+        .execute();
+  });
+
+  auto cache = CacheFactory().create();
+  auto poolFactory = cache.getPoolManager().createFactory();
+
+  cluster.applyLocators(poolFactory);
+
+  auto pool =
+      poolFactory.setPRSingleHopEnabled(true).setRetryAttempts(0).create(
+          "pool");
+
+  auto region = cache.createRegionFactory(RegionShortcut::PROXY)
+                    .setPoolName("pool")
+                    .create("partition_region");
+
+  populateRegion(region);
+
+  for (int i = 0; i < 30; i++) {
+    auto functionService = FunctionService::onRegion(region);
+    auto rc =
+        functionService.withCollector(std::make_shared<TestResultCollector>())

Review comment:
       Thanks for the review! Really appreciate it!
   
   Actually I already did the same thing in my integration test 
`FunctionExecutionWithIncompleteBucketLocations`. If you inspect it closely you 
will see following similarities:
   
   1. I do same here as you when execute 50 puts. Additionally, I use hook to 
check that metadata is updated on client. For this case it is important to have 
incomplete metadata (number of locations is not important in retrieved 
metadata), because in case metadata is never refreshed on client the faulty 
case would not be triggered. I think that you use sleep instead the hook for 
this reason.
   ```
     // Populate region in a way that not all buckets are created.
     // Servers in this case will create 88 of possible 113 buckets.
     populateRegion(region);
   
     // Check that PR metadata is updated. This is done to be sure
     // that client will execute function in a non single hop manner
     // because metadata doesn't contain all bucket locations.
     // After metadata is refreshed, it will contain at least one
     // bucket location.
     CacheImpl *cacheImpl = CacheRegionHelper::getCacheImpl(&cache);
     waitUntilPRMetadataIsRefreshed(cacheImpl);
   ```
   2. Then I execute function, which then trigger faulty case. You can remove 
fix and execute this case, and you will get 
"InternalFunctionInvocationTargetException" every time.
   ```
     auto functionService = FunctionService::onRegion(region);
     auto rc =
         functionService.withCollector(std::make_shared<TestResultCollector>())
             .execute("MultiGetAllFunctionNonHA");
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> InternalFunctionInvocationTargetException when executing single hop function 
> all buckets
> ----------------------------------------------------------------------------------------
>
>                 Key: GEODE-9576
>                 URL: https://issues.apache.org/jira/browse/GEODE-9576
>             Project: Geode
>          Issue Type: Bug
>          Components: native client
>            Reporter: Jakov Varenina
>            Assignee: Jakov Varenina
>            Priority: Major
>              Labels: pull-request-available
>
>  *InternalFunctionInvocationTargetException: Multiple target nodes found for 
> single hop operation* occurs on native client when executing function in a 
> single hop manner for all buckets during the period when client bucket 
> metadata doesn't contain all buckets locations.
> Java client in this case executes functions in non single hop manner until it 
> receives locations of all buckets on servers. The solution in native client 
> would be to implement the same handling as in java client.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to