mirror of https://gitee.com/bigwinds/arangodb
make feature-order more deterministic
This commit is contained in:
parent
e93d12cf31
commit
a901b1e8fd
|
@ -384,11 +384,20 @@ void ApplicationServer::setupDependencies(bool failOnMissing) {
|
|||
// first insert all features, even the inactive ones
|
||||
std::vector<ApplicationFeature*> features;
|
||||
for (auto& it : _features) {
|
||||
auto const& us = it.second;
|
||||
auto insertPosition = features.end();
|
||||
|
||||
if (!features.empty()) {
|
||||
for (size_t i = features.size(); i > 0; --i) {
|
||||
if (it.second->doesStartBefore(features[i - 1]->name())) {
|
||||
auto const& other = features[i - 1];
|
||||
if (us->doesStartBefore(other->name())) {
|
||||
// we start before the other feature. so move ourselves up
|
||||
insertPosition = features.begin() + (i - 1);
|
||||
} else if (other->doesStartBefore(us->name())) {
|
||||
// the other feature starts before us. so stop moving up
|
||||
break;
|
||||
} else {
|
||||
// no dependencies between the two features
|
||||
if (us->name() < other->name()) {
|
||||
insertPosition = features.begin() + (i - 1);
|
||||
}
|
||||
}
|
||||
|
@ -396,23 +405,6 @@ void ApplicationServer::setupDependencies(bool failOnMissing) {
|
|||
features.insert(insertPosition, it.second);
|
||||
}
|
||||
|
||||
for (size_t i = 1; i < features.size(); ++i) {
|
||||
auto feature = features[i];
|
||||
size_t insert = i;
|
||||
for (size_t j = i; j > 0; --j) {
|
||||
if (features[j - 1]->doesStartBefore(feature->name())) {
|
||||
break;
|
||||
}
|
||||
insert = j - 1;
|
||||
}
|
||||
if (insert != i) {
|
||||
for (size_t j = i; j > insert; --j) {
|
||||
features[j] = features[j - 1];
|
||||
}
|
||||
features[insert] = feature;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << "ordered features:";
|
||||
|
||||
int position = 0;
|
||||
|
@ -425,7 +417,7 @@ void ApplicationServer::setupDependencies(bool failOnMissing) {
|
|||
}
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP)
|
||||
<< "feature #" << ++position << ": " << feature->name()
|
||||
<< (feature->isEnabled() ? "" : " (disabled)") << " " << dependencies;
|
||||
<< (feature->isEnabled() ? "" : " (disabled)") << dependencies;
|
||||
}
|
||||
|
||||
// remove all inactive features
|
||||
|
|
Loading…
Reference in New Issue