mirror of https://gitee.com/bigwinds/arangodb
fix --database.check-version on an empty directory
This commit is contained in:
parent
d82079a59c
commit
b9d345ff67
|
@ -97,6 +97,10 @@ void CheckVersionFeature::start() {
|
|||
|
||||
// and force shutdown
|
||||
server()->beginShutdown();
|
||||
|
||||
LOG(DEBUG) << "checking version on an empty database";
|
||||
usleep(1 * 1000 * 1000);
|
||||
TRI_EXIT_FUNCTION(EXIT_SUCCESS, nullptr);
|
||||
}
|
||||
|
||||
void CheckVersionFeature::checkVersion() {
|
||||
|
|
|
@ -341,7 +341,7 @@ void DatabaseFeature::start() {
|
|||
}
|
||||
|
||||
// TODO: handle _upgrade and _checkVersion here
|
||||
|
||||
|
||||
// activate deadlock detection in case we're not running in cluster mode
|
||||
if (!arangodb::ServerState::instance()->isRunningInCluster()) {
|
||||
enableDeadlockDetection();
|
||||
|
|
|
@ -119,6 +119,7 @@ class DatabaseFeature final : public application_features::ApplicationFeature {
|
|||
bool throwCollectionNotLoadedError() const { return _throwCollectionNotLoadedError.load(std::memory_order_relaxed); }
|
||||
void throwCollectionNotLoadedError(bool value) { _throwCollectionNotLoadedError.store(value); }
|
||||
bool check30Revisions() const { return _check30Revisions; }
|
||||
void isInitiallyEmpty(bool value) { _isInitiallyEmpty = value; }
|
||||
|
||||
private:
|
||||
void closeDatabases();
|
||||
|
|
|
@ -51,9 +51,18 @@ void ServerIdFeature::start() {
|
|||
auto database = application_features::ApplicationServer::getFeature<DatabaseFeature>("Database");
|
||||
|
||||
// read the server id or create a new one
|
||||
int res = determineId(database->checkVersion());
|
||||
bool const checkVersion = database->checkVersion();
|
||||
int res = determineId(checkVersion);
|
||||
|
||||
if (res == TRI_ERROR_ARANGO_EMPTY_DATADIR) {
|
||||
if (checkVersion) {
|
||||
// when we are version checking, we will not fail here
|
||||
// additionally notify the database feature that we had no VERSION file
|
||||
database->isInitiallyEmpty(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise fail
|
||||
THROW_ARANGO_EXCEPTION(res);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue