1
0
Fork 0

Merge branch 'devel' of github.com:arangodb/arangodb into devel

This commit is contained in:
hkernbach 2016-04-19 18:02:08 +02:00
commit 75df0f56f7
9 changed files with 62 additions and 17 deletions

View File

@ -533,6 +533,10 @@ QueryResult Query::execute(QueryRegistry* registry) {
if (cacheEntry != nullptr) {
// got a result from the query cache
QueryResult res(TRI_ERROR_NO_ERROR);
// we don't have yet a transaction when we're here, so let's create
// a mimimal context to build the result
res.context = std::make_shared<StandaloneTransactionContext>(_vocbase);
res.warnings = warningsToVelocyPack();
TRI_ASSERT(cacheEntry->_queryResult != nullptr);
res.result = cacheEntry->_queryResult;
@ -687,13 +691,13 @@ QueryResultV8 Query::executeV8(v8::Isolate* isolate, QueryRegistry* registry) {
arangodb::aql::QueryCacheResultEntryGuard guard(cacheEntry);
if (cacheEntry != nullptr) {
// we don't have yet a transaction when we're here, so let's create
// a mimimal context to build the result
auto transactionContext = createTransactionContext();
// got a result from the query cache
QueryResultV8 res(TRI_ERROR_NO_ERROR);
// we don't have yet a transaction when we're here, so let's create
// a mimimal context to build the result
res.context = std::make_shared<StandaloneTransactionContext>(_vocbase);
v8::Handle<v8::Value> values = TRI_VPackToV8(isolate, cacheEntry->_queryResult->slice(), transactionContext->getVPackOptions());
v8::Handle<v8::Value> values = TRI_VPackToV8(isolate, cacheEntry->_queryResult->slice(), res.context->getVPackOptions());
TRI_ASSERT(values->IsArray());
res.result = v8::Handle<v8::Array>::Cast(values);
res.cached = true;

View File

@ -21,7 +21,8 @@
/// @author Andreas Streichardt
////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef ARANGOD_CLUSTER_AGENCY_CALLBACK_H
#define ARANGOD_CLUSTER_AGENCY_CALLBACK_H 1
#include <functional>
#include <memory>
@ -66,3 +67,6 @@ private:
};
}
#endif

View File

@ -21,7 +21,8 @@
/// @author Andreas Streichardt
////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef ARANGOD_CLUSTER_AGENCY_CALLBACK_REGISTRY_H
#define ARANGOD_CLUSTER_AGENCY_CALLBACK_REGISTRY_H 1
#include "Cluster/AgencyCallback.h"
#include "Basics/ReadWriteLock.h"
@ -73,3 +74,5 @@ private:
};
}
#endif

View File

@ -21,7 +21,8 @@
/// @author Andreas Streichardt
////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef ARANGOD_CLUSTER_REST_AGENCY_CALLBACKS_HANDLER_H
#define ARANGOD_CLUSTER_REST_AGENCY_CALLBACKS_HANDLER_H 1
#include "Basics/Common.h"
#include "RestHandler/RestVocbaseBaseHandler.h"
@ -52,3 +53,5 @@ class RestAgencyCallbacksHandler : public RestVocbaseBaseHandler {
};
}
}
#endif

View File

@ -147,7 +147,11 @@ void ImportFeature::validateOptions(
size_t n = positionals.size();
if (1 == n) {
_filename = positionals[0];
// only take positional file name attribute into account if user
// did not specify the --file option as well
if (!options->processingResult().touched("--file")) {
_filename = positionals[0];
}
} else if (1 < n) {
LOG(ERR) << "expecting at most one filename, got " +
StringUtils::join(positionals, ", ");

View File

@ -87,6 +87,11 @@ var findOrCreateCollectionByName = function (name, type, noCreate) {
err.errorNum = arangodb.errors.ERROR_GRAPH_NOT_AN_ARANGO_COLLECTION.code;
err.errorMessage = name + arangodb.errors.ERROR_GRAPH_NOT_AN_ARANGO_COLLECTION.message;
throw err;
} else if (type === ArangoCollection.TYPE_EDGE && col.type() !== type) {
var err2 = new ArangoError();
err2.errorNum = arangodb.errors.ERROR_ARANGO_COLLECTION_TYPE_INVALID.code;
err2.errorMessage = name + " cannot be used as relation. It is not an edge collection";
throw err2;
}
return res;
};

View File

@ -314,6 +314,7 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
return nullptr;
}
this->close(); // this sets the state to IN_CONNECT for a retry
usleep(5000);
break;
}

View File

@ -108,10 +108,12 @@ v8::Handle<v8::Value> TRI_VPackToV8(v8::Isolate* isolate,
VPackOptions const* options,
VPackSlice const* base) {
switch (slice.type()) {
case VPackValueType::Null:
case VPackValueType::Null: {
return v8::Null(isolate);
case VPackValueType::Bool:
}
case VPackValueType::Bool: {
return v8::Boolean::New(isolate, slice.getBool());
}
case VPackValueType::Double: {
// convert NaN, +inf & -inf to null
double value = slice.getDouble();
@ -145,12 +147,19 @@ v8::Handle<v8::Value> TRI_VPackToV8(v8::Isolate* isolate,
case VPackValueType::SmallInt: {
return v8::Integer::New(isolate, slice.getNumericValue<int32_t>());
}
case VPackValueType::String:
case VPackValueType::String: {
return ObjectVPackString(isolate, slice);
case VPackValueType::Object:
return ObjectVPackObject(isolate, slice, options, base);
case VPackValueType::Array:
}
case VPackValueType::Array: {
return ObjectVPackArray(isolate, slice, options, base);
}
case VPackValueType::Object: {
return ObjectVPackObject(isolate, slice, options, base);
}
case VPackValueType::External: {
// resolve external
return TRI_VPackToV8(isolate, VPackSlice(slice.getExternal()), options, base);
}
case VPackValueType::Custom: {
if (options == nullptr || options->customTypeHandler == nullptr || base == nullptr) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
@ -161,8 +170,9 @@ v8::Handle<v8::Value> TRI_VPackToV8(v8::Isolate* isolate,
return TRI_V8_STD_STRING(id);
}
case VPackValueType::None:
default:
default: {
return v8::Undefined(isolate);
}
}
}

View File

@ -44,11 +44,13 @@ build/bin/arangod -c etc/relative/arangod.conf \
--agency.wait-for-sync false \
--database.directory cluster/data4001 \
--agency.id 0 \
--javascript.v8-contexts 1 \
--log.file cluster/4001.log \
--log.requests-file cluster/4001.req \
--server.disable-statistics true \
--server.foxx-queues false \
--server.disable-authentication true \
--server.threads 16 \
--javascript.app-path ./js/apps \
--javascript.startup-directory ./js \
> cluster/4001.stdout 2>&1 &
@ -247,12 +249,21 @@ if [ -n "$SECONDARIES" ]; then
fi
echo Bootstrapping DBServers...
curl -s -X POST "http://127.0.0.1:8530/_admin/cluster/bootstrapDbServers" \
curl -s -f -X POST "http://127.0.0.1:8530/_admin/cluster/bootstrapDbServers" \
-d '{"isRelaunch":false}' >> cluster/DBServersUpgrade.log 2>&1
if [ "$?" != 0 ] ; then
echo "Bootstrapping DBServers failed"
exit 1;
fi
echo Running DB upgrade on cluster...
curl -s -X POST "http://127.0.0.1:8530/_admin/cluster/upgradeClusterDatabase" \
curl -s -f -X POST "http://127.0.0.1:8530/_admin/cluster/upgradeClusterDatabase" \
-d '{"isRelaunch":false}' >> cluster/DBUpgrade.log 2>&1
if [ "$?" != 0 ] ; then
echo "DB upgrade on cluster failed"
exit 1;
fi
echo Bootstrapping Coordinators...
PIDS=""