Merge branch 'devel' of github.com:arangodb/arangodb into spdvpk
|
@ -138,7 +138,6 @@ bool Agent::waitFor (index_t index, double timeout) {
|
|||
// Wait until woken up through AgentCallback
|
||||
while (true) {
|
||||
|
||||
std::cout << _last_commit_index << std::endl;
|
||||
/// success?
|
||||
if (_last_commit_index >= index) {
|
||||
return true;
|
||||
|
@ -301,7 +300,7 @@ bool Agent::load () {
|
|||
LOG_TOPIC(INFO, Logger::AGENCY) << "Loading persistent state.";
|
||||
if (!_state.loadCollections(_vocbase, _applicationV8, _queryRegistry,
|
||||
_config.wait_for_sync)) {
|
||||
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||
LOG_TOPIC(INFO, Logger::AGENCY)
|
||||
<< "Failed to load persistent state on statup.";
|
||||
}
|
||||
|
||||
|
@ -337,11 +336,11 @@ write_ret_t Agent::write (query_t const& query) {
|
|||
MUTEX_LOCKER(mutexLocker, _ioLock);
|
||||
applied = _spearhead.apply(query); // Apply to spearhead
|
||||
indices = _state.log (query, applied, term(), id()); // Log w/ indicies
|
||||
if (!indices.empty()) {
|
||||
maxind = *std::max_element(indices.begin(), indices.end());
|
||||
}
|
||||
_cv.signal(); // Wake up run
|
||||
}
|
||||
if (!indices.empty()) {
|
||||
maxind = *std::max_element(indices.begin(), indices.end());
|
||||
}
|
||||
_cv.signal(); // Wake up run
|
||||
|
||||
reportIn(id(),maxind);
|
||||
|
||||
|
|
|
@ -159,8 +159,6 @@ public:
|
|||
|
||||
std::atomic<index_t> _last_commit_index; /**< @brief Last commit index */
|
||||
|
||||
arangodb::Mutex _uncommitedLock; /**< @brief */
|
||||
|
||||
Store _spearhead; /**< @brief Spearhead key value store */
|
||||
Store _read_db; /**< @brief Read key value store */
|
||||
|
||||
|
|
|
@ -851,15 +851,18 @@ void Store::beginShutdown() {
|
|||
// TTL clear values from store
|
||||
query_t Store::clearExpired () const {
|
||||
query_t tmp = std::make_shared<Builder>();
|
||||
tmp->openArray();
|
||||
for (auto it = _time_table.cbegin(); it != _time_table.cend(); ++it) {
|
||||
if (it->first < std::chrono::system_clock::now()) {
|
||||
tmp->openArray(); tmp->openObject();
|
||||
tmp->add(it->second->uri(), VPackValue(VPackValueType::Object));
|
||||
tmp->add("op",VPackValue("delete"));
|
||||
tmp->close(); tmp->close(); tmp->close();
|
||||
} else {
|
||||
break;
|
||||
tmp->openArray();
|
||||
{
|
||||
MUTEX_LOCKER(storeLocker, _storeLock);
|
||||
for (auto it = _time_table.cbegin(); it != _time_table.cend(); ++it) {
|
||||
if (it->first < std::chrono::system_clock::now()) {
|
||||
tmp->openArray(); tmp->openObject();
|
||||
tmp->add(it->second->uri(), VPackValue(VPackValueType::Object));
|
||||
tmp->add("op",VPackValue("delete"));
|
||||
tmp->close(); tmp->close(); tmp->close();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
tmp->close();
|
||||
|
@ -909,16 +912,32 @@ bool Store::start (Agent* agent) {
|
|||
|
||||
// Work ttls and callbacks
|
||||
void Store::run() {
|
||||
|
||||
CONDITION_LOCKER(guard, _cv);
|
||||
|
||||
while (!this->isStopping()) { // Check timetable and remove overage entries
|
||||
if (!_time_table.empty()) {
|
||||
auto t = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
_time_table.begin()->first - std::chrono::system_clock::now());
|
||||
|
||||
std::chrono::microseconds t{0};
|
||||
query_t toClear;
|
||||
|
||||
{ // any entries in time table?
|
||||
MUTEX_LOCKER(storeLocker, _storeLock);
|
||||
if (!_time_table.empty()) {
|
||||
t = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
_time_table.begin()->first - std::chrono::system_clock::now());
|
||||
}
|
||||
}
|
||||
|
||||
if (t != std::chrono::microseconds{0}) {
|
||||
_cv.wait(t.count());
|
||||
} else {
|
||||
_cv.wait(); // better wait to next known time point
|
||||
_cv.wait();
|
||||
}
|
||||
auto toclear = clearExpired();
|
||||
_agent->write(toclear);
|
||||
|
||||
toClear = clearExpired();
|
||||
_agent->write(toClear);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ bool AgencyCommResult::parseVelocyPackNode(VPackSlice const& node,
|
|||
entry._isDir = false;
|
||||
|
||||
_values.emplace(prefix, entry);
|
||||
} else if (value.isNumber()) {
|
||||
} else if (value.isNumber() || value.isBoolean()) {
|
||||
AgencyCommResultEntry entry;
|
||||
|
||||
// get "modifiedIndex"
|
||||
|
@ -668,21 +668,22 @@ bool AgencyComm::tryInitializeStructure() {
|
|||
}
|
||||
addEmptyVPackObject("DBServers", builder);
|
||||
builder.add("Lock", VPackValue("\"UNLOCKED\""));
|
||||
builder.add("InitDone", VPackValue(true));
|
||||
}
|
||||
builder.add("InitDone", VPackValue(true));
|
||||
} catch (...) {
|
||||
LOG(WARN) << "Couldn't create initializing structure";
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
LOG(DEBUG) << "Initializing agency with " << builder.toJson();
|
||||
LOG(TRACE) << "Initializing agency with " << builder.toJson();
|
||||
|
||||
AgencyCommResult result;
|
||||
AgencyOperation initOperation("", AgencyValueOperationType::SET, builder.slice());
|
||||
|
||||
AgencyTransaction initTransaction;
|
||||
initTransaction.operations.push_back(initOperation);
|
||||
|
||||
|
||||
sendTransactionWithFailover(result, initTransaction);
|
||||
|
||||
return result.successful();
|
||||
|
@ -696,37 +697,72 @@ bool AgencyComm::tryInitializeStructure() {
|
|||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief checks if the agency is initialized
|
||||
/// @brief checks if we are responsible for initializing the agency
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
bool AgencyComm::hasInitializedStructure() {
|
||||
AgencyCommResult result = getValues("InitDone", false);
|
||||
|
||||
if (!result.successful()) {
|
||||
bool AgencyComm::shouldInitializeStructure() {
|
||||
VPackBuilder builder;
|
||||
builder.add(VPackValue(false));
|
||||
|
||||
double timeout = _globalConnectionOptions._requestTimeout;
|
||||
// "InitDone" key should not previously exist
|
||||
AgencyCommResult result = casValue("InitDone", builder.slice(), false, 60.0, timeout);
|
||||
|
||||
if (!result.successful() &&
|
||||
result.httpCode() ==
|
||||
(int)arangodb::GeneralResponse::ResponseCode::PRECONDITION_FAILED) {
|
||||
// somebody else has or is initializing the agency
|
||||
LOG(TRACE) << "someone else is initializing the agency";
|
||||
return false;
|
||||
}
|
||||
// mop: hmmm ... don't check value...we only save true there right now...
|
||||
// should be sufficient to check for key presence
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief will initialize agency if it is freshly started
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool AgencyComm::ensureStructureInitialized() {
|
||||
LOG(TRACE) << ("Checking if agency is initialized");
|
||||
while (!hasInitializedStructure()) {
|
||||
LOG(TRACE) << ("Agency is fresh. Needs initial structure.");
|
||||
// mop: we initialized it .. great success
|
||||
if (tryInitializeStructure()) {
|
||||
LOG(TRACE) << ("Done initializing");
|
||||
return true;
|
||||
} else {
|
||||
LOG(TRACE) << ("Somebody else is already initializing");
|
||||
LOG(TRACE) << "Checking if agency is initialized";
|
||||
|
||||
while (true) {
|
||||
while (shouldInitializeStructure()) {
|
||||
LOG(TRACE) << "Agency is fresh. Needs initial structure.";
|
||||
// mop: we initialized it .. great success
|
||||
if (tryInitializeStructure()) {
|
||||
LOG(TRACE) << "Done initializing agency";
|
||||
break;
|
||||
}
|
||||
|
||||
LOG(WARN) << "Initializing agency failed. We'll try again soon";
|
||||
// mop: somebody else is initializing it right now...wait a bit and retry
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
AgencyCommResult result = getValues("InitDone", false);
|
||||
|
||||
if (result.successful()) {
|
||||
result.parse("", false);
|
||||
|
||||
std::map<std::string, AgencyCommResultEntry>::iterator it =
|
||||
result._values.begin();
|
||||
if (it != result._values.end()) {
|
||||
auto value = (*it).second._vpack;
|
||||
|
||||
if (value->slice().isBoolean() && value->slice().getBoolean()) {
|
||||
// expecting a value of "true"
|
||||
LOG(TRACE) << "Found an initialized agency";
|
||||
return true;
|
||||
}
|
||||
// fallthrough to sleeping
|
||||
}
|
||||
}
|
||||
|
||||
LOG(TRACE) << "Waiting for agency to get initialized";
|
||||
|
||||
sleep(1);
|
||||
} // next attempt
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1160,7 +1196,7 @@ AgencyCommResult AgencyComm::getValues(std::string const& key, bool recursive) {
|
|||
try {
|
||||
std::shared_ptr<VPackBuilder> parsedBody;
|
||||
std::string const body = result.body();
|
||||
|
||||
|
||||
parsedBody = VPackParser::fromJson(body.c_str());
|
||||
VPackSlice agencyResult = parsedBody->slice();
|
||||
|
||||
|
|
|
@ -679,10 +679,10 @@ class AgencyComm {
|
|||
bool initFromVPackSlice(std::string key, arangodb::velocypack::Slice s);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief checks if the agency is initialized
|
||||
/// @brief checks if we are responsible for initializing the agency
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool hasInitializedStructure();
|
||||
bool shouldInitializeStructure();
|
||||
|
||||
private:
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -378,6 +378,9 @@ static int TruncateAndSealDatafile(TRI_datafile_t* datafile,
|
|||
TRI_UnlinkFile(filename.c_str());
|
||||
|
||||
LOG(ERR) << "cannot memory map file '" << filename << "': " << TRI_GET_ERRORBUF;
|
||||
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.";
|
||||
|
||||
return TRI_errno();
|
||||
}
|
||||
|
@ -883,6 +886,9 @@ static TRI_datafile_t* CreateAnonymousDatafile(TRI_voc_fid_t fid,
|
|||
TRI_set_errno(res);
|
||||
|
||||
LOG(ERR) << "cannot memory map anonymous region: " << TRI_last_error();
|
||||
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.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -940,6 +946,9 @@ static TRI_datafile_t* CreatePhysicalDatafile(char const* filename,
|
|||
TRI_UnlinkFile(filename);
|
||||
|
||||
LOG(ERR) << "cannot memory map file '" << filename << "': '" << TRI_errno_string((int)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.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1077,6 +1086,9 @@ static TRI_datafile_t* OpenDatafile(char const* filename, bool ignoreErrors) {
|
|||
TRI_CLOSE(fd);
|
||||
|
||||
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.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -21380,7 +21380,8 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
var callback = function(error, lockedCollections) {
|
||||
var self = this;
|
||||
if (error) {
|
||||
arangoHelper.arangoError("Collections", "Could not check locked collections");
|
||||
//arangoHelper.arangoError("Collections", "Could not check locked collections");
|
||||
console.log("Could not check locked collections");
|
||||
}
|
||||
else {
|
||||
this.collection.each(function(model) {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<script src="sharedLibs.js?version=1460670094870"></script>
|
||||
<script src="libs.js?version=1460670094870"></script>
|
||||
<script src="app.js?version=1460670094870"></script>
|
||||
<script src="sharedLibs.js?version=1460720592272"></script>
|
||||
<script src="libs.js?version=1460720592272"></script>
|
||||
<script src="app.js?version=1460720592272"></script>
|
||||
|
|
|
@ -301,6 +301,7 @@
|
|||
|
||||
</div></script><script id="collectionsItemView.ejs" type="text/template"><div class="paddingBox">
|
||||
<div class="borderBox"></div>
|
||||
<!--
|
||||
<div class="iconSet">
|
||||
<span id="editCollection_<%=model.get('name')%>" class="icon_arangodb_settings2" alt="Edit collection properties" title="Edit collection properties"></span>
|
||||
<% if(model.get('status') === "loaded") { %>
|
||||
|
@ -309,7 +310,7 @@
|
|||
<span class="icon_arangodb_info disabled" alt="disabled"></span>
|
||||
<%}%>
|
||||
</div>
|
||||
|
||||
-->
|
||||
<i class="collection-type-icon fa <%= model.get('picture') %>"></i>
|
||||
<!--<img src="<%= model.get('picture') %>" height="50" width="50" alt="" class="icon">-->
|
||||
<div class="tileBadge">
|
||||
|
@ -2883,4 +2884,4 @@ var cutByResolution = function (str) {
|
|||
</div>
|
||||
|
||||
<div id="workMonitorContent" class="innerContent">
|
||||
</div></script></head><body><nav class="navbar"><div class="primary"><div class="navlogo"><a class="logo" href="#"><img class="arangodbLogo" src="img/DEVLOGO.png"></a></div><div class="statmenu" id="statisticBar"></div><div class="navmenu" id="navigationBar"></div></div></nav><div class="bodyWrapper"><div class="centralRow"><div id="navbar2" class="secondary"><div class="subnavmenu" id="subNavigationBar"></div></div><div class="resizecontainer contentWrapper" style="clear:both"><div id="content" class="centralContent"></div></div><div class="resizecontainer footerWrapper" style="clear:both"><footer class="footer"><div class="" id="footerBar"></div></footer></div></div></div><div id="modalPlaceholder"></div><div id="progressPlaceholder" style="display:none"></div><div id="spotlightPlaceholder" style="display:none"></div><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="sharedLibs.js?version=1460670094870"></script><script src="libs.js?version=1460670094870"></script><script src="app.js?version=1460670094870"></script></body></html>
|
||||
</div></script></head><body><nav class="navbar"><div class="primary"><div class="navlogo"><a class="logo big" href="#"><img class="arangodbLogo" src="img/arangodb_logo_big.png"></a> <a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a></div><div class="statmenu" id="statisticBar"></div><div class="navmenu" id="navigationBar"></div></div></nav><div class="bodyWrapper"><div class="centralRow"><div id="navbar2" class="secondary"><div class="subnavmenu" id="subNavigationBar"></div></div><div class="resizecontainer contentWrapper" style="clear:both"><div id="content" class="centralContent"></div></div><div class="resizecontainer footerWrapper" style="clear:both"><footer class="footer"><div class="" id="footerBar"></div></footer></div></div></div><div id="modalPlaceholder"></div><div id="progressPlaceholder" style="display:none"></div><div id="spotlightPlaceholder" style="display:none"></div><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="sharedLibs.js?version=1460720592272"></script><script src="libs.js?version=1460720592272"></script><script src="app.js?version=1460720592272"></script></body></html>
|
|
@ -342,6 +342,7 @@
|
|||
<script id="collectionsItemView.ejs" type="text/template">
|
||||
<div class="paddingBox">
|
||||
<div class="borderBox"></div>
|
||||
<!--
|
||||
<div class="iconSet">
|
||||
<span id="editCollection_<%=model.get('name')%>" class="icon_arangodb_settings2" alt="Edit collection properties" title="Edit collection properties"></span>
|
||||
<% if(model.get('status') === "loaded") { %>
|
||||
|
@ -350,7 +351,7 @@
|
|||
<span class="icon_arangodb_info disabled" alt="disabled"></span>
|
||||
<%}%>
|
||||
</div>
|
||||
|
||||
-->
|
||||
<i class="collection-type-icon fa <%= model.get('picture') %>"></i>
|
||||
<!--<img src="<%= model.get('picture') %>" height="50" width="50" alt="" class="icon">-->
|
||||
<div class="tileBadge">
|
||||
|
@ -3152,7 +3153,8 @@ var cutByResolution = function (str) {
|
|||
<nav class="navbar">
|
||||
<div class="primary">
|
||||
<div class="navlogo">
|
||||
<a class="logo" href="#"><img class="arangodbLogo" src="img/DEVLOGO.png"/></a>
|
||||
<a class="logo big" href="#"><img class="arangodbLogo" src="img/arangodb_logo_big.png"/></a>
|
||||
<a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"/></a>
|
||||
</div>
|
||||
<!-- <div id="progressPlaceholderIcon"></div> -->
|
||||
<div class="statmenu" id="statisticBar">
|
||||
|
@ -3200,9 +3202,9 @@ var cutByResolution = function (str) {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script src="sharedLibs.js?version=1460670094870"></script>
|
||||
<script src="libs.js?version=1460670094870"></script>
|
||||
<script src="app.js?version=1460670094870"></script>
|
||||
<script src="sharedLibs.js?version=1460720592272"></script>
|
||||
<script src="libs.js?version=1460720592272"></script>
|
||||
<script src="app.js?version=1460720592272"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2312,6 +2312,8 @@ div.queryline input, input.search-input, .modal-body .select2-choices input, .mo
|
|||
.navlogo {
|
||||
height: 60px;
|
||||
width: 100%; }
|
||||
.navlogo .small {
|
||||
display: none; }
|
||||
|
||||
.navmenu {
|
||||
clear: both; }
|
||||
|
@ -2324,6 +2326,8 @@ div.queryline input, input.search-input, .modal-body .select2-choices input, .mo
|
|||
line-height: 30px; }
|
||||
.navlist li {
|
||||
width: 150px; }
|
||||
.navlist li a {
|
||||
outline: none; }
|
||||
.navlist li .fa {
|
||||
opacity: .3;
|
||||
padding-left: 5px;
|
||||
|
@ -7875,6 +7879,12 @@ input.gv-radio-button {
|
|||
margin-bottom: 10px; }
|
||||
div.dropdownInner ul label {
|
||||
font-size: 13px; }
|
||||
.navlogo .big {
|
||||
display: none; }
|
||||
.navlogo .small {
|
||||
display: block;
|
||||
height: auto;
|
||||
width: 28px; }
|
||||
.navbar,
|
||||
.navmenu,
|
||||
.primary,
|
||||
|
|
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 5.0 KiB |
|
@ -3,7 +3,8 @@
|
|||
<nav class="navbar">
|
||||
<div class="primary">
|
||||
<div class="navlogo">
|
||||
<a class="logo" href="#"><img class="arangodbLogo" src="img/DEVLOGO.png"/></a>
|
||||
<a class="logo big" href="#"><img class="arangodbLogo" src="img/arangodb_logo_big.png"/></a>
|
||||
<a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"/></a>
|
||||
</div>
|
||||
<!-- <div id="progressPlaceholderIcon"></div> -->
|
||||
<div class="statmenu" id="statisticBar">
|
||||
|
|
Before Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
@ -1,6 +1,7 @@
|
|||
<script id="collectionsItemView.ejs" type="text/template">
|
||||
<div class="paddingBox">
|
||||
<div class="borderBox"></div>
|
||||
<!--
|
||||
<div class="iconSet">
|
||||
<span id="editCollection_<%=model.get('name')%>" class="icon_arangodb_settings2" alt="Edit collection properties" title="Edit collection properties"></span>
|
||||
<% if(model.get('status') === "loaded") { %>
|
||||
|
@ -9,7 +10,7 @@
|
|||
<span class="icon_arangodb_info disabled" alt="disabled"></span>
|
||||
<%}%>
|
||||
</div>
|
||||
|
||||
-->
|
||||
<i class="collection-type-icon fa <%= model.get('picture') %>"></i>
|
||||
<!--<img src="<%= model.get('picture') %>" height="50" width="50" alt="" class="icon">-->
|
||||
<div class="tileBadge">
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
var callback = function(error, lockedCollections) {
|
||||
var self = this;
|
||||
if (error) {
|
||||
arangoHelper.arangoError("Collections", "Could not check locked collections");
|
||||
//arangoHelper.arangoError("Collections", "Could not check locked collections");
|
||||
console.log("Could not check locked collections");
|
||||
}
|
||||
else {
|
||||
this.collection.each(function(model) {
|
||||
|
|
|
@ -91,6 +91,10 @@ $navbar-size: 150px;
|
|||
@extend %pull-left;
|
||||
height: 60px;
|
||||
width: 100%;
|
||||
|
||||
.small {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.navmenu {
|
||||
|
|
|
@ -29,6 +29,19 @@
|
|||
}
|
||||
|
||||
// NAVIGATION LEFT
|
||||
|
||||
.navlogo {
|
||||
.big {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.small {
|
||||
display: block;
|
||||
height: auto;
|
||||
width: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
.navbar,
|
||||
.navmenu,
|
||||
.primary,
|
||||
|
|
|
@ -1088,7 +1088,8 @@ function shutdownArangod(arangod, options) {
|
|||
if (options.valgrind) {
|
||||
waitOnServerForGC(arangod, options, 60);
|
||||
}
|
||||
if (arangod.exitStatus === undefined) {
|
||||
if (arangod.exitStatus === undefined ||
|
||||
arangod.exitStatus.status === "RUNNING") {
|
||||
print(arangod.url + "/_admin/shutdown");
|
||||
download(arangod.url + "/_admin/shutdown", "",
|
||||
makeAuthorizationHeaders(options));
|
||||
|
@ -1105,9 +1106,15 @@ function shutdownInstance(instanceInfo, options) {
|
|||
if (!checkInstanceAlive(instanceInfo, options)) {
|
||||
print("Server already dead, doing nothing. This shouldn't happen?");
|
||||
}
|
||||
instanceInfo.arangods.reverse().forEach(arangod => {
|
||||
shutdownArangod(arangod, options);
|
||||
});
|
||||
// Shut down all non-agency servers:
|
||||
const n = instanceInfo.arangods.length;
|
||||
let nonagencies = instanceInfo.arangods
|
||||
.filter(arangod => !arangod.isAgency);
|
||||
nonagencies.forEach(arangod =>
|
||||
shutdownArangod(arangod, options)
|
||||
);
|
||||
let agentsKilled = false;
|
||||
let nrAgents = n - nonagencies.length;
|
||||
|
||||
let timeout = 60;
|
||||
if (options.valgrind) {
|
||||
|
@ -1121,6 +1128,15 @@ function shutdownInstance(instanceInfo, options) {
|
|||
|
||||
let toShutdown = instanceInfo.arangods.slice();
|
||||
while (toShutdown.length > 0) {
|
||||
// Once all other servers are shut down, we take care of the agents,
|
||||
// we do this exactly once (agentsKilled flag) and only if there
|
||||
// are agents:
|
||||
if (!agentsKilled && nrAgents > 0 && toShutdown.length === nrAgents) {
|
||||
instanceInfo.arangods
|
||||
.filter(arangod => arangod.isAgency)
|
||||
.forEach(arangod => shutdownArangod(arangod, options));
|
||||
agentsKilled = true;
|
||||
}
|
||||
toShutdown = toShutdown.filter(arangod => {
|
||||
arangod.exitStatus = statusExternal(arangod.pid, false);
|
||||
|
||||
|
@ -1261,6 +1277,7 @@ function startInstanceCluster(instanceInfo, protocol, options,
|
|||
httpOptions.timeout = 3600;
|
||||
response = download(coordinatorUrl + '/_admin/cluster/upgradeClusterDatabase', '{"isRelaunch":false}', httpOptions);
|
||||
if (response.code !== 200) {
|
||||
console.log(response);
|
||||
throw new Error('Upgrading DB failed');
|
||||
}
|
||||
|
||||
|
@ -1274,7 +1291,7 @@ function startInstanceCluster(instanceInfo, protocol, options,
|
|||
return true;
|
||||
}
|
||||
|
||||
function startArango(protocol, options, addArgs, name, rootDir) {
|
||||
function startArango(protocol, options, addArgs, name, rootDir, isAgency) {
|
||||
const dataDir = fs.join(rootDir, "data");
|
||||
const appDir = fs.join(rootDir, "apps");
|
||||
|
||||
|
@ -1291,10 +1308,7 @@ function startArango(protocol, options, addArgs, name, rootDir) {
|
|||
endpoint = addArgs["server.endpoint"];
|
||||
port = endpoint.split(":").pop();
|
||||
}
|
||||
let instanceInfo = {};
|
||||
instanceInfo.port = port;
|
||||
instanceInfo.endpoint = endpoint;
|
||||
instanceInfo.rootDir = rootDir;
|
||||
let instanceInfo = {isAgency, port, endpoint, rootDir};
|
||||
|
||||
args["server.endpoint"] = endpoint;
|
||||
args["database.directory"] = dataDir;
|
||||
|
@ -1364,7 +1378,7 @@ function startInstanceAgency(instanceInfo, protocol, options,
|
|||
let dir = fs.join(rootDir, 'agency-' + i);
|
||||
fs.makeDirectoryRecursive(dir);
|
||||
|
||||
instanceInfo.arangods.push(startArango(protocol, options, instanceArgs, testname, rootDir));
|
||||
instanceInfo.arangods.push(startArango(protocol, options, instanceArgs, testname, rootDir, true));
|
||||
}
|
||||
|
||||
instanceInfo.endpoint = instanceInfo.arangods[instanceInfo.arangods.length - 1].endpoint;
|
||||
|
@ -1377,7 +1391,7 @@ function startInstanceAgency(instanceInfo, protocol, options,
|
|||
function startInstanceSingleServer(instanceInfo, protocol, options,
|
||||
addArgs, testname, rootDir) {
|
||||
|
||||
instanceInfo.arangods.push(startArango(protocol, options, addArgs, testname, rootDir));
|
||||
instanceInfo.arangods.push(startArango(protocol, options, addArgs, testname, rootDir, false));
|
||||
|
||||
instanceInfo.endpoint = instanceInfo.arangods[instanceInfo.arangods.length - 1].endpoint;
|
||||
instanceInfo.url = instanceInfo.arangods[instanceInfo.arangods.length - 1].url;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint globalstrict:false, strict:false */
|
||||
/*global fail, assertFalse, assertTrue, assertEqual, assertNotEqual, ArangoAgency */
|
||||
/*global fail, assertFalse, assertTrue, assertEqual, ArangoAgency */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test the agency communication layer
|
||||
|
|