mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into generic-col-types
This commit is contained in:
commit
68ae8d2945
|
@ -518,6 +518,14 @@ you need to place hooks:
|
||||||
is replaced in with its own evaluated content - so *@EXAMPLE_ARANGOSH_[OUTPUT | RUN]* sections are executed
|
is replaced in with its own evaluated content - so *@EXAMPLE_ARANGOSH_[OUTPUT | RUN]* sections are executed
|
||||||
the same way as inside of source code documentation.
|
the same way as inside of source code documentation.
|
||||||
|
|
||||||
|
Include ditaa diagrams
|
||||||
|
----------------------
|
||||||
|
We use the [beautifull ditaa (DIagrams Through Ascii Art)](http://ditaa.sourceforge.net/) to generate diagrams explaining flows etc.
|
||||||
|
in our documentation.
|
||||||
|
|
||||||
|
We have i.e. `Manual/Graphs/graph_user_in_group.ditaa` which is transpiled by ditaa into a png file, thus you simply include
|
||||||
|
a png file of the same name as image into the mardown: `` to reference it.
|
||||||
|
|
||||||
Read / use the documentation
|
Read / use the documentation
|
||||||
----------------------------
|
----------------------------
|
||||||
- `file:///Documentation/Books/books/Manual/index.html` contains the generated manual
|
- `file:///Documentation/Books/books/Manual/index.html` contains the generated manual
|
||||||
|
|
|
@ -45,12 +45,7 @@ static void JS_EnabledAgent(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||||
v8::HandleScope scope(isolate);
|
v8::HandleScope scope(isolate);
|
||||||
|
|
||||||
try {
|
TRI_V8_RETURN(v8::Boolean::New(isolate, ApplicationServer::server->isEnabled("Agency")));
|
||||||
ApplicationServer::getEnabledFeature<AgencyFeature>("Agency");
|
|
||||||
TRI_V8_RETURN_TRUE();
|
|
||||||
} catch (std::exception const& e) {
|
|
||||||
TRI_V8_RETURN_FALSE();
|
|
||||||
}
|
|
||||||
|
|
||||||
TRI_V8_TRY_CATCH_END
|
TRI_V8_TRY_CATCH_END
|
||||||
|
|
||||||
|
|
|
@ -170,112 +170,117 @@ void HeartbeatThread::runDBServer() {
|
||||||
int currentCount = currentCountStart;
|
int currentCount = currentCountStart;
|
||||||
|
|
||||||
while (!isStopping()) {
|
while (!isStopping()) {
|
||||||
LOG_TOPIC(DEBUG, Logger::HEARTBEAT) << "sending heartbeat to agency";
|
try {
|
||||||
|
LOG_TOPIC(DEBUG, Logger::HEARTBEAT) << "sending heartbeat to agency";
|
||||||
|
|
||||||
double const start = TRI_microtime();
|
double const start = TRI_microtime();
|
||||||
|
// send our state to the agency.
|
||||||
|
// we don't care if this fails
|
||||||
|
sendState();
|
||||||
|
|
||||||
// send our state to the agency.
|
if (isStopping()) {
|
||||||
// we don't care if this fails
|
break;
|
||||||
sendState();
|
}
|
||||||
|
|
||||||
if (isStopping()) {
|
if (--currentCount == 0) {
|
||||||
break;
|
currentCount = currentCountStart;
|
||||||
}
|
|
||||||
|
|
||||||
if (--currentCount == 0) {
|
// send an initial GET request to Sync/Commands/my-id
|
||||||
currentCount = currentCountStart;
|
|
||||||
|
|
||||||
// send an initial GET request to Sync/Commands/my-id
|
|
||||||
LOG_TOPIC(TRACE, Logger::HEARTBEAT)
|
|
||||||
<< "Looking at Sync/Commands/" + _myId;
|
|
||||||
|
|
||||||
AgencyReadTransaction trx(std::vector<std::string>(
|
|
||||||
{_agency.prefixPath() + "Shutdown",
|
|
||||||
_agency.prefixPath() + "Current/Version",
|
|
||||||
_agency.prefixPath() + "Sync/Commands/" + _myId
|
|
||||||
}));
|
|
||||||
|
|
||||||
AgencyCommResult result = _agency.sendTransactionWithFailover(trx);
|
|
||||||
if (!result.successful()) {
|
|
||||||
LOG_TOPIC(WARN, Logger::HEARTBEAT)
|
|
||||||
<< "Heartbeat: Could not read from agency!";
|
|
||||||
} else {
|
|
||||||
VPackSlice shutdownSlice = result.slice()[0].get(
|
|
||||||
std::vector<std::string>({_agency.prefix(), "Shutdown"})
|
|
||||||
);
|
|
||||||
|
|
||||||
if (shutdownSlice.isBool() && shutdownSlice.getBool()) {
|
|
||||||
ApplicationServer::server->beginShutdown();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
LOG_TOPIC(TRACE, Logger::HEARTBEAT)
|
LOG_TOPIC(TRACE, Logger::HEARTBEAT)
|
||||||
<< "Looking at Sync/Commands/" + _myId;
|
<< "Looking at Sync/Commands/" + _myId;
|
||||||
handleStateChange(result);
|
|
||||||
|
|
||||||
VPackSlice s = result.slice()[0].get(
|
AgencyReadTransaction trx(std::vector<std::string>(
|
||||||
std::vector<std::string>({_agency.prefix(), std::string("Current"),
|
{_agency.prefixPath() + "Shutdown",
|
||||||
std::string("Version")}));
|
_agency.prefixPath() + "Current/Version",
|
||||||
if (!s.isInteger()) {
|
_agency.prefixPath() + "Sync/Commands/" + _myId
|
||||||
LOG_TOPIC(ERR, Logger::HEARTBEAT)
|
}));
|
||||||
<< "Current/Version in agency is not an integer.";
|
|
||||||
|
AgencyCommResult result = _agency.sendTransactionWithFailover(trx);
|
||||||
|
if (!result.successful()) {
|
||||||
|
LOG_TOPIC(WARN, Logger::HEARTBEAT)
|
||||||
|
<< "Heartbeat: Could not read from agency!";
|
||||||
} else {
|
} else {
|
||||||
uint64_t currentVersion = 0;
|
VPackSlice shutdownSlice = result.slice()[0].get(
|
||||||
try {
|
std::vector<std::string>({_agency.prefix(), "Shutdown"})
|
||||||
currentVersion = s.getUInt();
|
);
|
||||||
} catch (...) {
|
|
||||||
|
if (shutdownSlice.isBool() && shutdownSlice.getBool()) {
|
||||||
|
ApplicationServer::server->beginShutdown();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (currentVersion == 0) {
|
LOG_TOPIC(TRACE, Logger::HEARTBEAT)
|
||||||
|
<< "Looking at Sync/Commands/" + _myId;
|
||||||
|
handleStateChange(result);
|
||||||
|
|
||||||
|
VPackSlice s = result.slice()[0].get(
|
||||||
|
std::vector<std::string>({_agency.prefix(), std::string("Current"),
|
||||||
|
std::string("Version")}));
|
||||||
|
if (!s.isInteger()) {
|
||||||
LOG_TOPIC(ERR, Logger::HEARTBEAT)
|
LOG_TOPIC(ERR, Logger::HEARTBEAT)
|
||||||
<< "Current/Version in agency is 0.";
|
<< "Current/Version in agency is not an integer.";
|
||||||
} else {
|
} else {
|
||||||
{
|
uint64_t currentVersion = 0;
|
||||||
MUTEX_LOCKER(mutexLocker, _statusLock);
|
try {
|
||||||
if (currentVersion > _desiredVersions.current) {
|
currentVersion = s.getUInt();
|
||||||
_desiredVersions.current = currentVersion;
|
} catch (...) {
|
||||||
LOG_TOPIC(DEBUG, Logger::HEARTBEAT)
|
}
|
||||||
<< "Found greater Current/Version in agency.";
|
if (currentVersion == 0) {
|
||||||
}
|
LOG_TOPIC(ERR, Logger::HEARTBEAT)
|
||||||
|
<< "Current/Version in agency is 0.";
|
||||||
|
} else {
|
||||||
|
{
|
||||||
|
MUTEX_LOCKER(mutexLocker, _statusLock);
|
||||||
|
if (currentVersion > _desiredVersions.current) {
|
||||||
|
_desiredVersions.current = currentVersion;
|
||||||
|
LOG_TOPIC(DEBUG, Logger::HEARTBEAT)
|
||||||
|
<< "Found greater Current/Version in agency.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
syncDBServerStatusQuo();
|
||||||
}
|
}
|
||||||
syncDBServerStatusQuo();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (isStopping()) {
|
if (isStopping()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
double remain = interval - (TRI_microtime() - start);
|
double remain = interval - (TRI_microtime() - start);
|
||||||
// mop: execute at least once
|
// mop: execute at least once
|
||||||
do {
|
do {
|
||||||
LOG_TOPIC(TRACE, Logger::HEARTBEAT) << "Entering update loop";
|
LOG_TOPIC(TRACE, Logger::HEARTBEAT) << "Entering update loop";
|
||||||
|
|
||||||
|
bool wasNotified;
|
||||||
|
{
|
||||||
|
CONDITION_LOCKER(locker, _condition);
|
||||||
|
wasNotified = _wasNotified;
|
||||||
|
if (!wasNotified) {
|
||||||
|
if (remain > 0.0) {
|
||||||
|
locker.wait(static_cast<uint64_t>(remain * 1000000.0));
|
||||||
|
wasNotified = _wasNotified;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_wasNotified = false;
|
||||||
|
}
|
||||||
|
|
||||||
bool wasNotified;
|
|
||||||
{
|
|
||||||
CONDITION_LOCKER(locker, _condition);
|
|
||||||
wasNotified = _wasNotified;
|
|
||||||
if (!wasNotified) {
|
if (!wasNotified) {
|
||||||
if (remain > 0.0) {
|
LOG_TOPIC(TRACE, Logger::HEARTBEAT) << "Lock reached timeout";
|
||||||
locker.wait(static_cast<uint64_t>(remain * 1000000.0));
|
planAgencyCallback->refetchAndUpdate(true);
|
||||||
wasNotified = _wasNotified;
|
} else {
|
||||||
}
|
// mop: a plan change returned successfully...
|
||||||
|
// recheck and redispatch in case our desired versions increased
|
||||||
|
// in the meantime
|
||||||
|
LOG_TOPIC(TRACE, Logger::HEARTBEAT) << "wasNotified==true";
|
||||||
|
syncDBServerStatusQuo();
|
||||||
}
|
}
|
||||||
_wasNotified = false;
|
remain = interval - (TRI_microtime() - start);
|
||||||
}
|
} while (remain > 0);
|
||||||
|
} catch (std::exception const& e) {
|
||||||
if (!wasNotified) {
|
LOG_TOPIC(ERR, Logger::HEARTBEAT) << "Got an exception in DBServer heartbeat: " << e.what();
|
||||||
LOG_TOPIC(TRACE, Logger::HEARTBEAT) << "Lock reached timeout";
|
} catch (...) {
|
||||||
planAgencyCallback->refetchAndUpdate(true);
|
LOG_TOPIC(ERR, Logger::HEARTBEAT) << "Got an unknown exception in DBServer heartbeat";
|
||||||
} else {
|
}
|
||||||
// mop: a plan change returned successfully...
|
|
||||||
// recheck and redispatch in case our desired versions increased
|
|
||||||
// in the meantime
|
|
||||||
LOG_TOPIC(TRACE, Logger::HEARTBEAT) << "wasNotified==true";
|
|
||||||
syncDBServerStatusQuo();
|
|
||||||
}
|
|
||||||
remain = interval - (TRI_microtime() - start);
|
|
||||||
} while (remain > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_agencyCallbackRegistry->unregisterCallback(planAgencyCallback);
|
_agencyCallbackRegistry->unregisterCallback(planAgencyCallback);
|
||||||
|
@ -316,138 +321,144 @@ void HeartbeatThread::runCoordinator() {
|
||||||
setReady();
|
setReady();
|
||||||
|
|
||||||
while (!isStopping()) {
|
while (!isStopping()) {
|
||||||
LOG_TOPIC(TRACE, Logger::HEARTBEAT) << "sending heartbeat to agency";
|
try {
|
||||||
|
LOG_TOPIC(TRACE, Logger::HEARTBEAT) << "sending heartbeat to agency";
|
||||||
|
|
||||||
double const start = TRI_microtime();
|
double const start = TRI_microtime();
|
||||||
// send our state to the agency.
|
// send our state to the agency.
|
||||||
// we don't care if this fails
|
// we don't care if this fails
|
||||||
sendState();
|
sendState();
|
||||||
|
|
||||||
if (isStopping()) {
|
if (isStopping()) {
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
AgencyReadTransaction trx(std::vector<std::string>(
|
|
||||||
{_agency.prefixPath() + "Shutdown",
|
|
||||||
_agency.prefixPath() + "Plan/Version",
|
|
||||||
_agency.prefixPath() + "Current/Version",
|
|
||||||
_agency.prefixPath() + "Current/Foxxmaster",
|
|
||||||
_agency.prefixPath() + "Current/FoxxmasterQueueupdate",
|
|
||||||
_agency.prefixPath() + "Sync/Commands/" + _myId,
|
|
||||||
_agency.prefixPath() + "Sync/UserVersion"}));
|
|
||||||
AgencyCommResult result = _agency.sendTransactionWithFailover(trx);
|
|
||||||
|
|
||||||
if (!result.successful()) {
|
|
||||||
LOG_TOPIC(WARN, Logger::HEARTBEAT)
|
|
||||||
<< "Heartbeat: Could not read from agency!";
|
|
||||||
} else {
|
|
||||||
VPackSlice shutdownSlice = result.slice()[0].get(
|
|
||||||
std::vector<std::string>({_agency.prefix(), "Shutdown"})
|
|
||||||
);
|
|
||||||
|
|
||||||
if (shutdownSlice.isBool() && shutdownSlice.getBool()) {
|
|
||||||
ApplicationServer::server->beginShutdown();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TOPIC(TRACE, Logger::HEARTBEAT)
|
AgencyReadTransaction trx(std::vector<std::string>(
|
||||||
<< "Looking at Sync/Commands/" + _myId;
|
{_agency.prefixPath() + "Shutdown",
|
||||||
|
_agency.prefixPath() + "Plan/Version",
|
||||||
|
_agency.prefixPath() + "Current/Version",
|
||||||
|
_agency.prefixPath() + "Current/Foxxmaster",
|
||||||
|
_agency.prefixPath() + "Current/FoxxmasterQueueupdate",
|
||||||
|
_agency.prefixPath() + "Sync/Commands/" + _myId,
|
||||||
|
_agency.prefixPath() + "Sync/UserVersion"}));
|
||||||
|
AgencyCommResult result = _agency.sendTransactionWithFailover(trx);
|
||||||
|
|
||||||
handleStateChange(result);
|
if (!result.successful()) {
|
||||||
|
LOG_TOPIC(WARN, Logger::HEARTBEAT)
|
||||||
|
<< "Heartbeat: Could not read from agency!";
|
||||||
|
} else {
|
||||||
|
VPackSlice shutdownSlice = result.slice()[0].get(
|
||||||
|
std::vector<std::string>({_agency.prefix(), "Shutdown"})
|
||||||
|
);
|
||||||
|
|
||||||
// mop: order is actually important here...FoxxmasterQueueupdate will be set only when somebody
|
if (shutdownSlice.isBool() && shutdownSlice.getBool()) {
|
||||||
// registers some new queue stuff (for example on a different coordinator than this one)...
|
ApplicationServer::server->beginShutdown();
|
||||||
// However when we are just about to become the new foxxmaster we must immediately refresh our queues
|
break;
|
||||||
// this is done in ServerState...if queueupdate is set after foxxmaster the change will be reset again
|
|
||||||
VPackSlice foxxmasterQueueupdateSlice = result.slice()[0].get(
|
|
||||||
std::vector<std::string>({_agency.prefix(), "Current", "FoxxmasterQueueupdate"})
|
|
||||||
);
|
|
||||||
|
|
||||||
if (foxxmasterQueueupdateSlice.isBool()) {
|
|
||||||
ServerState::instance()->setFoxxmasterQueueupdate(foxxmasterQueueupdateSlice.getBool());
|
|
||||||
}
|
|
||||||
|
|
||||||
VPackSlice foxxmasterSlice = result.slice()[0].get(
|
|
||||||
std::vector<std::string>({_agency.prefix(), "Current", "Foxxmaster"})
|
|
||||||
);
|
|
||||||
|
|
||||||
if (foxxmasterSlice.isString()) {
|
|
||||||
ServerState::instance()->setFoxxmaster(foxxmasterSlice.copyString());
|
|
||||||
}
|
|
||||||
|
|
||||||
VPackSlice versionSlice = result.slice()[0].get(
|
|
||||||
std::vector<std::string>({_agency.prefix(), "Plan", "Version"}));
|
|
||||||
|
|
||||||
if (versionSlice.isInteger()) {
|
|
||||||
// there is a plan version
|
|
||||||
|
|
||||||
uint64_t planVersion = 0;
|
|
||||||
try {
|
|
||||||
planVersion = versionSlice.getUInt();
|
|
||||||
} catch (...) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (planVersion > lastPlanVersionNoticed) {
|
LOG_TOPIC(TRACE, Logger::HEARTBEAT)
|
||||||
LOG_TOPIC(TRACE, Logger::HEARTBEAT)
|
<< "Looking at Sync/Commands/" + _myId;
|
||||||
<< "Found planVersion " << planVersion << " which is newer than "
|
|
||||||
<< lastPlanVersionNoticed;
|
handleStateChange(result);
|
||||||
if (handlePlanChangeCoordinator(planVersion)) {
|
|
||||||
lastPlanVersionNoticed = planVersion;
|
// mop: order is actually important here...FoxxmasterQueueupdate will be set only when somebody
|
||||||
} else {
|
// registers some new queue stuff (for example on a different coordinator than this one)...
|
||||||
LOG_TOPIC(WARN, Logger::HEARTBEAT)
|
// However when we are just about to become the new foxxmaster we must immediately refresh our queues
|
||||||
<< "handlePlanChangeCoordinator was unsuccessful";
|
// this is done in ServerState...if queueupdate is set after foxxmaster the change will be reset again
|
||||||
|
VPackSlice foxxmasterQueueupdateSlice = result.slice()[0].get(
|
||||||
|
std::vector<std::string>({_agency.prefix(), "Current", "FoxxmasterQueueupdate"})
|
||||||
|
);
|
||||||
|
|
||||||
|
if (foxxmasterQueueupdateSlice.isBool()) {
|
||||||
|
ServerState::instance()->setFoxxmasterQueueupdate(foxxmasterQueueupdateSlice.getBool());
|
||||||
|
}
|
||||||
|
|
||||||
|
VPackSlice foxxmasterSlice = result.slice()[0].get(
|
||||||
|
std::vector<std::string>({_agency.prefix(), "Current", "Foxxmaster"})
|
||||||
|
);
|
||||||
|
|
||||||
|
if (foxxmasterSlice.isString()) {
|
||||||
|
ServerState::instance()->setFoxxmaster(foxxmasterSlice.copyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
VPackSlice versionSlice = result.slice()[0].get(
|
||||||
|
std::vector<std::string>({_agency.prefix(), "Plan", "Version"}));
|
||||||
|
|
||||||
|
if (versionSlice.isInteger()) {
|
||||||
|
// there is a plan version
|
||||||
|
|
||||||
|
uint64_t planVersion = 0;
|
||||||
|
try {
|
||||||
|
planVersion = versionSlice.getUInt();
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (planVersion > lastPlanVersionNoticed) {
|
||||||
|
LOG_TOPIC(TRACE, Logger::HEARTBEAT)
|
||||||
|
<< "Found planVersion " << planVersion << " which is newer than "
|
||||||
|
<< lastPlanVersionNoticed;
|
||||||
|
if (handlePlanChangeCoordinator(planVersion)) {
|
||||||
|
lastPlanVersionNoticed = planVersion;
|
||||||
|
} else {
|
||||||
|
LOG_TOPIC(WARN, Logger::HEARTBEAT)
|
||||||
|
<< "handlePlanChangeCoordinator was unsuccessful";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VPackSlice slice = result.slice()[0].get(
|
||||||
|
std::vector<std::string>({_agency.prefix(), "Sync", "UserVersion"}));
|
||||||
|
|
||||||
|
if (slice.isInteger()) {
|
||||||
|
// there is a UserVersion
|
||||||
|
uint64_t userVersion = 0;
|
||||||
|
try {
|
||||||
|
userVersion = slice.getUInt();
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userVersion > 0 && userVersion != oldUserVersion) {
|
||||||
|
oldUserVersion = userVersion;
|
||||||
|
GeneralServerFeature::AUTH_INFO.outdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
versionSlice = result.slice()[0].get(
|
||||||
|
std::vector<std::string>({_agency.prefix(), "Current", "Version"}));
|
||||||
|
if (versionSlice.isInteger()) {
|
||||||
|
uint64_t currentVersion = 0;
|
||||||
|
try {
|
||||||
|
currentVersion = versionSlice.getUInt();
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
|
if (currentVersion > lastCurrentVersionNoticed) {
|
||||||
|
LOG_TOPIC(TRACE, Logger::HEARTBEAT)
|
||||||
|
<< "Found currentVersion " << currentVersion
|
||||||
|
<< " which is newer than " << lastCurrentVersionNoticed;
|
||||||
|
lastCurrentVersionNoticed = currentVersion;
|
||||||
|
|
||||||
|
ClusterInfo::instance()->invalidateCurrent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VPackSlice slice = result.slice()[0].get(
|
double remain = interval - (TRI_microtime() - start);
|
||||||
std::vector<std::string>({_agency.prefix(), "Sync", "UserVersion"}));
|
|
||||||
|
|
||||||
if (slice.isInteger()) {
|
// sleep for a while if appropriate, on some systems usleep does not
|
||||||
// there is a UserVersion
|
// like arguments greater than 1000000
|
||||||
uint64_t userVersion = 0;
|
while (remain > 0.0) {
|
||||||
try {
|
if (remain >= 0.5) {
|
||||||
userVersion = slice.getUInt();
|
usleep(500000);
|
||||||
} catch (...) {
|
remain -= 0.5;
|
||||||
}
|
} else {
|
||||||
|
usleep((unsigned long)(remain * 1000.0 * 1000.0));
|
||||||
if (userVersion > 0 && userVersion != oldUserVersion) {
|
remain = 0.0;
|
||||||
oldUserVersion = userVersion;
|
|
||||||
GeneralServerFeature::AUTH_INFO.outdate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (std::exception const& e) {
|
||||||
versionSlice = result.slice()[0].get(
|
LOG_TOPIC(ERR, Logger::HEARTBEAT) << "Got an exception in coordinator heartbeat: " << e.what();
|
||||||
std::vector<std::string>({_agency.prefix(), "Current", "Version"}));
|
} catch (...) {
|
||||||
if (versionSlice.isInteger()) {
|
LOG_TOPIC(ERR, Logger::HEARTBEAT) << "Got an unknown exception in coordinator heartbeat";
|
||||||
uint64_t currentVersion = 0;
|
|
||||||
try {
|
|
||||||
currentVersion = versionSlice.getUInt();
|
|
||||||
} catch (...) {
|
|
||||||
}
|
|
||||||
if (currentVersion > lastCurrentVersionNoticed) {
|
|
||||||
LOG_TOPIC(TRACE, Logger::HEARTBEAT)
|
|
||||||
<< "Found currentVersion " << currentVersion
|
|
||||||
<< " which is newer than " << lastCurrentVersionNoticed;
|
|
||||||
lastCurrentVersionNoticed = currentVersion;
|
|
||||||
|
|
||||||
ClusterInfo::instance()->invalidateCurrent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double remain = interval - (TRI_microtime() - start);
|
|
||||||
|
|
||||||
// sleep for a while if appropriate, on some systems usleep does not
|
|
||||||
// like arguments greater than 1000000
|
|
||||||
while (remain > 0.0) {
|
|
||||||
if (remain >= 0.5) {
|
|
||||||
usleep(500000);
|
|
||||||
remain -= 0.5;
|
|
||||||
} else {
|
|
||||||
usleep((unsigned long)(remain * 1000.0 * 1000.0));
|
|
||||||
remain = 0.0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -807,42 +807,6 @@ int TRI_AppendUInt64StringBuffer(TRI_string_buffer_t* self, uint64_t attr) {
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief appends unsigned integer with 32 bits in octal
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int TRI_AppendUInt32OctalStringBuffer(TRI_string_buffer_t* self,
|
|
||||||
uint32_t attr) {
|
|
||||||
int res = Reserve(self, 11);
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t len = TRI_StringUInt32OctalInPlace(attr, self->_current);
|
|
||||||
self->_current += len;
|
|
||||||
|
|
||||||
return TRI_ERROR_NO_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief appends unsigned integer with 64 bits in octal
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int TRI_AppendUInt64OctalStringBuffer(TRI_string_buffer_t* self,
|
|
||||||
uint64_t attr) {
|
|
||||||
int res = Reserve(self, 22);
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t len = TRI_StringUInt64OctalInPlace(attr, self->_current);
|
|
||||||
self->_current += len;
|
|
||||||
|
|
||||||
return TRI_ERROR_NO_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief appends unsigned integer with 32 bits in hex
|
/// @brief appends unsigned integer with 32 bits in hex
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -315,18 +315,6 @@ int TRI_AppendInt64StringBuffer(TRI_string_buffer_t* self, int64_t attr);
|
||||||
|
|
||||||
int TRI_AppendUInt64StringBuffer(TRI_string_buffer_t* self, uint64_t attr);
|
int TRI_AppendUInt64StringBuffer(TRI_string_buffer_t* self, uint64_t attr);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief appends unsigned integer with 32 bits in octal
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int TRI_AppendUInt32OctalStringBuffer(TRI_string_buffer_t* self, uint32_t attr);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief appends unsigned integer with 64 bits in octal
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int TRI_AppendUInt64OctalStringBuffer(TRI_string_buffer_t* self, uint64_t attr);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief appends unsigned integer with 32 bits in hex
|
/// @brief appends unsigned integer with 32 bits in hex
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -981,36 +969,6 @@ class StringBuffer {
|
||||||
return appendInteger(sizetint_t(attr));
|
return appendInteger(sizetint_t(attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief appends unsigned integer with 32 bits in octal
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
StringBuffer& appendOctal(uint32_t attr) {
|
|
||||||
TRI_AppendUInt32OctalStringBuffer(&_buffer, attr);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief appends unsigned integer with 64 bits in octal
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
StringBuffer& appendOctal(uint64_t attr) {
|
|
||||||
TRI_AppendUInt64OctalStringBuffer(&_buffer, attr);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief appends size_t in octal
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifdef TRI_OVERLOAD_FUNCS_SIZE_T
|
|
||||||
|
|
||||||
StringBuffer& appendOctal(size_t attr) {
|
|
||||||
return appendOctal(sizetint_t(attr));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue