Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 6e7a1d1a4d8aa32f43f1683cdcfda7e91d1087bd
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Thu Sep 28 10:12:14 2017 +0200

    append shardid to query string

commit a8feac0
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Thu Sep 28 09:29:10 2017 +0200

    add missing items at shutdown and fix skipsome

commit 31ddbc1
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Mon Sep 25 14:01:45 2017 +0200

    make use of cachecheck in RestAqlHandler, change logging and fix other

commit 1260768
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Mon Sep 25 12:56:52 2017 +0200

    add invalidation counter to query cache

commit 77740eb
Merge: 31213ef 4d20d50
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Tue Sep 12 09:33:49 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      fix cleanup
      Remove override of testmatrix (build only linux)
      Fix Foxx queue test (#3219)

commit 31213ef
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Mon Sep 11 22:08:19 2017 +0200

    add custom type for ranges and stringification for more nodes

    as well as emplaceValue() to AqlItemBlock

commit e9230ca
Merge: c9d9c0e cf66414
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Mon Sep 11 11:35:38 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      fix compilation in non-maintainer-mode
      Feature/jenkins pipeline (#3218)
      increase cache lifetime for cluster selectivity estimates
      fixed a bug, where when servers failed, when also agency leadership c… (#3189)
      added new test suite authentication_server
      No access collections Improvements (#3190)
      removing unnecessary rate limiting (#3194)
      fix duplicate mutex (#3215)
      updated CHANGELOG
      Feature/jenkins pipeline (#3210)
      Aardvark: Disable vertical line in query explain editor

commit c9d9c0e
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Fri Sep 8 17:01:03 2017 +0200

    query result cache: recreate AqlItemBlocks from cache before sending

commit 8299618
Merge: aa35e84 98e6484
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Wed Sep 6 15:35:58 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      Fix bug in RocksDB incremental collection sync for empty colls. (#3207)

commit aa35e84
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Wed Sep 6 15:34:47 2017 +0200

    query result cache: fix ast stringification

commit 2bf05bd
Merge: 94f17bc eacad99
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Tue Sep 5 08:44:11 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      Bug fix/fixes 0409 (#3199)
      give usefull errors in case of rocksdb init aborting with 'IOError' w… (#3178)
      Handle non-existing user config in RestUserHandler (#3200)
      Bug fix/truncate geo (#3173)
      fix deadlocks in cluster traversals (#3198)
      execute DOCUMENT function via CXX on coordinator in cluster mode (#3196)
      Bug fix/fixes 0109 (#3191)

commit 94f17bc
Merge: 070b0aa 76dbc2e
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Mon Sep 4 17:03:20 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      Add tick to batch result. (#3195)
      added option `--server.check-max-memory-mappings` (#3185)
      removed useless explain
      fix windows ifdefs
      fixes for MSVC
      potential fix for MSVC
      fix clang warnings
      Bug fix/enterprise build quick fix (#3183)
      fix broken enterprise build (#3181)
      fix systemd issues when reinstalling a package

commit 070b0aa
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Mon Sep 4 17:02:36 2017 +0200

    cluster query cache: first items are returned from the cache

commit 93b4d87
Merge: 5f46fa1 dfb5630
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Fri Sep 1 09:38:34 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      PUBLIC enterprise definitions
      Feature/unique vpack index lookup performance improvements with rocksdbkey optimizations (#3123)
      correct tempdir under windows
      Making foxx-queues test deterministic (#3172)
      Optimizations for Caches and Graph Traversals (#3169)
      Merge with latest changes in improve-jenkins
      Fix compiler warnings and needlessly failing catch tests. (#3171)
      Bug fix/unordered map changes order in catch tests (#3175)
      be more ignorant about existing or missing directories on startup / cleanup.
      fix upgrade exit codes
      fix postinst script of debian package

commit 5f46fa1
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Fri Sep 1 09:37:53 2017 +0200

    query result cache: implement code in RestHandler

commit 8722da5
Merge: fa41b11 86db523
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Thu Aug 31 07:22:18 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      fix compile warning in non-maintainer mode
      windows implementation was missing
      Feature/cluster inventory version (#3152)
      fixed some MSVC warnings
      rename scripts
      change to devel

commit fa41b11
Merge: 7ba5dc8 e7a606a
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Wed Aug 30 12:10:17 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      updated CHANGELOG

commit 7ba5dc8
Merge: 85eddc3 94e9744
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Wed Aug 30 12:04:13 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      order of free and free2 changed with use of unordered_multimap vs multimap (#3168)
      jslint (#3167)
      Cleanup after each testrun (#3109)
      Feature/planning 499 different error codes for version check (#3118)
      Remove attribute option for arangoimp  (#3141)
      Bug fix/agency mt fixes (#3158)
      When the user entered non-matching passwords, we need to go back two steps so he can re-enter the first password too. (#3155)
      Changed some tasks to post through Scheduler instead of directly. (#3159)
      Bug fix/scheduling et al (#3161)

commit 85eddc3
Merge: f5c99f7 ec2191c
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Wed Aug 30 08:35:52 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      Proper defaults
      Failed regex
      rename
      no more real
      Publish a basic but hopefully working pipeline
      dont sleep at start (#3164)
      Bug fix/fixes 2808 (#3156)
      Improvements to CachedValue internals and handling. (#3126)
      Fixing error reporting in arangoimp (#3153)
      Don't use global static variables as collection caches - this may cau… (#3150)
      Added a more descriptiove documentation about ArangoRestore when using authentication and UserManagement. As required by: #3023 (#3148)
      Bug fix/issue 3106 orphans in general graph (#3147)
      added resilience to pipelince for cluster tests (#3140)
      fixed a bug in create collection in cluster, where transaction result was not checked for success before access (#3137)
      Fix HTTP Foxx API Json parsing (#3129)
      Report proper error for arangoimp create collection failure. (#3127)
      Bug fix/foxx queue auth (devel) (#3122)
      fixed wrong ui cluster health information (#3151)

commit f5c99f7
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Wed Aug 30 08:16:42 2017 +0200

    query result cache: add cacheUse() function to AqlQuery

commit ad103f1
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Tue Aug 29 14:47:00 2017 +0200

    query result cache: prepare caching in resthandler

commit 10d500a
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Tue Aug 29 10:16:13 2017 +0200

    increment version number in documentation (manpages)

commit f22f838
Merge: b3d2316 7d72f13
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Mon Aug 28 10:44:19 2017 +0200

    Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/planning-query-result-cache

    * 'devel' of https://github.com/arangodb/arangodb:
      handle the NODE_MODULES_DIR via a global variable.
      cleanup our workplace before we do a distbuild
      remove obsolete, dysfunctional endpoints (#3135)
      No access collections (#3088)
      Adding missing changelog / breaking upgrades entries (#3128)
      added missing CHANGELOG entry (#3124)
      Bug fix/scheduler delete (#3077)
      remove directory first, so we don't copy it into a sub directory
      use indices on our foxx queues queries; Migrate queries away from aqb… (#3101)
      when running the client tests on an already running server we have to specify the server root directory. (#3102)
      Fix foxx queue test (#3119)
      Bug fix/issues 2308 (#3117)
      a few simplifications and extensions (#3115)
      fight msvc warnings (#3112)
      Feature/unique vpack index lookup performance improvements (#3087)

commit b3d2316
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Fri Aug 25 15:43:27 2017 +0200

    Add fakequery string to creation of queries on DBServers

commit fa5564e
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Fri Aug 25 11:48:43 2017 +0200

    Add fakequery string to query when receiving via RestAqlHandler

commit 667bc35
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Fri Aug 25 11:47:59 2017 +0200

    send query string to DBServers

commit 279e9bd
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Fri Aug 25 10:21:56 2017 +0200

    get fake stringification working for basic cases

commit 08b80bf
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Thu Aug 24 16:57:48 2017 +0200

    query result cache: add fake stringify for some nodes

commit 4d2ba5e
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Thu Aug 24 12:04:21 2017 +0200

    query result cache: prepare hash value creation

commit da40a02
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Thu Aug 24 10:07:39 2017 +0200

    result cache: update functiosn in v8-vocbase

commit f502af8
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Thu Aug 24 09:46:33 2017 +0200

    result cache: move code (share with v8) and implement clear()

commit c529c24
Author: Jan Christoph Uhde <Jan@UhdeJC.com>
Date:   Thu Aug 24 07:50:34 2017 +0200

    add code for properties
  • Loading branch information
ObiWahn committed Dec 22, 2017
1 parent ba74203 commit e85ebed
Show file tree
Hide file tree
Showing 29 changed files with 1,479 additions and 574 deletions.
9 changes: 4 additions & 5 deletions arangod/Aql/AqlItemBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,10 @@ AqlItemBlock::AqlItemBlock(ResourceMonitor* resourceMonitor, VPackSlice const sl
dataIterator.next();
VPackSlice highBound = dataIterator.value();
dataIterator.next();

int64_t low =
VelocyPackHelper::getNumericValue<int64_t>(lowBound, 0);
int64_t high =
VelocyPackHelper::getNumericValue<int64_t>(highBound, 0);

int64_t low = VelocyPackHelper::getNumericValue<int64_t>(lowBound, 0);
int64_t high = VelocyPackHelper::getNumericValue<int64_t>(highBound, 0);

AqlValue a(low, high);
try {
setValue(i, column, a);
Expand Down
362 changes: 362 additions & 0 deletions arangod/Aql/AqlQueryResultCache.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,362 @@
#include "Aql/AqlQueryResultCache.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/QueryCache.h"
#include "Aql/AqlItemBlock.h"

#include "Basics/Result.h"
#include "Basics/encoding.h"
#include "Cluster/ClusterInfo.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ServerState.h"

#include <velocypack/Builder.h>
#include <velocypack/Slice.h>
#include <velocypack/velocypack-aliases.h>

namespace arangodb {
namespace aql {
namespace cache {

using EN = arangodb::aql::ExecutionNode;

// generates a hashable represenation of an exectution plan for usage on dbserver
// empty string denotes uncacheable query
std::string fakeQueryString(ExecutionPlan const* subPlan){
std::string result;
bool stringValid = subPlan->root()->fakeQueryString(result);
LOG_DEVEL_IF(stringValid) << " #COORDINATOR# subPlan String: '" << result <<"'";
if (!stringValid) {
result.clear();
}
return result;
}

auto vPackToBlock(VPackArrayIterator& iter
,std::unique_ptr<ResourceMonitor>& monitor
,std::size_t atLeast, std::size_t atMost
)
-> std::tuple<Result, std::unique_ptr<AqlItemBlock>, std::size_t>
{
//tries to read `items` items from `iter` into a default inititalized AqlItemBlock `block`
std::tuple<Result,std::unique_ptr<AqlItemBlock>, std::size_t> result{TRI_ERROR_NO_ERROR,nullptr,0};

Result& rv = std::get<0>(result);
std::unique_ptr<AqlItemBlock>& block = std::get<1>(result);
std::size_t& items = std::get<2>(result);

if(atLeast && !iter.valid()){
rv.reset(TRI_ERROR_INTERNAL,"try to get items from invalid iterator");
}

bool skip = (monitor == nullptr);

TRI_ASSERT(iter.value().isArray());
auto max = std::min(atMost,iter.size()-iter.index());

if(!skip){
block.reset(new AqlItemBlock(monitor.get()
,max /*nrItems*/
,iter.value().length() /*nrRegs*/
));
}

std::size_t itemsReceived = 0;
try {
while(itemsReceived < max && iter.valid()) {
if(!skip){
std::size_t reg=0;
for(auto const& value : VPackArrayIterator(iter.value())){
if(value.isCustom()){
uint8_t const* p = value.startAs<uint8_t>();
if(*p == 0xf6){
LOG_DEVEL << "unpack custom";
p+=2; //skip type and len;
int64_t low = encoding::readNumber<int64_t>(p,sizeof(std::int64_t));
p += sizeof(std::int64_t);
int64_t high = encoding::readNumber<int64_t>(p,sizeof(std::int64_t));
block->emplaceValue(itemsReceived, reg, low,high);
//block->setValue(itemsReceived, reg, AqlValue(low,high));
} else {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unknown custom type");
}
} else if(!value.isNone()){
block->emplaceValue(itemsReceived, reg, value);
//block->setValue(itemsReceived, reg, AqlValue(value));
}
++reg;
}
}
++itemsReceived;
iter.next();
}
} CATCH_TO_RESULT(rv, TRI_ERROR_INTERNAL)
items=itemsReceived;
LOG_DEVEL_IF(rv.fail()) << "!!!!!!!!!!" <<rv.errorMessage();
return result;
}

Result blockToVPack(AqlItemBlock const& block, VPackBuilder& builder, std::size_t regs /*0 if unknown*/){
// this functions writes rows (results) of an AqlItemBlock as Arrays to an
// already open VPackBuilder.
//
// the following translation is applied:
// empty -> nullSlice
// range -> "peter"
// slice (untranslated)


// due to lack of discussion a pragmatic implementation will be used
// this will be slow because the data in aql blocks is stored per column
// and we need to access rows. This is a hard requirement because we need
// to append data. While the itemblock has chosen the columnise layout
// to store the data more effective. This is expected to be slow. Especially
// if we need to create later the "raw" VelocyPack that is used in the remote
// (coordinator) to create a new itemblock.
Result rv;
{
std::size_t n = block.getNrRegs();
if(regs){
if (regs != n ){
TRI_ASSERT(false);
return rv.reset(TRI_ERROR_INTERNAL, "number of registers in AqlItemBlock does not match expected value");
}
} else {
regs = n;
}
}
try {
for(std::size_t i = 0; i < block.size() /*number of items in block*/ ; i++){
builder.openArray();
for(std::size_t r=0 ; r < regs /*number of vars in block*/; r++){
AqlValue const& val = block.getValueReference(i,r);
if(val.isRange()){

uint8_t* p = builder.add(VPackValuePair(18ULL, VPackValueType::Custom));
// 1 - customtype 0xf6
// 1 - length of payload
// 8 - low (int64_t)
// 8 - high (int64_t)
*p++ = 0xf6; // custom type for range
*p++ = 0x10; // 16byte to store
encoding::storeNumber(p, val.range()->_low, sizeof(std::int64_t));
p += sizeof(std::int64_t);
encoding::storeNumber(p, val.range()->_high, sizeof(std::int64_t));

} else if(val.isDocvec()){
LOG_DEVEL << " ############### not implemented for docvec ###################";
builder.add(VPackSlice::noneSlice());
return rv.reset(TRI_ERROR_INTERNAL, "caching of docvec is not supported");
} else if(val.isEmpty()) {
builder.add(VPackSlice::noneSlice());
} else {
builder.add(val.slice());
}
}
builder.close();
}
} CATCH_TO_RESULT(rv, TRI_ERROR_INTERNAL)
LOG_DEVEL_IF(rv.fail()) << "!!!!!!!!!!" <<rv.errorMessage();
return rv;
}

Result properties(VPackBuilder& result) {
Result rv;
if(ServerState::instance()->isCoordinator()) {
ClusterInfo* ci = ClusterInfo::instance();
if (!ci){
return rv.reset(TRI_ERROR_INTERNAL, "unable to get ClusterInfo instance");
}

auto cc = ClusterComm::instance();
if (!cc){
return rv.reset(TRI_ERROR_INTERNAL, "unable to get ClusterComm instance");
}

auto dbServerIdVec = ci->getCurrentDBServers();
std::vector<ClusterCommRequest> requests;
std::string const requestsUrl = "/_api/query-cache/properties";
auto jsonBody = std::make_shared<std::string>();

if(!dbServerIdVec.empty()) {
// we assume that all DBServers have the same
// configuration what might not be true
size_t nrDone = 0;
static double const CL_DEFAULT_TIMEOUT = 120.0;
requests.emplace_back("server:" + dbServerIdVec[0],
arangodb::rest::RequestType::GET,
requestsUrl, jsonBody);
cc->performRequests(requests, CL_DEFAULT_TIMEOUT, nrDone, Logger::QUERIES, true);
if (!requests.empty()) {
auto& res = requests[0].result;
if (res.status == CL_COMM_RECEIVED) {
if (res.answer_code == arangodb::rest::ResponseCode::OK) {
VPackSlice answer = res.answer->payload();
if (answer.isObject()) {
result.add(answer);
return rv;
} else {
rv.reset(TRI_ERROR_INTERNAL);
}
} else {
rv.reset(TRI_ERROR_CLUSTER_CONNECTION_LOST, "did not receive cluster comm result");
}
} else {
rv.reset(TRI_ERROR_CLUSTER_BACKEND_UNAVAILABLE);
}
}
}
if (rv.fail()){ return rv; }
} else {
auto queryCache = arangodb::aql::QueryCache::instance();
VPackBuilder cacheResult = queryCache->properties();
result.add(cacheResult.slice());
}
return rv;
}

////////////////////////////////////////////////////////////////////////////////
/// @brief was docuBlock PutApiQueryCacheProperties
////////////////////////////////////////////////////////////////////////////////

// set properites
Result properties(VPackSlice const& properties) {
Result rv;

if (!properties.isObject()) {
return rv.reset(TRI_ERROR_HTTP_BAD_PARAMETER, "expecting a JSON-Object body");
}

if(ServerState::instance()->isCoordinator()) {
// Ask DB Servers to enable cache

ClusterInfo* ci = ClusterInfo::instance();
if (!ci){
rv.reset(TRI_ERROR_INTERNAL, "unable to get ClusterInfo instance");
}

auto cc = ClusterComm::instance();
if (!cc){
rv.reset(TRI_ERROR_INTERNAL, "unable to get ClusterComm instance");
}

if(rv.fail()){ return rv; };

auto dbServerIdVec = ci->getCurrentDBServers();
std::vector<ClusterCommRequest> requests;
std::string const requestsUrl = "/_api/query-cache/properties";

auto jsonBody = std::make_shared<std::string>(properties.toJson());

for (auto const& id : dbServerIdVec) {
requests.emplace_back("server:" + id,
arangodb::rest::RequestType::PUT,
requestsUrl, jsonBody);
}

size_t nrDone = 0;
static double const CL_DEFAULT_TIMEOUT = 120.0;
cc->performRequests(requests, CL_DEFAULT_TIMEOUT, nrDone, Logger::QUERIES, true);

for (auto& req : requests) {
auto& res = req.result;
if (res.status == CL_COMM_RECEIVED) {
if (res.answer_code == arangodb::rest::ResponseCode::OK) {
VPackSlice answer = res.answer->payload();
if (answer.isObject()) {
// check further?
} else {
rv.reset(TRI_ERROR_INTERNAL);
}
} else {
rv.reset(TRI_ERROR_CLUSTER_CONNECTION_LOST, "did not receive cluster comm result");
}
} else {
rv.reset(TRI_ERROR_CLUSTER_BACKEND_UNAVAILABLE);
}
// communication to one of the dbservers failed
// so the overall operation failed
if (rv.fail()){ return rv; }
}

} else {
auto queryCache = arangodb::aql::QueryCache::instance();

std::pair<std::string, size_t> cacheProperties;
queryCache->properties(cacheProperties);

VPackSlice attribute = properties.get("mode");
if (attribute.isString()) {
cacheProperties.first = attribute.copyString();
}

attribute = properties.get("maxResults");
if (attribute.isNumber()) {
cacheProperties.second = static_cast<size_t>(attribute.getUInt());
}

queryCache->setProperties(cacheProperties);
}
return rv;
}

Result clear(){
Result rv;
if(ServerState::instance()->isCoordinator()) {
ClusterInfo* ci = ClusterInfo::instance();
if (!ci){
rv.reset(TRI_ERROR_INTERNAL, "unable to get ClusterInfo instance");
}

auto cc = ClusterComm::instance();
if (!cc){
rv.reset(TRI_ERROR_INTERNAL, "unable to get ClusterComm instance");
}

if(rv.fail()){ return rv; };

auto dbServerIdVec = ci->getCurrentDBServers();
std::vector<ClusterCommRequest> requests;
std::string const requestsUrl = "/_api/query-cache";

auto fakeBody = std::make_shared<std::string>();

for (auto const& id : dbServerIdVec) {
requests.emplace_back("server:" + id,
arangodb::rest::RequestType::DELETE_REQ,
requestsUrl, fakeBody);
}

size_t nrDone = 0;
static double const CL_DEFAULT_TIMEOUT = 120.0;
cc->performRequests(requests, CL_DEFAULT_TIMEOUT, nrDone, Logger::QUERIES, true);

for (auto& req : requests) {
auto& res = req.result;
if (res.status == CL_COMM_RECEIVED) {
if (res.answer_code == arangodb::rest::ResponseCode::OK) {
VPackSlice answer = res.answer->payload();
if (answer.isObject()) {
// check further?
} else {
rv.reset(TRI_ERROR_INTERNAL);
}
} else {
rv.reset(TRI_ERROR_CLUSTER_CONNECTION_LOST, "did not receive cluster comm result");
}
} else {
rv.reset(TRI_ERROR_CLUSTER_BACKEND_UNAVAILABLE);
}
// communication to one of the dbservers failed
// so the overall operation failed
if (rv.fail()){ return rv; }
}
} else {
auto queryCache = arangodb::aql::QueryCache::instance();
queryCache->invalidate();
}
return rv;
}

}
}
}
Loading

0 comments on commit e85ebed

Please sign in to comment.