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 2017/04/04 21:37:28 UTC

geode-native git commit: GEODE-2691: Fix function execution attributes mismatch

Repository: geode-native
Updated Branches:
  refs/heads/develop cefe7ac5b -> 962efc7d5


GEODE-2691: Fix function execution attributes mismatch

Fixes function execution invocation which previously passed in attributes that
function execute would compare to the server's view of the registered function
attributes. Since the previously passed in attributes were deprecated there is
nothing to compare. Instead we should accept the attributes that the server
returns.

Testing: Function execution tests pass


Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/962efc7d
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/962efc7d
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/962efc7d

Branch: refs/heads/develop
Commit: 962efc7d59606e687082c041739bdcfd0b0b0c53
Parents: cefe7ac
Author: David Kimura <dk...@pivotal.io>
Authored: Fri Mar 31 11:33:59 2017 -0700
Committer: Ernest Burghardt <eb...@pivotal.io>
Committed: Tue Apr 4 14:37:18 2017 -0700

----------------------------------------------------------------------
 src/cppcache/src/ExecutionImpl.cpp | 52 ++++++++++++++-------------------
 src/cppcache/src/ExecutionImpl.hpp |  2 --
 2 files changed, 22 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode-native/blob/962efc7d/src/cppcache/src/ExecutionImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ExecutionImpl.cpp b/src/cppcache/src/ExecutionImpl.cpp
index 02c264b..6e0c504 100644
--- a/src/cppcache/src/ExecutionImpl.cpp
+++ b/src/cppcache/src/ExecutionImpl.cpp
@@ -72,11 +72,6 @@ std::vector<int8_t>* ExecutionImpl::getFunctionAttributes(const char* func) {
   return NULL;
 }
 
-ResultCollectorPtr ExecutionImpl::execute(const char* func, uint32_t timeout) {
-  LOGDEBUG("ExecutionImpl::execute1: ");
-  return execute(func, timeout, true);
-}
-
 ResultCollectorPtr ExecutionImpl::execute(CacheableVectorPtr& routingObj,
                                           CacheablePtr& args,
                                           ResultCollectorPtr& rs,
@@ -84,11 +79,10 @@ ResultCollectorPtr ExecutionImpl::execute(CacheableVectorPtr& routingObj,
   m_routingObj = routingObj;
   m_args = args;
   m_rc = rs;
-  return execute(func, timeout, false);
+  return execute(func, timeout);
 }
 
-ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout,
-                                          bool verifyFuncArgs) {
+ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
   std::string func = fn;
   LOGDEBUG("ExecutionImpl::execute: ");
   GuardUserAttribures gua;
@@ -100,33 +94,31 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout,
   bool serverIsHA = false;
   bool serverOptimizeForWrite = false;
 
-  if (verifyFuncArgs) {
-    std::vector<int8_t>* attr = getFunctionAttributes(fn);
-    {
+  std::vector<int8_t>* attr = getFunctionAttributes(fn);
+  {
+    if (attr == NULL) {
+      ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_func_attrs_lock);
+      GfErrType err = GF_NOERR;
+      attr = getFunctionAttributes(fn);
       if (attr == NULL) {
-        ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_func_attrs_lock);
-        GfErrType err = GF_NOERR;
-        attr = getFunctionAttributes(fn);
-        if (attr == NULL) {
-          if (m_region != NULLPTR) {
-            err = dynamic_cast<ThinClientRegion*>(m_region.ptr())
-                      ->getFuncAttributes(fn, &attr);
-          } else if (m_pool != NULLPTR) {
-            err = getFuncAttributes(fn, &attr);
-          }
-          if (err != GF_NOERR) {
-            GfErrTypeToException("Execute::GET_FUNCTION_ATTRIBUTES", err);
-          }
-          if (!attr->empty() && err == GF_NOERR) {
-            m_func_attrs[fn] = attr;
-          }
+        if (m_region != NULLPTR) {
+          err = dynamic_cast<ThinClientRegion*>(m_region.ptr())
+                    ->getFuncAttributes(fn, &attr);
+        } else if (m_pool != NULLPTR) {
+          err = getFuncAttributes(fn, &attr);
+        }
+        if (err != GF_NOERR) {
+          GfErrTypeToException("Execute::GET_FUNCTION_ATTRIBUTES", err);
+        }
+        if (!attr->empty() && err == GF_NOERR) {
+          m_func_attrs[fn] = attr;
         }
       }
     }
-    serverHasResult = ((attr->at(0) == 1) ? true : false);
-    serverIsHA = ((attr->at(1) == 1) ? true : false);
-    serverOptimizeForWrite = ((attr->at(2) == 1) ? true : false);
   }
+  serverHasResult = ((attr->at(0) == 1) ? true : false);
+  serverIsHA = ((attr->at(1) == 1) ? true : false);
+  serverOptimizeForWrite = ((attr->at(2) == 1) ? true : false);
 
   LOGDEBUG(
       "ExecutionImpl::execute got functionAttributes from srver for function = "

http://git-wip-us.apache.org/repos/asf/geode-native/blob/962efc7d/src/cppcache/src/ExecutionImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ExecutionImpl.hpp b/src/cppcache/src/ExecutionImpl.hpp
index 882f7dc..caa8ef1 100644
--- a/src/cppcache/src/ExecutionImpl.hpp
+++ b/src/cppcache/src/ExecutionImpl.hpp
@@ -69,8 +69,6 @@ class ExecutionImpl : public Execution {
                          const CacheableVectorPtr& results);
 
  private:
-  ResultCollectorPtr execute(const char* func, uint32_t timeout,
-                             bool verifyFuncArgs);
   ExecutionImpl(const ExecutionImpl& rhs)
       : m_routingObj(rhs.m_routingObj),
         m_args(rhs.m_args),