mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
4ac74301d5
|
@ -467,8 +467,9 @@ AqlValue Expression::executeSimpleExpression(
|
|||
case NODE_TYPE_OPERATOR_UNARY_MINUS:
|
||||
return executeSimpleExpressionMinus(node, trx, mustDestroy);
|
||||
case NODE_TYPE_OPERATOR_BINARY_AND:
|
||||
return executeSimpleExpressionAnd(node, trx, mustDestroy);
|
||||
case NODE_TYPE_OPERATOR_BINARY_OR:
|
||||
return executeSimpleExpressionAndOr(node, trx, mustDestroy);
|
||||
return executeSimpleExpressionOr(node, trx, mustDestroy);
|
||||
case NODE_TYPE_OPERATOR_BINARY_EQ:
|
||||
case NODE_TYPE_OPERATOR_BINARY_NE:
|
||||
case NODE_TYPE_OPERATOR_BINARY_LT:
|
||||
|
@ -996,34 +997,38 @@ AqlValue Expression::executeSimpleExpressionMinus(AstNode const* node,
|
|||
return AqlValue(-value);
|
||||
}
|
||||
|
||||
/// @brief execute an expression of type SIMPLE with AND or OR
|
||||
AqlValue Expression::executeSimpleExpressionAndOr(
|
||||
/// @brief execute an expression of type SIMPLE with AND
|
||||
AqlValue Expression::executeSimpleExpressionAnd(
|
||||
AstNode const* node, arangodb::Transaction* trx, bool& mustDestroy) {
|
||||
|
||||
AqlValue left =
|
||||
executeSimpleExpression(node->getMember(0), trx, mustDestroy, true);
|
||||
executeSimpleExpression(node->getMemberUnchecked(0), trx, mustDestroy, true);
|
||||
|
||||
if (node->type == NODE_TYPE_OPERATOR_BINARY_AND) {
|
||||
// AND
|
||||
if (left.toBoolean()) {
|
||||
// left is true => return right
|
||||
if (mustDestroy) { left.destroy(); }
|
||||
return executeSimpleExpression(node->getMember(1), trx, mustDestroy, true);
|
||||
}
|
||||
if (left.toBoolean()) {
|
||||
// left is true => return right
|
||||
if (mustDestroy) { left.destroy(); }
|
||||
return executeSimpleExpression(node->getMemberUnchecked(1), trx, mustDestroy, true);
|
||||
}
|
||||
|
||||
// left is false, return left
|
||||
return left;
|
||||
}
|
||||
|
||||
/// @brief execute an expression of type SIMPLE with OR
|
||||
AqlValue Expression::executeSimpleExpressionOr(
|
||||
AstNode const* node, arangodb::Transaction* trx, bool& mustDestroy) {
|
||||
|
||||
AqlValue left =
|
||||
executeSimpleExpression(node->getMemberUnchecked(0), trx, mustDestroy, true);
|
||||
|
||||
// left is false, return left
|
||||
return left;
|
||||
}
|
||||
|
||||
// OR
|
||||
if (left.toBoolean()) {
|
||||
// left is true => return left
|
||||
return left;
|
||||
}
|
||||
|
||||
// left is false => return right
|
||||
left.destroy();
|
||||
return executeSimpleExpression(node->getMember(1), trx, mustDestroy, true);
|
||||
if (mustDestroy) { left.destroy(); }
|
||||
return executeSimpleExpression(node->getMemberUnchecked(1), trx, mustDestroy, true);
|
||||
}
|
||||
|
||||
/// @brief execute an expression of type SIMPLE with AND or OR
|
||||
|
@ -1076,11 +1081,11 @@ AqlValue Expression::executeSimpleExpressionComparison(
|
|||
AstNode const* node, arangodb::Transaction* trx, bool& mustDestroy) {
|
||||
|
||||
AqlValue left =
|
||||
executeSimpleExpression(node->getMember(0), trx, mustDestroy, false);
|
||||
executeSimpleExpression(node->getMemberUnchecked(0), trx, mustDestroy, false);
|
||||
AqlValueGuard guardLeft(left, mustDestroy);
|
||||
|
||||
AqlValue right =
|
||||
executeSimpleExpression(node->getMember(1), trx, mustDestroy, false);
|
||||
executeSimpleExpression(node->getMemberUnchecked(1), trx, mustDestroy, false);
|
||||
AqlValueGuard guardRight(right, mustDestroy);
|
||||
|
||||
mustDestroy = false; // we're returning a boolean only
|
||||
|
@ -1486,10 +1491,10 @@ AqlValue Expression::executeSimpleExpressionIterator(
|
|||
AqlValue Expression::executeSimpleExpressionArithmetic(
|
||||
AstNode const* node, arangodb::Transaction* trx, bool& mustDestroy) {
|
||||
|
||||
AqlValue lhs = executeSimpleExpression(node->getMember(0), trx, mustDestroy, true);
|
||||
AqlValue lhs = executeSimpleExpression(node->getMemberUnchecked(0), trx, mustDestroy, true);
|
||||
AqlValueGuard guardLhs(lhs, mustDestroy);
|
||||
|
||||
AqlValue rhs = executeSimpleExpression(node->getMember(1), trx, mustDestroy, true);
|
||||
AqlValue rhs = executeSimpleExpression(node->getMemberUnchecked(1), trx, mustDestroy, true);
|
||||
AqlValueGuard guardRhs(rhs, mustDestroy);
|
||||
|
||||
mustDestroy = false;
|
||||
|
@ -1523,6 +1528,7 @@ AqlValue Expression::executeSimpleExpressionArithmetic(
|
|||
}
|
||||
}
|
||||
|
||||
mustDestroy = false;
|
||||
double result;
|
||||
|
||||
switch (node->type) {
|
||||
|
@ -1542,18 +1548,9 @@ AqlValue Expression::executeSimpleExpressionArithmetic(
|
|||
result = fmod(l, r);
|
||||
break;
|
||||
default:
|
||||
mustDestroy = false;
|
||||
return AqlValue(VelocyPackHelper::ZeroValue());
|
||||
}
|
||||
|
||||
if (std::isnan(result) || !std::isfinite(result) || result == HUGE_VAL || result == -HUGE_VAL) {
|
||||
// convert NaN, +inf & -inf to null
|
||||
mustDestroy = false;
|
||||
return AqlValue(VelocyPackHelper::NullValue());
|
||||
}
|
||||
|
||||
TransactionBuilderLeaser builder(trx);
|
||||
mustDestroy = true; // builder = dynamic data
|
||||
builder->add(VPackValue(result));
|
||||
return AqlValue(*builder.get());
|
||||
|
||||
// this will convert NaN, +inf & -inf to null
|
||||
return AqlValue(result);
|
||||
}
|
||||
|
|
|
@ -280,10 +280,15 @@ class Expression {
|
|||
AqlValue executeSimpleExpressionMinus(AstNode const*, arangodb::Transaction*,
|
||||
bool& mustDestroy);
|
||||
|
||||
/// @brief execute an expression of type SIMPLE with AND or OR
|
||||
AqlValue executeSimpleExpressionAndOr(AstNode const*,
|
||||
arangodb::Transaction*,
|
||||
bool& mustDestroy);
|
||||
/// @brief execute an expression of type SIMPLE with AND
|
||||
AqlValue executeSimpleExpressionAnd(AstNode const*,
|
||||
arangodb::Transaction*,
|
||||
bool& mustDestroy);
|
||||
|
||||
/// @brief execute an expression of type SIMPLE with OR
|
||||
AqlValue executeSimpleExpressionOr(AstNode const*,
|
||||
arangodb::Transaction*,
|
||||
bool& mustDestroy);
|
||||
|
||||
/// @brief execute an expression of type SIMPLE with NARY AND or OR
|
||||
AqlValue executeSimpleExpressionNaryAndOr(AstNode const*,
|
||||
|
|
|
@ -1195,6 +1195,25 @@ static void JS_CoordinatorConfigServerState(
|
|||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SYNC_REPLICATION
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set arangoserver state to initialized
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void JS_SetInitializedServerState(
|
||||
v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
if (args.Length() != 0) {
|
||||
TRI_V8_THROW_EXCEPTION_USAGE("setInitialized()");
|
||||
}
|
||||
|
||||
ServerState::instance()->setInitialized();
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return whether the cluster is initialized
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2096,6 +2115,10 @@ void TRI_InitV8Cluster(v8::Isolate* isolate, v8::Handle<v8::Context> context) {
|
|||
JS_DBserverConfigServerState);
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("coordinatorConfig"),
|
||||
JS_CoordinatorConfigServerState);
|
||||
#ifdef DEBUG_SYNC_REPLICATION
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("setInitialized"),
|
||||
JS_SetInitializedServerState);
|
||||
#endif
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("initialized"),
|
||||
JS_InitializedServerState);
|
||||
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("isCoordinator"),
|
||||
|
|
|
@ -745,6 +745,22 @@ void MMFilesEngine::dropCollection(TRI_vocbase_t* vocbase, arangodb::LogicalColl
|
|||
<< ", source exists: " << TRI_IsDirectory(collection->path().c_str())
|
||||
<< ", dest exists: " << TRI_IsDirectory(newFilename.c_str())
|
||||
<< ", status: " << collection->statusString();
|
||||
|
||||
std::vector<std::string> files = TRI_FilesDirectory(collection->path().c_str());
|
||||
LOG(ERR) << "ALL FILES: " << files;
|
||||
for (auto const& f : files) {
|
||||
bool isDir = TRI_IsDirectory(f.c_str());
|
||||
std::string full = basics::FileUtils::buildFilename(collection->path(), f);
|
||||
LOG(ERR) << "- found: " << f << ", IS DIR: " << isDir;
|
||||
if (isDir) {
|
||||
LOG(ERR) << "- removing dir: " << TRI_RemoveDirectory(full.c_str());
|
||||
} else {
|
||||
LOG(ERR) << "- file: " << full << ", size: " << TRI_SizeFile(full.c_str());
|
||||
LOG(ERR) << "- removing file: " << TRI_UnlinkFile(full.c_str());
|
||||
}
|
||||
}
|
||||
LOG(ERR) << "ALL FILES AGAIN: " << TRI_FilesDirectory(collection->path().c_str());
|
||||
|
||||
} else {
|
||||
LOG(DEBUG) << "wiping dropped collection '" << name
|
||||
<< "' from disk";
|
||||
|
|
|
@ -1727,7 +1727,7 @@ TRI_datafile_t* TRI_datafile_t::open(std::string const& filename, bool ignoreFai
|
|||
// change to read-write if no footer has been found
|
||||
if (!datafile->_isSealed) {
|
||||
if (!datafile->readWrite()) {
|
||||
LOG(ERR) << "unable to change file protection for datafile '" << datafile->getName() << "'. please check file permissions and mount options.";
|
||||
LOG(ERR) << "unable to change memory protection for memory backed by datafile '" << datafile->getName() << "'. please check file permissions and mount options.";
|
||||
return nullptr;
|
||||
}
|
||||
datafile->_state = TRI_DF_STATE_WRITE;
|
||||
|
@ -1743,9 +1743,6 @@ TRI_datafile_t* TRI_datafile_t::open(std::string const& filename, bool ignoreFai
|
|||
/// @brief opens a datafile
|
||||
TRI_datafile_t* TRI_datafile_t::openHelper(std::string const& filename, bool ignoreErrors) {
|
||||
TRI_ERRORBUF;
|
||||
void* data;
|
||||
TRI_stat_t status;
|
||||
void* mmHandle;
|
||||
|
||||
// this function must not be called for non-physical datafiles
|
||||
TRI_ASSERT(!filename.empty());
|
||||
|
@ -1764,6 +1761,7 @@ TRI_datafile_t* TRI_datafile_t::openHelper(std::string const& filename, bool ign
|
|||
}
|
||||
|
||||
// compute the size of the file
|
||||
TRI_stat_t status;
|
||||
int res = TRI_FSTAT(fd, &status);
|
||||
|
||||
if (res < 0) {
|
||||
|
@ -1783,7 +1781,7 @@ TRI_datafile_t* TRI_datafile_t::openHelper(std::string const& filename, bool ign
|
|||
TRI_set_errno(TRI_ERROR_ARANGO_CORRUPTED_DATAFILE);
|
||||
TRI_CLOSE(fd);
|
||||
|
||||
LOG(ERR) << "datafile '" << filename << "' is corrupt, size is only " << (unsigned int)size;
|
||||
LOG(ERR) << "datafile '" << filename << "' is corrupt, size is only " << size;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1854,6 +1852,8 @@ TRI_datafile_t* TRI_datafile_t::openHelper(std::string const& filename, bool ign
|
|||
}
|
||||
|
||||
// map datafile into memory
|
||||
void* data;
|
||||
void* mmHandle;
|
||||
res = TRI_MMFile(0, size, PROT_READ, MAP_SHARED, fd, &mmHandle, 0, &data);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
@ -1862,8 +1862,7 @@ TRI_datafile_t* TRI_datafile_t::openHelper(std::string const& filename, bool ign
|
|||
|
||||
LOG(ERR) << "cannot memory map datafile '" << filename << "': " << TRI_errno_string(res);
|
||||
LOG(ERR) << "The database directory might reside on a shared folder "
|
||||
"(VirtualBox, VMWare) or an NFS "
|
||||
"mounted volume which does not allow memory mapped files.";
|
||||
"(VirtualBox, VMWare) or an NFS-mounted volume which does not allow memory mapped files.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -505,7 +505,7 @@ int TRI_vocbase_t::dropCollectionWorker(arangodb::LogicalCollection* collection,
|
|||
collection->setDeleted(false);
|
||||
events::DropCollection(colName, ex.code());
|
||||
return ex.code();
|
||||
} catch (std::exception const& ex) {
|
||||
} catch (std::exception const&) {
|
||||
collection->setDeleted(false);
|
||||
events::DropCollection(colName, TRI_ERROR_INTERNAL);
|
||||
return TRI_ERROR_INTERNAL;
|
||||
|
|
|
@ -17,8 +17,12 @@ if (MSVC)
|
|||
endif()
|
||||
|
||||
# debug info directory:
|
||||
set(CMAKE_INSTALL_DEBINFO_DIR "${CMAKE_INSTALL_LIBDIR}/debug/${CMAKE_PROJECT_NAME}")
|
||||
|
||||
if (${CMAKE_INSTALL_LIBDIR} STREQUAL "usr/lib64")
|
||||
# some systems have weird places for usr/lib:
|
||||
set(CMAKE_INSTALL_DEBINFO_DIR "usr/lib/debug/${CMAKE_PROJECT_NAME}")
|
||||
else ()
|
||||
set(CMAKE_INSTALL_DEBINFO_DIR "${CMAKE_INSTALL_LIBDIR}/debug/${CMAKE_PROJECT_NAME}")
|
||||
endif ()
|
||||
|
||||
set(CMAKE_INSTALL_SYSCONFDIR_ARANGO "${CMAKE_INSTALL_SYSCONFDIR}/${CMAKE_PROJECT_NAME}")
|
||||
set(CMAKE_INSTALL_FULL_SYSCONFDIR_ARANGO "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${CMAKE_PROJECT_NAME}")
|
||||
|
@ -35,7 +39,6 @@ FILE(MAKE_DIRECTORY "${ARANGODB_APPS_DIRECTORY}")
|
|||
FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/log/${CMAKE_PROJECT_NAME}")
|
||||
|
||||
set(INSTALL_ICU_DT_DEST "${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_PROJECT_NAME}")
|
||||
|
||||
include(InstallMacros)
|
||||
# install ----------------------------------------------------------------------
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/Documentation/man/
|
||||
|
|
Loading…
Reference in New Issue