mirror of https://gitee.com/bigwinds/arangodb
Fix immediate shutdown after startup failure. (#10365)
* Add missing dependencies to IResearchAnalyzerFeature * First all features beginShutdown, then stop. This is for the case of immediate shutdown if the startup did not work.
This commit is contained in:
parent
6169907f9a
commit
b186aebd8d
|
@ -978,6 +978,10 @@ IResearchAnalyzerFeature::IResearchAnalyzerFeature(arangodb::application_feature
|
|||
// used for getting the system database
|
||||
// containing the persisted configuration
|
||||
startsAfter("SystemDatabase");
|
||||
startsAfter("CommunicationPhase");
|
||||
startsAfter("Aql");
|
||||
startsAfter("OptimizerRules");
|
||||
startsAfter("QueryRegistry");
|
||||
}
|
||||
|
||||
/*static*/ bool IResearchAnalyzerFeature::canUse( // check permissions
|
||||
|
|
|
@ -683,6 +683,26 @@ void ApplicationServer::start() {
|
|||
LOG_TOPIC("4ec19", ERR, Logger::STARTUP) << res.errorMessage() << ". shutting down";
|
||||
LOG_TOPIC("51732", TRACE, Logger::STARTUP)
|
||||
<< "aborting startup, now stopping and unpreparing all features";
|
||||
|
||||
// try to stop all feature that we just started
|
||||
for (auto it = _orderedFeatures.rbegin(); it != _orderedFeatures.rend(); ++it) {
|
||||
auto feature = *it;
|
||||
if (!feature->isEnabled()) {
|
||||
continue;
|
||||
}
|
||||
if (feature->state() == ApplicationFeature::State::STARTED) {
|
||||
LOG_TOPIC("e5cfe", TRACE, Logger::STARTUP)
|
||||
<< "forcefully beginning stop of feature '" << feature->name() << "'";
|
||||
try {
|
||||
feature->beginShutdown();
|
||||
} catch (...) {
|
||||
// ignore errors on shutdown
|
||||
LOG_TOPIC("13224", TRACE, Logger::STARTUP)
|
||||
<< "caught exception while stopping feature '" << feature->name() << "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// try to stop all feature that we just started
|
||||
for (auto it = _orderedFeatures.rbegin(); it != _orderedFeatures.rend(); ++it) {
|
||||
auto feature = *it;
|
||||
|
@ -693,7 +713,6 @@ void ApplicationServer::start() {
|
|||
LOG_TOPIC("e5cfd", TRACE, Logger::STARTUP)
|
||||
<< "forcefully stopping feature '" << feature->name() << "'";
|
||||
try {
|
||||
feature->beginShutdown();
|
||||
feature->stop();
|
||||
feature->state(ApplicationFeature::State::STOPPED);
|
||||
} catch (...) {
|
||||
|
|
Loading…
Reference in New Issue