mirror of https://gitee.com/bigwinds/arangodb
constituent starting anyway without inception
This commit is contained in:
parent
288f42c531
commit
ae2cc90c1a
|
@ -133,10 +133,6 @@ bool Agent::activateStandbyAgent() { return true; }
|
||||||
/// Start constituent personality
|
/// Start constituent personality
|
||||||
void Agent::startConstituent() {
|
void Agent::startConstituent() {
|
||||||
activateAgency();
|
activateAgency();
|
||||||
|
|
||||||
auto database = ApplicationServer::getFeature<DatabaseFeature>("Database");
|
|
||||||
auto vocbase = database->vocbase();
|
|
||||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Waits here for confirmation of log's commits up to index.
|
// Waits here for confirmation of log's commits up to index.
|
||||||
|
|
|
@ -68,7 +68,8 @@ void AgencyCallback::refetchAndUpdate(bool needToAcquireMutex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> kv = basics::StringUtils::split(AgencyComm::prefixPath() + key,'/');
|
std::vector<std::string> kv =
|
||||||
|
basics::StringUtils::split(AgencyComm::prefixPath() + key,'/');
|
||||||
kv.erase(std::remove(kv.begin(), kv.end(), ""), kv.end());
|
kv.erase(std::remove(kv.begin(), kv.end(), ""), kv.end());
|
||||||
|
|
||||||
std::shared_ptr<VPackBuilder> newData = std::make_shared<VPackBuilder>();
|
std::shared_ptr<VPackBuilder> newData = std::make_shared<VPackBuilder>();
|
||||||
|
@ -86,11 +87,14 @@ void AgencyCallback::checkValue(std::shared_ptr<VPackBuilder> newData) {
|
||||||
// Only called from refetchAndUpdate, we always have the mutex when
|
// Only called from refetchAndUpdate, we always have the mutex when
|
||||||
// we get here!
|
// we get here!
|
||||||
if (!_lastData || !_lastData->slice().equals(newData->slice())) {
|
if (!_lastData || !_lastData->slice().equals(newData->slice())) {
|
||||||
LOG(DEBUG) << "AgencyCallback: Got new value " << newData->slice().typeName() << " " << newData->toJson();
|
LOG_TOPIC(DEBUG, Logger::CLUSTER)
|
||||||
|
<< "AgencyCallback: Got new value " << newData->slice().typeName()
|
||||||
|
<< " " << newData->toJson();
|
||||||
if (execute(newData)) {
|
if (execute(newData)) {
|
||||||
_lastData = newData;
|
_lastData = newData;
|
||||||
} else {
|
} else {
|
||||||
LOG(DEBUG) << "Callback was not successful for " << newData->toJson();
|
LOG_TOPIC(DEBUG, Logger::CLUSTER)
|
||||||
|
<< "Callback was not successful for " << newData->toJson();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +102,7 @@ void AgencyCallback::checkValue(std::shared_ptr<VPackBuilder> newData) {
|
||||||
bool AgencyCallback::executeEmpty() {
|
bool AgencyCallback::executeEmpty() {
|
||||||
// only called from refetchAndUpdate, we always have the mutex when
|
// only called from refetchAndUpdate, we always have the mutex when
|
||||||
// we get here!
|
// we get here!
|
||||||
LOG(DEBUG) << "Executing (empty)";
|
LOG_TOPIC(DEBUG, Logger::CLUSTER) << "Executing (empty)";
|
||||||
bool result = _cb(VPackSlice::noneSlice());
|
bool result = _cb(VPackSlice::noneSlice());
|
||||||
if (result) {
|
if (result) {
|
||||||
_cv.signal();
|
_cv.signal();
|
||||||
|
@ -109,7 +113,7 @@ bool AgencyCallback::executeEmpty() {
|
||||||
bool AgencyCallback::execute(std::shared_ptr<VPackBuilder> newData) {
|
bool AgencyCallback::execute(std::shared_ptr<VPackBuilder> newData) {
|
||||||
// only called from refetchAndUpdate, we always have the mutex when
|
// only called from refetchAndUpdate, we always have the mutex when
|
||||||
// we get here!
|
// we get here!
|
||||||
LOG(DEBUG) << "Executing";
|
LOG_TOPIC(DEBUG, Logger::CLUSTER) << "Executing";
|
||||||
bool result = _cb(newData->slice());
|
bool result = _cb(newData->slice());
|
||||||
if (result) {
|
if (result) {
|
||||||
_cv.signal();
|
_cv.signal();
|
||||||
|
@ -127,7 +131,8 @@ void AgencyCallback::executeByCallbackOrTimeout(double maxTimeout) {
|
||||||
|
|
||||||
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())) {
|
if (!_lastData || !_lastData->slice().equals(compareBuilder->slice())) {
|
||||||
LOG(DEBUG) << "Waiting done and nothing happended. Refetching to be sure";
|
LOG_TOPIC(DEBUG, Logger::CLUSTER)
|
||||||
|
<< "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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue