diff --git a/arangod/Aql/ModificationBlocks.cpp b/arangod/Aql/ModificationBlocks.cpp index 43579eeb90..6598548c4a 100644 --- a/arangod/Aql/ModificationBlocks.cpp +++ b/arangod/Aql/ModificationBlocks.cpp @@ -174,21 +174,6 @@ int ModificationBlock::extractKey(AqlValue const& value, return TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief check whether a shard key value has changed -//////////////////////////////////////////////////////////////////////////////// - -bool ModificationBlock::isShardKeyChange(TRI_json_t const* oldJson, - TRI_json_t const* newJson, - bool isPatch) const { - TRI_ASSERT(_isDBServer); - - auto planId = _collection->documentCollection()->_info.planId(); - auto vocbase = static_cast(_exeNode)->_vocbase; - return arangodb::shardKeysChanged(vocbase->_name, std::to_string(planId), - oldJson, newJson, isPatch); -} - //////////////////////////////////////////////////////////////////////////////// /// @brief check whether the _key attribute is specified when it must not be /// specified diff --git a/arangod/Aql/ModificationBlocks.h b/arangod/Aql/ModificationBlocks.h index 8469bee4bd..d14b5f29f7 100644 --- a/arangod/Aql/ModificationBlocks.h +++ b/arangod/Aql/ModificationBlocks.h @@ -66,13 +66,6 @@ class ModificationBlock : public ExecutionBlock { int extractKey(AqlValue const&, std::string&); - ////////////////////////////////////////////////////////////////////////////// - /// @brief check whether a shard key value has changed - ////////////////////////////////////////////////////////////////////////////// - - bool isShardKeyChange(struct TRI_json_t const*, struct TRI_json_t const*, - bool) const; - ////////////////////////////////////////////////////////////////////////////// /// @brief check whether a shard key was set when it must not be set ////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/Cluster/ClusterMethods.cpp b/arangod/Cluster/ClusterMethods.cpp index ad66006f21..461eaa579e 100644 --- a/arangod/Cluster/ClusterMethods.cpp +++ b/arangod/Cluster/ClusterMethods.cpp @@ -178,58 +178,6 @@ bool shardKeysChanged(std::string const& dbname, std::string const& collname, return false; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief check if a list of attributes have the same values in two JSON -/// documents -//////////////////////////////////////////////////////////////////////////////// - -bool shardKeysChanged(std::string const& dbname, std::string const& collname, - TRI_json_t const* oldJson, TRI_json_t const* newJson, - bool isPatch) { - if (!TRI_IsObjectJson(oldJson) || !TRI_IsObjectJson(newJson)) { - // expecting two objects. everything else is an error - return true; - } - - TRI_json_t nullJson; - TRI_InitNullJson(&nullJson); - - ClusterInfo* ci = ClusterInfo::instance(); - std::shared_ptr c = ci->getCollection(dbname, collname); - std::vector const& shardKeys = c->shardKeys(); - - for (size_t i = 0; i < shardKeys.size(); ++i) { - if (shardKeys[i] == TRI_VOC_ATTRIBUTE_KEY) { - continue; - } - - TRI_json_t const* n = TRI_LookupObjectJson(newJson, shardKeys[i].c_str()); - - if (n == nullptr && isPatch) { - // attribute not set in patch document. this means no update - continue; - } - - TRI_json_t const* o = TRI_LookupObjectJson(oldJson, shardKeys[i].c_str()); - - if (o == nullptr) { - // if attribute is undefined, use "null" instead - o = &nullJson; - } - - if (n == nullptr) { - // if attribute is undefined, use "null" instead - n = &nullJson; - } - - if (!TRI_CheckSameValueJson(o, n)) { - return true; - } - } - - return false; -} - //////////////////////////////////////////////////////////////////////////////// /// @brief returns users //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/Cluster/ClusterMethods.h b/arangod/Cluster/ClusterMethods.h index 8ad73fe3fb..c90455f0ba 100644 --- a/arangod/Cluster/ClusterMethods.h +++ b/arangod/Cluster/ClusterMethods.h @@ -59,15 +59,6 @@ void mergeResponseHeaders(arangodb::rest::HttpResponse* response, std::map getForwardableRequestHeaders( arangodb::rest::HttpRequest* request); -//////////////////////////////////////////////////////////////////////////////// -/// @brief check if a list of attributes have the same values in two JSON -/// documents -//////////////////////////////////////////////////////////////////////////////// - -bool shardKeysChanged(std::string const& dbname, std::string const& collname, - struct TRI_json_t const* oldJson, - struct TRI_json_t const* newJson, bool isPatch); - //////////////////////////////////////////////////////////////////////////////// /// @brief check if a list of attributes have the same values in two vpack /// documents