1
0
Fork 0

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

This commit is contained in:
Kaveh Vahedipour 2016-02-03 09:33:25 +01:00
commit a4623a395d
30 changed files with 142 additions and 101 deletions

View File

@ -1,6 +1,6 @@
!CHAPTER Fulltext functions
AQL offers the following functions to filter data based on [fulltext indexes](../Glossary/README.md#fulltext-index):
AQL offers the following functions to filter data based on [fulltext indexes](../IndexHandling/Fulltext.md):
- *FULLTEXT(collection, attribute, query, limit)*:
Returns all documents from collection *collection* for which the attribute *attribute*

View File

@ -74,3 +74,6 @@ looks up a fulltext index
Checks whether a fulltext index on the given attribute *attribute* exists.
!SECTION Fulltext AQL Functions
Fulltext AQL functions are detailed in [Fulltext functions](../Aql/FulltextFunctions.md).

View File

@ -613,7 +613,7 @@ icheck(86,-3,i);
gcp.latitude = 800.0;
gcp.longitude = 80.0;
i = GeoIndex_remove(gi,&gcp);
icheck(87,-1,i);
icheck(87,-3,i);
gcp.latitude = 1.0;
gcp.longitude = 40.0;

View File

@ -36,7 +36,7 @@ class Dispatcher;
/// @brief shard control request handler
////////////////////////////////////////////////////////////////////////////////
class RestShardHandler : public admin::RestBaseHandler {
class RestShardHandler : public RestBaseHandler {
public:
RestShardHandler(rest::HttpRequest* request, rest::Dispatcher*);

View File

@ -1057,6 +1057,10 @@ GeoCoordinates* GeoIndex_PointsWithinRadius(GeoIndex* gi, GeoCoordinate* c,
int r, pot, slot, i;
double snmd, maxsnmd;
GeoIx* gix;
if (c->longitude < -180.0) return NULL;
if (c->longitude > 180.0) return NULL;
if (c->latitude < -90.0) return NULL;
if (c->latitude > 90.0) return NULL;
gix = (GeoIx*)gi;
gres = GeoResultsCons(100);
if (gres == NULL) return NULL;
@ -1118,6 +1122,10 @@ GeoCoordinates* GeoIndex_NearestCountPoints(GeoIndex* gi, GeoCoordinate* c,
int pot, slot, i, left;
double snmd;
GeoIx* gix;
if (c->longitude < -180.0) return NULL;
if (c->longitude > 180.0) return NULL;
if (c->latitude < -90.0) return NULL;
if (c->latitude > 90.0) return NULL;
gix = (GeoIx*)gi;
gr = GeoResultsCons(count);
@ -1671,6 +1679,10 @@ int GeoIndex_remove(GeoIndex* gi, GeoCoordinate* c) {
int i, j, js, pot, potix, slot, pathix;
GeoString mings, gs;
GeoIx* gix;
if (c->longitude < -180.0) return -3;
if (c->longitude > 180.0) return -3;
if (c->latitude < -90.0) return -3;
if (c->latitude > 90.0) return -3;
gix = (GeoIx*)gi;
GeoMkDetail(gix, &gd, c);
i = GeoFind(&gt, &gd);
@ -2026,6 +2038,10 @@ GeoCursor* GeoIndex_NewCursor(GeoIndex* gi, GeoCoordinate* c) {
GeoIx* gix;
GeoCr* gcr;
hpot hp;
if (c->longitude < -180.0) return NULL;
if (c->longitude > 180.0) return NULL;
if (c->latitude < -90.0) return NULL;
if (c->latitude > 90.0) return NULL;
gix = (GeoIx*)gi;
gcr = static_cast<GeoCr*>(
TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(GeoCr), false));

View File

@ -32,7 +32,6 @@
using namespace arangodb;
using namespace arangodb::basics;
using namespace arangodb::rest;
using namespace arangodb::admin;
////////////////////////////////////////////////////////////////////////////////
/// @brief sort ascending

View File

@ -28,7 +28,6 @@
#include "RestHandler/RestBaseHandler.h"
namespace arangodb {
namespace admin {
////////////////////////////////////////////////////////////////////////////////
/// @brief admin log request handler
@ -48,6 +47,5 @@ class RestAdminLogHandler : public RestBaseHandler {
status_t execute() override;
};
}
}
#endif

View File

@ -31,9 +31,9 @@
#include <velocypack/Dumper.h>
#include <velocypack/velocypack-aliases.h>
using namespace arangodb;
using namespace arangodb::basics;
using namespace arangodb::rest;
using namespace arangodb::admin;
RestBaseHandler::RestBaseHandler(HttpRequest* request) : HttpHandler(request) {}

View File

@ -36,7 +36,6 @@ namespace arangodb {
namespace velocypack {
class Slice;
}
namespace admin {
////////////////////////////////////////////////////////////////////////////////
/// @brief default handler for error handling and json in-/output
@ -102,6 +101,5 @@ class RestBaseHandler : public rest::HttpHandler {
virtual void generateOOMError();
};
}
}
#endif

View File

@ -31,7 +31,6 @@ using namespace arangodb;
using namespace arangodb::basics;
using namespace arangodb::rest;
using namespace arangodb::admin;
////////////////////////////////////////////////////////////////////////////////
/// @brief ArangoDB server

View File

@ -32,8 +32,6 @@ class HttpHandler;
class HttpRequest;
}
namespace admin {
////////////////////////////////////////////////////////////////////////////////
/// @brief creator function
////////////////////////////////////////////////////////////////////////////////
@ -67,6 +65,5 @@ class RestHandlerCreator : public H {
}
};
}
}
#endif

View File

@ -32,7 +32,7 @@
#include <velocypack/Builder.h>
#include <velocypack/velocypack-aliases.h>
using namespace arangodb::admin;
using namespace arangodb;
using namespace arangodb::basics;
using namespace arangodb::rest;

View File

@ -34,8 +34,6 @@ class AsyncJobManager;
class Dispatcher;
}
namespace admin {
////////////////////////////////////////////////////////////////////////////////
/// @brief job control request handler
////////////////////////////////////////////////////////////////////////////////
@ -104,6 +102,5 @@ class RestJobHandler : public RestBaseHandler {
rest::AsyncJobManager* _jobManager;
};
}
}
#endif

View File

@ -28,7 +28,7 @@
#include <velocypack/Builder.h>
#include <velocypack/velocypack-aliases.h>
using namespace arangodb::admin;
using namespace arangodb;
using namespace arangodb::rest;
RestShutdownHandler::RestShutdownHandler(arangodb::rest::HttpRequest* request,

View File

@ -30,7 +30,6 @@
#include "RestHandler/RestBaseHandler.h"
namespace arangodb {
namespace admin {
////////////////////////////////////////////////////////////////////////////////
/// @brief shutdown request handler
@ -57,6 +56,5 @@ class RestShutdownHandler : public RestBaseHandler {
arangodb::rest::ApplicationServer* _applicationServer;
};
}
}
#endif

View File

@ -34,7 +34,6 @@ using namespace arangodb;
using namespace arangodb::basics;
using namespace arangodb::rest;
using namespace arangodb::admin;
////////////////////////////////////////////////////////////////////////////////
/// @brief ArangoDB server

View File

@ -32,7 +32,7 @@ namespace arangodb {
/// @brief version request handler
////////////////////////////////////////////////////////////////////////////////
class RestVersionHandler : public arangodb::admin::RestBaseHandler {
class RestVersionHandler : public arangodb::RestBaseHandler {
public:
explicit RestVersionHandler(arangodb::rest::HttpRequest*);

View File

@ -43,7 +43,7 @@ class VocbaseContext;
/// @brief abstract base request handler
////////////////////////////////////////////////////////////////////////////////
class RestVocbaseBaseHandler : public admin::RestBaseHandler {
class RestVocbaseBaseHandler : public RestBaseHandler {
private:
RestVocbaseBaseHandler(RestVocbaseBaseHandler const&) = delete;
RestVocbaseBaseHandler& operator=(RestVocbaseBaseHandler const&) = delete;

View File

@ -36,8 +36,6 @@ WorkMonitorHandler::WorkMonitorHandler(HttpRequest* request)
bool WorkMonitorHandler::isDirect() const { return true; }
#include <iostream>
HttpHandler::status_t WorkMonitorHandler::execute() {
WorkMonitor::requestWorkOverview(_taskId);
return status_t(HANDLER_ASYNC);

View File

@ -31,7 +31,7 @@ namespace arangodb {
/// @brief version request handler
////////////////////////////////////////////////////////////////////////////////
class WorkMonitorHandler : public arangodb::admin::RestBaseHandler {
class WorkMonitorHandler : public arangodb::RestBaseHandler {
public:
explicit WorkMonitorHandler(arangodb::rest::HttpRequest*);

View File

@ -92,7 +92,6 @@
using namespace arangodb;
using namespace arangodb::basics;
using namespace arangodb::rest;
using namespace arangodb::admin;
bool ALLOW_USE_DATABASE_IN_REST_ACTIONS;
@ -216,7 +215,7 @@ void ArangoServer::defineHandlers(HttpHandlerFactory* factory) {
// And now some handlers which are registered in both /_api and /_admin
factory->addPrefixHandler(
"/_api/job",
RestHandlerCreator<arangodb::admin::RestJobHandler>::createData<
RestHandlerCreator<arangodb::RestJobHandler>::createData<
std::pair<Dispatcher*, AsyncJobManager*>*>,
_pairForJobHandler);
@ -227,7 +226,7 @@ void ArangoServer::defineHandlers(HttpHandlerFactory* factory) {
// And now the _admin handlers
factory->addPrefixHandler(
"/_admin/job",
RestHandlerCreator<arangodb::admin::RestJobHandler>::createData<
RestHandlerCreator<arangodb::RestJobHandler>::createData<
std::pair<Dispatcher*, AsyncJobManager*>*>,
_pairForJobHandler);
@ -238,7 +237,7 @@ void ArangoServer::defineHandlers(HttpHandlerFactory* factory) {
// further admin handlers
factory->addHandler(
"/_admin/log",
RestHandlerCreator<arangodb::admin::RestAdminLogHandler>::createNoData,
RestHandlerCreator<arangodb::RestAdminLogHandler>::createNoData,
nullptr);
factory->addHandler("/_admin/work-monitor",
@ -254,7 +253,7 @@ void ArangoServer::defineHandlers(HttpHandlerFactory* factory) {
factory->addPrefixHandler(
"/_admin/shutdown",
RestHandlerCreator<arangodb::admin::RestShutdownHandler>::createData<
RestHandlerCreator<arangodb::RestShutdownHandler>::createData<
void*>,
static_cast<void*>(_applicationServer));
}

View File

@ -1042,7 +1042,7 @@ static v8::Handle<v8::Value> JsonShapeDataArray(v8::Isolate* isolate,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
@ -1050,7 +1050,7 @@ static v8::Handle<v8::Value> JsonShapeDataArray(v8::Isolate* isolate,
char const* name = shaper->lookupAttributeId(aid);
if (name == nullptr) {
LOG(WARN) << "cannot find attribute #" << (unsigned int)aid;
LOG(WARN) << "cannot find attribute #" << aid;
continue;
}
@ -1075,7 +1075,7 @@ static v8::Handle<v8::Value> JsonShapeDataArray(v8::Isolate* isolate,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
@ -1083,7 +1083,7 @@ static v8::Handle<v8::Value> JsonShapeDataArray(v8::Isolate* isolate,
char const* name = shaper->lookupAttributeId(aid);
if (name == nullptr) {
LOG(WARN) << "cannot find attribute #" << (unsigned int)aid;
LOG(WARN) << "cannot find attribute #" << aid;
continue;
}
@ -1152,7 +1152,7 @@ static v8::Handle<v8::Value> JsonShapeDataArray(v8::Isolate* isolate,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
@ -1160,7 +1160,7 @@ static v8::Handle<v8::Value> JsonShapeDataArray(v8::Isolate* isolate,
char const* name = shaper->lookupAttributeId(aid);
if (name == nullptr) {
LOG(WARN) << "cannot find attribute #" << (unsigned int)aid;
LOG(WARN) << "cannot find attribute #" << aid;
continue;
}
@ -1185,7 +1185,7 @@ static v8::Handle<v8::Value> JsonShapeDataArray(v8::Isolate* isolate,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
@ -1193,7 +1193,7 @@ static v8::Handle<v8::Value> JsonShapeDataArray(v8::Isolate* isolate,
char const* name = shaper->lookupAttributeId(aid);
if (name == nullptr) {
LOG(WARN) << "cannot find attribute #" << (unsigned int)aid;
LOG(WARN) << "cannot find attribute #" << aid;
continue;
}
@ -1252,7 +1252,7 @@ static v8::Handle<v8::Value> JsonShapeDataList(v8::Isolate* isolate,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
@ -1294,7 +1294,7 @@ static v8::Handle<v8::Value> JsonShapeDataHomogeneousList(
subshape = shaper->lookupShapeId(sid);
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
return scope.Escape<v8::Value>(v8::Array::New(isolate));
}
@ -1343,7 +1343,7 @@ static v8::Handle<v8::Value> JsonShapeDataHomogeneousSizedList(
subshape = shaper->lookupShapeId(sid);
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
return scope.Escape<v8::Value>(v8::Array::New(isolate));
}

View File

@ -294,7 +294,7 @@ v8::Handle<v8::Value> TRI_WrapShapedJson(
TRI_shape_t const* shape = shaper->lookupShapeId(json._sid);
if (shape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)json._sid;
LOG(WARN) << "cannot find shape #" << json._sid;
return scope.Escape<v8::Value>(v8::Object::New(isolate));
}
@ -390,7 +390,7 @@ static void KeysOfShapedJson(const v8::PropertyCallbackInfo<v8::Array>& args) {
if (shape == nullptr || shape->_type != TRI_SHAPE_ARRAY) {
n = 0;
aids = nullptr;
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
} else {
// shape is an array
TRI_array_shape_t const* s = (TRI_array_shape_t const*)shape;
@ -494,7 +494,7 @@ static void CopyAttributes(v8::Isolate* isolate, v8::Handle<v8::Object> self,
TRI_shape_t const* shape = shaper->lookupShapeId(sid);
if (shape == nullptr || shape->_type != TRI_SHAPE_ARRAY) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
return;
}

View File

@ -1063,14 +1063,14 @@ static int JsonShapeDataArray(VocShaper* shaper, TRI_shape_t const* shape,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
char const* name = shaper->lookupAttributeId(aid);
if (name == nullptr) {
LOG(WARN) << "cannot find attribute #" << (unsigned int)aid;
LOG(WARN) << "cannot find attribute #" << aid;
continue;
}
@ -1118,14 +1118,14 @@ static int JsonShapeDataArray(VocShaper* shaper, TRI_shape_t const* shape,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
char const* name = shaper->lookupAttributeId(aid);
if (name == nullptr) {
LOG(WARN) << "cannot find attribute #" << (unsigned int)aid;
LOG(WARN) << "cannot find attribute #" << aid;
continue;
}
@ -1204,7 +1204,7 @@ static int JsonShapeDataList(VocShaper* shaper, TRI_shape_t const* shape,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
@ -1238,7 +1238,7 @@ static int JsonShapeDataHomogeneousList(VocShaper* shaper,
TRI_shape_t const* subshape = shaper->lookupShapeId(sid);
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
return TRI_ERROR_INTERNAL;
}
@ -1291,7 +1291,7 @@ static int JsonShapeDataHomogeneousSizedList(VocShaper* shaper,
TRI_shape_t const* subshape = shaper->lookupShapeId(sid);
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
return TRI_ERROR_INTERNAL;
}
@ -1596,14 +1596,14 @@ static bool StringifyJsonShapeDataArray(T* shaper, TRI_string_buffer_t* buffer,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
name = shaper->lookupAttributeId(aid);
if (name == nullptr) {
LOG(WARN) << "cannot find attribute #" << (unsigned int)aid;
LOG(WARN) << "cannot find attribute #" << aid;
continue;
}
@ -1639,7 +1639,7 @@ static bool StringifyJsonShapeDataArray(T* shaper, TRI_string_buffer_t* buffer,
offsetsF[1] - offset);
if (!ok) {
LOG(WARN) << "cannot decode element for shape #" << (unsigned int)sid;
LOG(WARN) << "cannot decode element for shape #" << sid;
continue;
}
}
@ -1667,14 +1667,14 @@ static bool StringifyJsonShapeDataArray(T* shaper, TRI_string_buffer_t* buffer,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
name = shaper->lookupAttributeId(aid);
if (name == nullptr) {
LOG(WARN) << "cannot find attribute #" << (unsigned int)aid;
LOG(WARN) << "cannot find attribute #" << aid;
continue;
}
@ -1710,7 +1710,7 @@ static bool StringifyJsonShapeDataArray(T* shaper, TRI_string_buffer_t* buffer,
offsetsV[1] - offset);
if (!ok) {
LOG(WARN) << "cannot decode element for shape #" << (unsigned int)sid;
LOG(WARN) << "cannot decode element for shape #" << sid;
continue;
}
}
@ -1780,7 +1780,7 @@ static bool StringifyJsonShapeDataList(T* shaper, TRI_string_buffer_t* buffer,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
@ -1798,7 +1798,7 @@ static bool StringifyJsonShapeDataList(T* shaper, TRI_string_buffer_t* buffer,
offsets[1] - offset);
if (!ok) {
LOG(WARN) << "cannot decode element for shape #" << (unsigned int)sid;
LOG(WARN) << "cannot decode element for shape #" << sid;
continue;
}
}
@ -1834,7 +1834,7 @@ static bool StringifyJsonShapeDataHomogeneousList(T* shaper,
TRI_shape_t const* subshape = shaper->lookupShapeId(sid);
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
return false;
}
@ -1873,7 +1873,7 @@ static bool StringifyJsonShapeDataHomogeneousList(T* shaper,
offsets[1] - offset);
if (!ok) {
LOG(WARN) << "cannot decode element for shape #" << (unsigned int)sid;
LOG(WARN) << "cannot decode element for shape #" << sid;
continue;
}
}
@ -1909,7 +1909,7 @@ static bool StringifyJsonShapeDataHomogeneousSizedList(
TRI_shape_t const* subshape = shaper->lookupShapeId(sid);
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
return false;
}
@ -1945,7 +1945,7 @@ static bool StringifyJsonShapeDataHomogeneousSizedList(
length);
if (!ok) {
LOG(WARN) << "cannot decode element for shape #" << (unsigned int)sid;
LOG(WARN) << "cannot decode element for shape #" << sid;
continue;
}
}
@ -2101,7 +2101,7 @@ TRI_json_t* TRI_JsonShapedJson(VocShaper* shaper,
TRI_shape_t const* shape = shaper->lookupShapeId(shaped->_sid);
if (shape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)shaped->_sid;
LOG(WARN) << "cannot find shape #" << shaped->_sid;
return nullptr;
}
@ -2408,12 +2408,12 @@ void TRI_IterateShapeDataArray(VocShaper* shaper, TRI_shape_t const* shape,
name = shaper->lookupAttributeId(aid);
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
if (name == nullptr) {
LOG(WARN) << "cannot find attribute #" << (unsigned int)aid;
LOG(WARN) << "cannot find attribute #" << aid;
continue;
}
@ -2447,12 +2447,12 @@ void TRI_IterateShapeDataArray(VocShaper* shaper, TRI_shape_t const* shape,
name = shaper->lookupAttributeId(aid);
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
if (name == nullptr) {
LOG(WARN) << "cannot find attribute #" << (unsigned int)aid;
LOG(WARN) << "cannot find attribute #" << aid;
continue;
}
@ -2504,7 +2504,7 @@ void TRI_IterateShapeDataList(VocShaper* shaper, TRI_shape_t const* shape,
}
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
continue;
}
@ -2520,7 +2520,7 @@ void TRI_IterateShapeDataList(VocShaper* shaper, TRI_shape_t const* shape,
TRI_shape_t const* subshape = shaper->lookupShapeId(sid);
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
return;
}
@ -2545,7 +2545,7 @@ void TRI_IterateShapeDataList(VocShaper* shaper, TRI_shape_t const* shape,
TRI_shape_t const* subshape = shaper->lookupShapeId(sid);
if (subshape == nullptr) {
LOG(WARN) << "cannot find shape #" << (unsigned int)sid;
LOG(WARN) << "cannot find shape #" << sid;
return;
}

View File

@ -411,7 +411,7 @@ void ImportHelper::reportProgress(int64_t totalLength, int64_t totalRead,
static int64_t nextProcessed = 10 * 1000 * 1000;
if (totalRead >= nextProcessed) {
LOG(INFO) << "processed " << (long long)totalRead << " bytes of input file";
LOG(INFO) << "processed " << totalRead << " bytes of input file";
nextProcessed += 10 * 1000 * 1000;
}
} else {

View File

@ -57,11 +57,12 @@ LogTopic LogTopic::operator|(LogTopic const& that) {
return result;
}
LogTopic Logger::COLLECTOR("collector", LogLevel::INFO);
LogTopic Logger::COMPACTOR("compactor", LogLevel::INFO);
LogTopic Logger::PERFORMANCE("performance", LogLevel::INFO);
LogTopic Logger::QUERIES("queries", LogLevel::INFO);
LogTopic Logger::REQUESTS("requests", LogLevel::INFO);
LogTopic Logger::COLLECTOR("collector");
LogTopic Logger::COMPACTOR("compactor");
LogTopic Logger::MMAP("mmap");
LogTopic Logger::PERFORMANCE("performance");
LogTopic Logger::QUERIES("queries");
LogTopic Logger::REQUESTS("requests");
void Logger::setLevel(LogLevel level) {
_level = level;
@ -89,6 +90,15 @@ std::ostream& operator<<(std::ostream& stream, LogLevel level) {
return stream;
}
LoggerStream& LoggerStream::operator<<(Logger::RANGE range) {
std::ostringstream tmp;
tmp << range.baseAddress << " - "
<< static_cast<void const*>(static_cast<char const*>(range.baseAddress) + range.size)
<< " (" << range.size << " bytes)";
_out << tmp.str();
return *this;
}
LoggerStream& LoggerStream::operator<<(Logger::DURATION duration) {
std::ostringstream tmp;
tmp << std::setprecision(duration._precision) << std::fixed << duration._duration;

View File

@ -157,6 +157,7 @@ class Logger {
static LogTopic COLLECTOR;
static LogTopic COMPACTOR;
static LogTopic MMAP;
static LogTopic PERFORMANCE;
static LogTopic QUERIES;
static LogTopic REQUESTS;
@ -172,6 +173,16 @@ class Logger {
int _precision;
};
//////////////////////////////////////////////////////////////////////////////
/// @brief range
//////////////////////////////////////////////////////////////////////////////
struct RANGE {
RANGE(void const* baseAddress, size_t size) : baseAddress(baseAddress), size(size){};
void const* baseAddress;
size_t size;
};
//////////////////////////////////////////////////////////////////////////////
/// @brief line number helper class
//////////////////////////////////////////////////////////////////////////////
@ -277,6 +288,8 @@ class LoggerStream {
return *this;
}
LoggerStream& operator<<(Logger::RANGE range);
LoggerStream& operator<<(Logger::DURATION duration);
LoggerStream& operator<<(Logger::LINE line) {

View File

@ -30,6 +30,8 @@
#include <sys/mman.h>
using namespace arangodb;
////////////////////////////////////////////////////////////////////////////////
// @brief flush memory mapped file to disk
////////////////////////////////////////////////////////////////////////////////
@ -86,10 +88,14 @@ int TRI_MMFile(void* memoryAddress, size_t numOfBytesToInitialize,
fileDescriptor, offsetRetyped);
if (*result != MAP_FAILED) {
LOG_TOPIC(DEBUG, Logger::MMAP) << "memory-mapped range " << Logger::RANGE(*result, numOfBytesToInitialize) << ", file-descriptor " << fileDescriptor;
return TRI_ERROR_NO_ERROR;
}
if (errno == ENOMEM) {
LOG_TOPIC(DEBUG, Logger::MMAP) << "out of memory in mmap";
return TRI_ERROR_OUT_OF_MEMORY_MMAP;
}
@ -107,9 +113,13 @@ int TRI_UNMMFile(void* memoryAddress, size_t numOfBytesToUnMap,
int res = munmap(memoryAddress, numOfBytesToUnMap);
if (res == 0) {
LOG_TOPIC(DEBUG, Logger::MMAP) << "memory-unmapped range " << Logger::RANGE(memoryAddress, numOfBytesToUnMap) << ", file-descriptor " << fileDescriptor;
return TRI_ERROR_NO_ERROR;
}
// error
if (errno == ENOSPC) {
return TRI_ERROR_ARANGO_FILESYSTEM_FULL;
}
@ -143,17 +153,18 @@ int TRI_ProtectMMFile(void* memoryAddress, size_t numOfBytesToProtect,
int TRI_MMFileAdvise(void* memoryAddress, size_t numOfBytes, int advice) {
#ifdef __linux__
LOG(DEBUG) << "Doing madvise " << advice << " for " << memoryAddress << " length " << numOfBytes;
LOG(TRACE) << "madvise " << advice << " for range " << Logger::RANGE(memoryAddress, numOfBytes);
int res = madvise(memoryAddress, numOfBytes, advice);
if (res == 0) {
return TRI_ERROR_NO_ERROR;
} else {
char buffer[256];
char* p = strerror_r(errno, buffer, 256);
LOG(INFO) << "madvise " << advice << " for " << memoryAddress << " length " << numOfBytes << " failed with: " << p << " ";
return TRI_ERROR_INTERNAL;
}
}
char buffer[256];
char* p = strerror_r(errno, buffer, 256);
LOG(ERR) << "madvise " << advice << " for range " << Logger::RANGE(memoryAddress, numOfBytes) << " failed with: " << p << " ";
return TRI_ERROR_INTERNAL;
#else
return TRI_ERROR_NO_ERROR;
#endif

View File

@ -29,6 +29,8 @@
#include "Basics/Logger.h"
#include "Basics/tri-strings.h"
using namespace arangodb;
////////////////////////////////////////////////////////////////////////////////
/// @brief flushes changes made in memory back to disk
////////////////////////////////////////////////////////////////////////////////
@ -52,9 +54,6 @@ int TRI_FlushMMFile(int fileDescriptor, void* startingAddress,
// now - this may change.
// ...........................................................................
HANDLE fileHandle;
BOOL result;
if (fileDescriptor <
0) { // an invalid file descriptor of course means an invalid handle
return TRI_ERROR_NO_ERROR;
@ -64,7 +63,7 @@ int TRI_FlushMMFile(int fileDescriptor, void* startingAddress,
// Attempt to convert file descriptor into an operating system file handle
// ...........................................................................
fileHandle = (HANDLE)_get_osfhandle(fileDescriptor);
HANDLE fileHandle = (HANDLE)_get_osfhandle(fileDescriptor);
// ...........................................................................
// An invalid file system handle was returned.
@ -74,7 +73,8 @@ int TRI_FlushMMFile(int fileDescriptor, void* startingAddress,
return TRI_ERROR_SYS_ERROR;
}
result = FlushViewOfFile(startingAddress, numOfBytesToFlush);
BOOL result = FlushViewOfFile(startingAddress, numOfBytesToFlush);
if (result && ((flags & MS_SYNC) == MS_SYNC)) {
result = FlushFileBuffers(fileHandle);
}
@ -228,7 +228,7 @@ int TRI_MMFile(void* memoryAddress, size_t numOfBytesToInitialize,
// The map view of file has failed.
// ........................................................................
if (*result == NULL) {
if (*result == nullptr) {
DWORD errorCode = GetLastError();
CloseHandle(*mmHandle);
// we have failure for some reason
@ -241,6 +241,8 @@ int TRI_MMFile(void* memoryAddress, size_t numOfBytesToInitialize,
LOG(DEBUG) << "MapViewOfFile failed with error code = " << errorCode;
return TRI_ERROR_SYS_ERROR;
}
LOG_TOPIC(DEBUG, Logger::MMAP) << "memory-mapped range " << Logger::RANGE(*result, numOfBytesToInitialize) << ", file-descriptor " << fileDescriptor;
return TRI_ERROR_NO_ERROR;
}
@ -253,10 +255,15 @@ int TRI_UNMMFile(void* memoryAddress, size_t numOfBytesToUnMap,
int fileDescriptor, void** mmHandle) {
// UnmapViewOfFile: If the function succeeds, the return value is nonzero.
bool ok = (UnmapViewOfFile(memoryAddress) != 0);
ok = (CloseHandle(*mmHandle) && ok);
if (!ok) {
return TRI_ERROR_SYS_ERROR;
}
LOG_TOPIC(DEBUG, Logger::MMAP) << "memory-unmapped range " << Logger::RANGE(memoryAddress, numOfBytesToUnMap) << ", file-descriptor " << fileDescriptor;
return TRI_ERROR_NO_ERROR;
}

View File

@ -1044,12 +1044,12 @@ TRI_external_status_t TRI_CheckExternalProcess(TRI_external_id_t pid,
if (result == WAIT_FAILED) {
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
windowsErrorBuf, sizeof(windowsErrorBuf), NULL);
LOG(WARN) << "could not wait for subprocess with PID '" << (unsigned int)external->_pid << "': " << windowsErrorBuf;
LOG(WARN) << "could not wait for subprocess with pid " << external->_pid << ": " << windowsErrorBuf;
status._errorMessage =
std::string("could not wait for subprocess with PID '") +
std::string("could not wait for subprocess with pid ") +
arangodb::basics::StringUtils::itoa(
static_cast<int64_t>(external->_pid)) +
std::string("'") + windowsErrorBuf;
windowsErrorBuf;
status._exitStatus = GetLastError();
}
} else {
@ -1058,7 +1058,7 @@ TRI_external_status_t TRI_CheckExternalProcess(TRI_external_id_t pid,
switch (result) {
case WAIT_ABANDONED:
wantGetExitCode = true;
LOG(WARN) << "WAIT_ABANDONED while waiting for subprocess with PID '" << (unsigned int)external->_pid << "'";
LOG(WARN) << "WAIT_ABANDONED while waiting for subprocess with pid " << external->_pid;
break;
case WAIT_OBJECT_0:
/// this seems to be the exit case - want getExitCodeProcess here.
@ -1071,7 +1071,7 @@ TRI_external_status_t TRI_CheckExternalProcess(TRI_external_id_t pid,
case WAIT_FAILED:
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
windowsErrorBuf, sizeof(windowsErrorBuf), NULL);
LOG(WARN) << "could not wait for subprocess with PID '" << (unsigned int)external->_pid << "': " << windowsErrorBuf;
LOG(WARN) << "could not wait for subprocess with pid " << external->_pid << ": " << windowsErrorBuf;
status._errorMessage =
std::string("could not wait for subprocess with PID '") +
arangodb::basics::StringUtils::itoa(
@ -1080,18 +1080,17 @@ TRI_external_status_t TRI_CheckExternalProcess(TRI_external_id_t pid,
status._exitStatus = GetLastError();
default:
wantGetExitCode = true;
LOG(WARN) << "unexpected status while waiting for subprocess with PID '" << (unsigned int)external->_pid << "'";
LOG(WARN) << "unexpected status while waiting for subprocess with pid " << external->_pid;
}
}
if (wantGetExitCode) {
DWORD exitCode = STILL_ACTIVE;
if (!GetExitCodeProcess(external->_process, &exitCode)) {
LOG(WARN) << "exit status could not be determined for PID '" << (unsigned int)external->_pid << "'";
LOG(WARN) << "exit status could not be determined for pid " << external->_pid;
status._errorMessage =
std::string("exit status could not be determined for PID '") +
std::string("exit status could not be determined for pid ") +
arangodb::basics::StringUtils::itoa(
static_cast<int64_t>(external->_pid)) +
std::string("'");
static_cast<int64_t>(external->_pid));
} else {
if (exitCode == STILL_ACTIVE) {
external->_exitStatus = 0;