mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
06d0b19a70
|
@ -65,6 +65,8 @@ void AgencyCallback::refetchAndUpdate(bool needToAcquireMutex) {
|
||||||
AgencyCommResult result = _agency.getValues(key);
|
AgencyCommResult result = _agency.getValues(key);
|
||||||
|
|
||||||
if (!result.successful()) {
|
if (!result.successful()) {
|
||||||
|
LOG(ERR) << "Callback getValues to agency was not successful: "
|
||||||
|
<< result.errorCode() << " " << result.errorMessage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,18 +126,11 @@ bool AgencyCallback::execute(std::shared_ptr<VPackBuilder> newData) {
|
||||||
void AgencyCallback::executeByCallbackOrTimeout(double maxTimeout) {
|
void AgencyCallback::executeByCallbackOrTimeout(double maxTimeout) {
|
||||||
// One needs to acquire the mutex of the condition variable
|
// One needs to acquire the mutex of the condition variable
|
||||||
// before entering this function!
|
// before entering this function!
|
||||||
auto compareBuilder = std::make_shared<VPackBuilder>();
|
|
||||||
if (_lastData) {
|
|
||||||
compareBuilder = _lastData;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_cv.wait(static_cast<uint64_t>(maxTimeout * 1000000.0))) {
|
if (!_cv.wait(static_cast<uint64_t>(maxTimeout * 1000000.0))) {
|
||||||
if (!_lastData || !_lastData->slice().equals(compareBuilder->slice())) {
|
|
||||||
LOG_TOPIC(DEBUG, Logger::CLUSTER)
|
LOG_TOPIC(DEBUG, Logger::CLUSTER)
|
||||||
<< "Waiting done and nothing happended. Refetching to be sure";
|
<< "Waiting done and nothing happended. Refetching to be sure";
|
||||||
// mop: watches have not triggered during our sleep...recheck to be sure
|
// mop: watches have not triggered during our sleep...recheck to be sure
|
||||||
refetchAndUpdate(false);
|
refetchAndUpdate(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -839,7 +839,6 @@ int ClusterInfo::createDatabaseCoordinator(std::string const& name,
|
||||||
*dbServerResult = TRI_ERROR_CLUSTER_COULD_NOT_CREATE_DATABASE;
|
*dbServerResult = TRI_ERROR_CLUSTER_COULD_NOT_CREATE_DATABASE;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
loadCurrent(); // update our cache
|
|
||||||
*dbServerResult = setErrormsg(TRI_ERROR_NO_ERROR, *errMsg);
|
*dbServerResult = setErrormsg(TRI_ERROR_NO_ERROR, *errMsg);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -897,6 +896,7 @@ int ClusterInfo::createDatabaseCoordinator(std::string const& name,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*dbServerResult >= 0) {
|
if (*dbServerResult >= 0) {
|
||||||
|
loadCurrent(); // update our cache
|
||||||
return *dbServerResult;
|
return *dbServerResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1062,7 +1062,6 @@ int ClusterInfo::createCollectionCoordinator(std::string const& databaseName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadCurrent();
|
|
||||||
if (tmpHaveError) {
|
if (tmpHaveError) {
|
||||||
*errMsg = "Error in creation of collection:" + tmpMsg;
|
*errMsg = "Error in creation of collection:" + tmpMsg;
|
||||||
*dbServerResult = TRI_ERROR_CLUSTER_COULD_NOT_CREATE_COLLECTION;
|
*dbServerResult = TRI_ERROR_CLUSTER_COULD_NOT_CREATE_COLLECTION;
|
||||||
|
@ -1122,6 +1121,7 @@ int ClusterInfo::createCollectionCoordinator(std::string const& databaseName,
|
||||||
errorMsg = *errMsg;
|
errorMsg = *errMsg;
|
||||||
|
|
||||||
if (*dbServerResult >= 0) {
|
if (*dbServerResult >= 0) {
|
||||||
|
loadCurrent();
|
||||||
return *dbServerResult;
|
return *dbServerResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,24 +1156,8 @@ int ClusterInfo::dropCollectionCoordinator(std::string const& databaseName,
|
||||||
auto errMsg = std::make_shared<std::string>();
|
auto errMsg = std::make_shared<std::string>();
|
||||||
std::function<bool(VPackSlice const& result)> dbServerChanged =
|
std::function<bool(VPackSlice const& result)> dbServerChanged =
|
||||||
[=](VPackSlice const& result) {
|
[=](VPackSlice const& result) {
|
||||||
AgencyComm ac;
|
|
||||||
if (result.isObject() && result.length() == 0) {
|
if (result.isObject() && result.length() == 0) {
|
||||||
// ...remove the entire directory for the collection
|
|
||||||
AgencyCommResult res;
|
|
||||||
res = ac.removeValues(
|
|
||||||
"Current/Collections/" + databaseName + "/" + collectionID, true);
|
|
||||||
if (res.successful()) {
|
|
||||||
*dbServerResult = setErrormsg(TRI_ERROR_NO_ERROR, *errMsg);
|
*dbServerResult = setErrormsg(TRI_ERROR_NO_ERROR, *errMsg);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
*dbServerResult = setErrormsg(
|
|
||||||
TRI_ERROR_CLUSTER_COULD_NOT_REMOVE_COLLECTION_IN_CURRENT,
|
|
||||||
*errMsg);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
loadCurrent();
|
|
||||||
*dbServerResult = setErrormsg(TRI_ERROR_NO_ERROR, *errMsg);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
@ -1215,6 +1199,10 @@ int ClusterInfo::dropCollectionCoordinator(std::string const& databaseName,
|
||||||
errorMsg = *errMsg;
|
errorMsg = *errMsg;
|
||||||
|
|
||||||
if (*dbServerResult >= 0) {
|
if (*dbServerResult >= 0) {
|
||||||
|
// ...remove the entire directory for the collection
|
||||||
|
ac.removeValues(
|
||||||
|
"Current/Collections/" + databaseName + "/" + collectionID, true);
|
||||||
|
loadCurrent();
|
||||||
return *dbServerResult;
|
return *dbServerResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1618,8 +1606,6 @@ int ClusterInfo::ensureIndexCoordinator(
|
||||||
}
|
}
|
||||||
resBuilder->add("isNewlyCreated", VPackValue(true));
|
resBuilder->add("isNewlyCreated", VPackValue(true));
|
||||||
}
|
}
|
||||||
loadCurrent();
|
|
||||||
|
|
||||||
*dbServerResult = setErrormsg(TRI_ERROR_NO_ERROR, *errMsg);
|
*dbServerResult = setErrormsg(TRI_ERROR_NO_ERROR, *errMsg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1666,6 +1652,7 @@ int ClusterInfo::ensureIndexCoordinator(
|
||||||
resultBuilder = *resBuilder;
|
resultBuilder = *resBuilder;
|
||||||
|
|
||||||
if (*dbServerResult >= 0) {
|
if (*dbServerResult >= 0) {
|
||||||
|
loadCurrent();
|
||||||
return *dbServerResult;
|
return *dbServerResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1767,7 +1754,6 @@ int ClusterInfo::dropIndexCoordinator(std::string const& databaseName,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
loadCurrent();
|
|
||||||
*dbServerResult = setErrormsg(TRI_ERROR_NO_ERROR, *errMsg);
|
*dbServerResult = setErrormsg(TRI_ERROR_NO_ERROR, *errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1884,6 +1870,7 @@ int ClusterInfo::dropIndexCoordinator(std::string const& databaseName,
|
||||||
errorMsg = *errMsg;
|
errorMsg = *errMsg;
|
||||||
|
|
||||||
if (*dbServerResult >= 0) {
|
if (*dbServerResult >= 0) {
|
||||||
|
loadCurrent();
|
||||||
return *dbServerResult;
|
return *dbServerResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -338,3 +338,7 @@ TraverserEngine::~TraverserEngine() {
|
||||||
void TraverserEngine::smartSearch(VPackSlice, VPackBuilder&) {
|
void TraverserEngine::smartSearch(VPackSlice, VPackBuilder&) {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ONLY_ENTERPRISE);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_ONLY_ENTERPRISE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TraverserEngine::smartSearchBFS(VPackSlice, VPackBuilder&) {
|
||||||
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_ONLY_ENTERPRISE);
|
||||||
|
}
|
||||||
|
|
|
@ -75,6 +75,9 @@ class BaseTraverserEngine {
|
||||||
virtual void smartSearch(arangodb::velocypack::Slice,
|
virtual void smartSearch(arangodb::velocypack::Slice,
|
||||||
arangodb::velocypack::Builder&) = 0;
|
arangodb::velocypack::Builder&) = 0;
|
||||||
|
|
||||||
|
virtual void smartSearchBFS(arangodb::velocypack::Slice,
|
||||||
|
arangodb::velocypack::Builder&) = 0;
|
||||||
|
|
||||||
bool lockCollection(std::string const&);
|
bool lockCollection(std::string const&);
|
||||||
|
|
||||||
std::shared_ptr<TransactionContext> context() const;
|
std::shared_ptr<TransactionContext> context() const;
|
||||||
|
@ -103,7 +106,10 @@ class TraverserEngine : public BaseTraverserEngine {
|
||||||
~TraverserEngine();
|
~TraverserEngine();
|
||||||
|
|
||||||
void smartSearch(arangodb::velocypack::Slice,
|
void smartSearch(arangodb::velocypack::Slice,
|
||||||
arangodb::velocypack::Builder&);
|
arangodb::velocypack::Builder&) override;
|
||||||
|
|
||||||
|
void smartSearchBFS(arangodb::velocypack::Slice,
|
||||||
|
arangodb::velocypack::Builder&) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace traverser
|
} // namespace traverser
|
||||||
|
|
|
@ -224,6 +224,8 @@ void InternalRestTraverserHandler::queryEngine() {
|
||||||
}
|
}
|
||||||
} else if (option == "smartSearch") {
|
} else if (option == "smartSearch") {
|
||||||
engine->smartSearch(body, result);
|
engine->smartSearch(body, result);
|
||||||
|
} else if (option == "smartSearchBFS") {
|
||||||
|
engine->smartSearchBFS(body, result);
|
||||||
} else {
|
} else {
|
||||||
// PATH Info wrong other error
|
// PATH Info wrong other error
|
||||||
generateError(
|
generateError(
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ -z "$XTERM" ] ; then
|
if [ -z "$XTERM" ] ; then
|
||||||
XTERM=x-terminal-emulator
|
XTERM=xterm
|
||||||
fi
|
|
||||||
if [ -z "$XTERMOPTIONS" ] ; then
|
|
||||||
XTERMOPTIONS="--geometry=80x43"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d arangod ] || [ ! -d arangosh ] || [ ! -d UnitTests ] ; then
|
if [ ! -d arangod ] || [ ! -d arangosh ] || [ ! -d UnitTests ] ; then
|
||||||
|
|
|
@ -1,23 +1,59 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
function help() {
|
||||||
|
echo "USAGE: scripts/startStandAloneAgency.sh [options]"
|
||||||
|
echo ""
|
||||||
|
echo "OPTIONS:"
|
||||||
|
echo " -a/--agency-size Agency size (odd integer default: 3))"
|
||||||
|
echo " -p/--pool-size Pool size (>= agency size default: [agency size])"
|
||||||
|
echo " -t/--transport Protocol (ssl|tcp default: tcp)"
|
||||||
|
echo " -l/--log-level Log level (INFO|DEBUG|TRACE default: INFO)"
|
||||||
|
echo ""
|
||||||
|
echo "EXAMPLES:"
|
||||||
|
echo " scripts/startStandaloneAgency.sh"
|
||||||
|
echo " scripts/startStandaloneAgency.sh -a 5 -p 10 -t ssl"
|
||||||
|
echo " scripts/startStandaloneAgency.sh --agency-size 3 --pool-size 5"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
NRAGENTS=3
|
NRAGENTS=3
|
||||||
POOLSZ=""
|
POOLSZ=""
|
||||||
TRANSPORT="tcp"
|
TRANSPORT="tcp"
|
||||||
LOG_LEVEL="INFO"
|
LOG_LEVEL="INFO"
|
||||||
|
|
||||||
while getopts ":a:p:t:l:" opt; do
|
while [[ ${1} ]]; do
|
||||||
case $opt in
|
case "${1}" in
|
||||||
a) NRAGENTS="$OPTARG"
|
-a|--agency-size)
|
||||||
|
NRAGENTS=${2}
|
||||||
|
shift
|
||||||
;;
|
;;
|
||||||
p) POOLSZ="$OPTARG"
|
-p|--pool-size)
|
||||||
|
POOLSZ=${2}
|
||||||
|
shift
|
||||||
;;
|
;;
|
||||||
t) TRANSPORT="$OPTARG"
|
-t|--transport)
|
||||||
|
TRANSPORT=${2}
|
||||||
|
shift
|
||||||
;;
|
;;
|
||||||
l) LOG_LEVEL="$OPTARG"
|
-l|--log-level)
|
||||||
|
LOG_LEVEL=${2}
|
||||||
|
shift
|
||||||
;;
|
;;
|
||||||
\?) echo "Invalid option -$OPTARG" >&2
|
-h|--help)
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown parameter: ${1}" >&2
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if ! shift; then
|
||||||
|
echo 'Missing parameter argument.' >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$POOLSZ" == "" ] ; then
|
if [ "$POOLSZ" == "" ] ; then
|
||||||
|
@ -26,14 +62,17 @@ fi
|
||||||
|
|
||||||
if [ "$TRANSPORT" == "ssl" ]; then
|
if [ "$TRANSPORT" == "ssl" ]; then
|
||||||
SSLKEYFILE="--ssl.keyfile UnitTests/server.pem"
|
SSLKEYFILE="--ssl.keyfile UnitTests/server.pem"
|
||||||
|
CURL="curl --insecure -ks https://"
|
||||||
else
|
else
|
||||||
SSLKEYFILE=""
|
SSLKEYFILE=""
|
||||||
|
CURL="curl -s http://"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "agency-size: %s\n" "$NRAGENTS"
|
printf "Starting agency ... \n"
|
||||||
printf "pool-size: %s\n" "$POOLSZ"
|
printf " agency-size: %s," "$NRAGENTS"
|
||||||
printf "transport: %s\n" "$TRANSPORT"
|
printf " pool-size: %s," "$POOLSZ"
|
||||||
printf "log-level: %s\n" "$LOG_LEVEL"
|
printf " transport: %s," "$TRANSPORT"
|
||||||
|
printf " log-level: %s\n" "$LOG_LEVEL"
|
||||||
|
|
||||||
if [ ! -d arangod ] || [ ! -d arangosh ] || [ ! -d UnitTests ] ; then
|
if [ ! -d arangod ] || [ ! -d arangosh ] || [ ! -d UnitTests ] ; then
|
||||||
echo Must be started in the main ArangoDB source directory.
|
echo Must be started in the main ArangoDB source directory.
|
||||||
|
@ -49,11 +88,11 @@ MINP=0.5
|
||||||
MAXP=2.0
|
MAXP=2.0
|
||||||
SFRE=2.5
|
SFRE=2.5
|
||||||
COMP=1000
|
COMP=1000
|
||||||
BASE=5001
|
BASE=5000
|
||||||
|
|
||||||
rm -rf agency
|
rm -rf agency
|
||||||
mkdir -p agency
|
mkdir -p agency
|
||||||
echo -n "Starting agency ... "
|
PIDS=""
|
||||||
for aid in `seq 0 $(( $POOLSZ - 1 ))`; do
|
for aid in `seq 0 $(( $POOLSZ - 1 ))`; do
|
||||||
port=$(( $BASE + $aid ))
|
port=$(( $BASE + $aid ))
|
||||||
build/bin/arangod \
|
build/bin/arangod \
|
||||||
|
@ -81,9 +120,12 @@ for aid in `seq 0 $(( $POOLSZ - 1 ))`; do
|
||||||
--server.statistics false \
|
--server.statistics false \
|
||||||
$SSLKEYFILE \
|
$SSLKEYFILE \
|
||||||
> agency/$port.stdout 2>&1 &
|
> agency/$port.stdout 2>&1 &
|
||||||
|
PIDS+=$!
|
||||||
|
PIDS+=" "
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "done."
|
echo " done. Your agents are ready at port $BASE onward."
|
||||||
echo "Your agents are ready at port $BASE onward"
|
#echo "Process ids: $PIDS"
|
||||||
|
echo "Try ${CURL}localhost:5000/_api/agency/config."
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ if [ "x$@" == "x" ] ; then
|
||||||
if [ -d ./enterprise ] ; then
|
if [ -d ./enterprise ] ; then
|
||||||
echo Considering enterprise files...
|
echo Considering enterprise files...
|
||||||
JAVASCRIPT_JSLINT="$JAVASCRIPT_JSLINT \
|
JAVASCRIPT_JSLINT="$JAVASCRIPT_JSLINT \
|
||||||
`find ./enterprise/Enterprise/js -name "*.js"` \
|
`find ./enterprise/js -name "*.js"` \
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue