mirror of https://gitee.com/bigwinds/arangodb
Remove old code w.r.t. shardKeysChanged test.
This commit is contained in:
parent
58d439bc98
commit
d4fb621d19
|
@ -174,21 +174,6 @@ int ModificationBlock::extractKey(AqlValue const& value,
|
||||||
return TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING;
|
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<ModificationNode const*>(_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
|
/// @brief check whether the _key attribute is specified when it must not be
|
||||||
/// specified
|
/// specified
|
||||||
|
|
|
@ -66,13 +66,6 @@ class ModificationBlock : public ExecutionBlock {
|
||||||
|
|
||||||
int extractKey(AqlValue const&, std::string&);
|
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
|
/// @brief check whether a shard key was set when it must not be set
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -178,58 +178,6 @@ bool shardKeysChanged(std::string const& dbname, std::string const& collname,
|
||||||
return false;
|
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<CollectionInfo> c = ci->getCollection(dbname, collname);
|
|
||||||
std::vector<std::string> 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
|
/// @brief returns users
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -59,15 +59,6 @@ void mergeResponseHeaders(arangodb::rest::HttpResponse* response,
|
||||||
std::map<std::string, std::string> getForwardableRequestHeaders(
|
std::map<std::string, std::string> getForwardableRequestHeaders(
|
||||||
arangodb::rest::HttpRequest* request);
|
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
|
/// @brief check if a list of attributes have the same values in two vpack
|
||||||
/// documents
|
/// documents
|
||||||
|
|
Loading…
Reference in New Issue