1
0
Fork 0

Suppress startup warning about no user table. (#6904)

* Suppress startup warning about no user table.

* fix compilation
This commit is contained in:
Dan Larkin-York 2018-10-17 08:41:01 -04:00 committed by Jan
parent 3062d9685c
commit 45e4a8dda1
3 changed files with 33 additions and 13 deletions

View File

@ -37,6 +37,7 @@
#include "GeneralServer/GeneralServerFeature.h"
#include "Logger/Logger.h"
#include "Random/UniformCharacter.h"
#include "RestServer/BootstrapFeature.h"
#include "RestServer/DatabaseFeature.h"
#include "RestServer/InitDatabaseFeature.h"
#include "RestServer/SystemDatabaseFeature.h"
@ -233,6 +234,15 @@ void auth::UserManager::loadFromDB() {
_internalVersion.store(tmp);
}
}
} catch (basics::Exception const& ex) {
auto bootstrap = application_features::ApplicationServer::lookupFeature<BootstrapFeature>();
if (ex.code() != TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND ||
(bootstrap != nullptr && bootstrap->isReady())) {
LOG_TOPIC(WARN, Logger::AUTHENTICATION)
<< "Exception when loading users from db: " << ex.what();
}
// suppress log messgage if we get here during the normal course of an
// agency callback during bootstrapping and carry on
} catch (std::exception const& ex) {
LOG_TOPIC(WARN, Logger::AUTHENTICATION)
<< "Exception when loading users from db: " << ex.what();

View File

@ -38,6 +38,9 @@
#include "VocBase/Methods/Upgrade.h"
#include "V8Server/V8DealerFeature.h"
namespace {
static std::string const FEATURE_NAME("Bootstrap");
}
using namespace arangodb;
using namespace arangodb::options;
@ -47,8 +50,9 @@ static std::string const boostrapKey = "Bootstrap";
BootstrapFeature::BootstrapFeature(
application_features::ApplicationServer& server
)
: ApplicationFeature(server, "Bootstrap"), _isReady(false), _bark(false) {
: ApplicationFeature(server, ::FEATURE_NAME), _isReady(false), _bark(false) {
startsAfter("ServerPhase");
startsAfter(SystemDatabaseFeature::name());
// TODO: It is only in FoxxPhase because of:
startsAfter("FoxxQueues");
@ -63,6 +67,10 @@ BootstrapFeature::BootstrapFeature(
*/
}
/*static*/ std::string const& BootstrapFeature::name() noexcept {
return FEATURE_NAME;
}
void BootstrapFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
options->addHiddenOption("hund", "make ArangoDB bark on startup",
new BooleanParameter(&_bark));

View File

@ -35,6 +35,8 @@ class BootstrapFeature final : public application_features::ApplicationFeature {
void start() override final;
void unprepare() override final;
static std::string const& name() noexcept;
bool isReady() const {
return _isReady;
}