1
0
Fork 0

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

This commit is contained in:
Kaveh Vahedipour 2016-02-08 17:10:37 +00:00
commit 8e07620109
6 changed files with 70 additions and 56 deletions

View File

@ -67,12 +67,14 @@ static std::string StateNames[] = {
"instantiating plan", // PLAN_INSTANTIATION
"optimizing plan", // PLAN_OPTIMIZATION
"executing", // EXECUTION
"finalizing" // FINALIZATION
"finalizing", // FINALIZATION
"invalid" // INVALID
};
// make sure the state strings and the actual states match
static_assert(sizeof(StateNames) / sizeof(std::string) ==
static_cast<size_t>(ExecutionState::INVALID_STATE),
static_cast<size_t>(ExecutionState::INVALID_STATE) + 1,
"invalid number of ExecutionState values");
////////////////////////////////////////////////////////////////////////////////

View File

@ -201,7 +201,6 @@ void RestCursorHandler::processQuery(VPackSlice const& slice) {
}
arangodb::JsonCursor* cursor = cursors->createFromVelocyPack(
builder, batchSize, extra, ttl, count, queryResult.cached);
queryResult.json = nullptr;
try {
_response->body().appendChar('{');

View File

@ -1469,7 +1469,7 @@ void TRI_replication_applier_t::toVelocyPack(VPackBuilder& builder) const {
// add server info
builder.add("server", VPackValue(VPackValueType::Object));
builder.add("version", VPackValue(TRI_VERSION));
builder.add("serverId", VPackValue(TRI_StringUInt64(TRI_GetIdServer())));
builder.add("serverId", VPackValue(std::to_string(TRI_GetIdServer())));
builder.close(); // server
if (config._endpoint != nullptr) {

View File

@ -329,6 +329,10 @@ function readImportantLogLines(logPath) {
/// # and know the PID plus the process name for later use.
/// kernel.core_uses_pid = 1
/// kernel.core_pattern = /var/tmp/core-%e-%p-%t
///
/// If you set coreDirectory to empty, this behavior is changed: The core file
/// expected to be named simply "core" and should exist in the current
/// directory.
////////////////////////////////////////////////////////////////////////////////
function analyzeCoreDump(instanceInfo, options, storeArangodPath, pid) {
@ -340,7 +344,12 @@ function analyzeCoreDump(instanceInfo, options, storeArangodPath, pid) {
command += "echo quit;";
command += "sleep 2";
command += ") | gdb " + storeArangodPath + " ";
command += options.coreDirectory + "/*core*" + pid + '*';
if (options.coreDirectory === "") {
command += "core";
} else {
command += options.coreDirectory + "/*core*" + pid + '*';
}
const args = ['-c', command];
print(JSON.stringify(args));
@ -408,9 +417,12 @@ function checkInstanceAliveSingleServer(instanceInfo, options) {
print("Core dump written; copying arangod to " +
instanceInfo.tmpDataDir + " for later analysis.");
let corePath = (options.coreDirectory === "") ?
"core" :
options.coreDirectory + "/core*" + instanceInfo.pid.pid + "*'";
res.gdbHint = "Run debugger with 'gdb " +
storeArangodPath + " " + options.coreDirectory +
"/core*" + instanceInfo.pid.pid + "*'";
storeArangodPath + " " + corePath;
if (require("internal").platform.substr(0, 3) === 'win') {
// Windows: wait for procdump to do its job...

View File

@ -46,17 +46,36 @@ Exception::Exception(int code, char const* file, int line)
_file(file),
_line(line),
_code(code) {
#ifdef TRI_ENABLE_MAINTAINER_MODE
#if HAVE_BACKTRACE
if (WithBackTrace) {
_errorMessage += std::string("\n\n");
TRI_GetBacktrace(_errorMessage);
_errorMessage += std::string("\n\n");
}
#endif
#endif
appendLocation();
}
////////////////////////////////////////////////////////////////////////////////
/// @brief constructor, for creating an exception with an already created
/// error message (normally based on error templates containing %s, %d etc.)
////////////////////////////////////////////////////////////////////////////////
Exception::Exception(int code, std::string const& errorMessage,
char const* file, int line)
: _errorMessage(errorMessage), _file(file), _line(line), _code(code) {
appendLocation();
}
////////////////////////////////////////////////////////////////////////////////
/// @brief constructor, for creating an exception with an already created
/// error message (normally based on error templates containing %s, %d etc.)
////////////////////////////////////////////////////////////////////////////////
Exception::Exception(int code, char const* errorMessage, char const* file,
int line)
: _errorMessage(errorMessage), _file(file), _line(line), _code(code) {
appendLocation();
}
Exception::~Exception() throw() {}
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the error message
////////////////////////////////////////////////////////////////////////////////
@ -75,52 +94,32 @@ int Exception::code() const throw() { return _code; }
void Exception::addToMessage(std::string const& more) { _errorMessage += more; }
////////////////////////////////////////////////////////////////////////////////
/// @brief constructor, for creating an exception with an already created
/// error message (normally based on error templates containing %s, %d etc.)
////////////////////////////////////////////////////////////////////////////////
Exception::Exception(int code, std::string const& errorMessage,
char const* file, int line)
: _errorMessage(errorMessage), _file(file), _line(line), _code(code) {
#ifdef TRI_ENABLE_MAINTAINER_MODE
#if HAVE_BACKTRACE
if (WithBackTrace) {
_errorMessage += std::string("\n\n");
TRI_GetBacktrace(_errorMessage);
_errorMessage += std::string("\n\n");
}
#endif
#endif
}
////////////////////////////////////////////////////////////////////////////////
/// @brief constructor, for creating an exception with an already created
/// error message (normally based on error templates containing %s, %d etc.)
////////////////////////////////////////////////////////////////////////////////
Exception::Exception(int code, char const* errorMessage, char const* file,
int line)
: _errorMessage(errorMessage), _file(file), _line(line), _code(code) {
#ifdef TRI_ENABLE_MAINTAINER_MODE
#if HAVE_BACKTRACE
if (WithBackTrace) {
_errorMessage += std::string("\n\n");
TRI_GetBacktrace(_errorMessage);
_errorMessage += std::string("\n\n");
}
#endif
#endif
}
Exception::~Exception() throw() {}
////////////////////////////////////////////////////////////////////////////////
/// @brief return exception message
////////////////////////////////////////////////////////////////////////////////
char const* Exception::what() const throw() { return _errorMessage.c_str(); }
////////////////////////////////////////////////////////////////////////////////
/// @brief append original error location to message
////////////////////////////////////////////////////////////////////////////////
void Exception::appendLocation () {
if (_code == TRI_ERROR_INTERNAL) {
_errorMessage += std::string(" (location: ") + _file + ":" + std::to_string(_line) + "). Please report this error to arangodb.com";
}
#ifdef TRI_ENABLE_MAINTAINER_MODE
#if HAVE_BACKTRACE
if (WithBackTrace) {
_errorMessage += std::string("\n\n");
TRI_GetBacktrace(_errorMessage);
_errorMessage += std::string("\n\n");
}
#endif
#endif
}
////////////////////////////////////////////////////////////////////////////////
/// @brief construct an error message from a template string
////////////////////////////////////////////////////////////////////////////////

View File

@ -100,6 +100,8 @@ class Exception : public virtual std::exception {
std::string message() const throw();
int code() const throw();
void addToMessage(std::string const&);
private:
void appendLocation ();
protected:
std::string _errorMessage;