You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ec...@apache.org on 2018/12/10 23:58:53 UTC

[geode-native] branch develop updated: GEODE-5957: Parse (previously) unknown server error messages

This is an automated email from the ASF dual-hosted git repository.

echobravo pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new d6ec6b8  GEODE-5957: Parse (previously) unknown server error messages
d6ec6b8 is described below

commit d6ec6b858e9f4147121551f08b3abeefa7459ea9
Author: Sai Boorlagadda <sa...@gmail.com>
AuthorDate: Mon Dec 10 15:58:49 2018 -0800

    GEODE-5957: Parse (previously) unknown server error messages
    
    - Handle request data error messages for function execution on a region.
    
    Signed-off-by: Ernest Burghardt <eb...@pivotal.io>
---
 .../integration-test-2/FunctionExecutionTest.cpp   | 38 ++++++++++++++++++++--
 cppcache/src/ThinClientRegion.cpp                  |  5 +++
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/cppcache/integration-test-2/FunctionExecutionTest.cpp b/cppcache/integration-test-2/FunctionExecutionTest.cpp
index 8cdedcb..06b9e02 100644
--- a/cppcache/integration-test-2/FunctionExecutionTest.cpp
+++ b/cppcache/integration-test-2/FunctionExecutionTest.cpp
@@ -44,7 +44,7 @@ std::shared_ptr<Region> setupRegion(Cache &cache) {
   return region;
 }
 
-TEST(FunctionExecutionTest, UnknownFunction) {
+TEST(FunctionExecutionTest, UnknownFunctionOnServer) {
   Cluster cluster{LocatorCount{1}, ServerCount{1}};
   cluster.getGfsh()
       .create()
@@ -61,6 +61,22 @@ TEST(FunctionExecutionTest, UnknownFunction) {
                FunctionExecutionException);
 }
 
+TEST(FunctionExecutionTest, UnknownFunctionOnRegion) {
+  Cluster cluster{LocatorCount{1}, ServerCount{1}};
+  cluster.getGfsh()
+      .create()
+      .region()
+      .withName("region")
+      .withType("REPLICATE")
+      .execute();
+
+  auto cache = cluster.createCache();
+  auto region = setupRegion(cache);
+
+  ASSERT_THROW(FunctionService::onRegion(region).execute("I_Don_t_Exist"),
+               FunctionExecutionException);
+}
+
 class TestResultCollector : public ResultCollector {
   virtual std::shared_ptr<CacheableVector> getResult(
       std::chrono::milliseconds) override {
@@ -74,7 +90,7 @@ class TestResultCollector : public ResultCollector {
   virtual void clearResults() override {}
 };
 
-TEST(FunctionExecutionTest, UnknownFunctionAsync) {
+TEST(FunctionExecutionTest, UnknownFunctionAsyncOnServer) {
   Cluster cluster{LocatorCount{1}, ServerCount{1}};
   cluster.getGfsh()
       .create()
@@ -91,3 +107,21 @@ TEST(FunctionExecutionTest, UnknownFunctionAsync) {
                    .execute("I_Don_t_Exist"),
                FunctionExecutionException);
 }
+
+TEST(FunctionExecutionTest, UnknownFunctionAsyncOnRegion) {
+  Cluster cluster{LocatorCount{1}, ServerCount{1}};
+  cluster.getGfsh()
+      .create()
+      .region()
+      .withName("region")
+      .withType("REPLICATE")
+      .execute();
+
+  auto cache = cluster.createCache();
+  auto region = setupRegion(cache);
+
+  ASSERT_THROW(FunctionService::onRegion(region)
+                   .withCollector(std::make_shared<TestResultCollector>())
+                   .execute("I_Don_t_Exist"),
+               FunctionExecutionException);
+}
diff --git a/cppcache/src/ThinClientRegion.cpp b/cppcache/src/ThinClientRegion.cpp
index ef82072..9927ade 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -3259,10 +3259,15 @@ GfErrType ThinClientRegion::getFuncAttributes(const std::string& func,
                                   reply.getException());
       break;
     }
+    case TcrMessage::REQUEST_DATA_ERROR: {
+      LOGERROR("Error message from server: " + reply.getValue()->toString());
+      throw FunctionExecutionException(reply.getValue()->toString());
+    }
     default: {
       LOGERROR("Unknown message type %d while getting function attributes.",
                reply.getMessageType());
       err = GF_MSG;
+      break;
     }
   }
   return err;