1
0
Fork 0

fix VERSION files on upgrade and database creation in cluster (#9076)

This commit is contained in:
Jan 2019-05-22 21:42:48 +02:00 committed by Andrey Abramov
parent 6b08aa95c4
commit 70cccc3c89
2 changed files with 8 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#include "Basics/FileUtils.h" #include "Basics/FileUtils.h"
#include "Basics/exitcodes.h" #include "Basics/exitcodes.h"
#include "Cluster/ServerState.h"
#include "Logger/Logger.h" #include "Logger/Logger.h"
#include "Logger/LoggerFeature.h" #include "Logger/LoggerFeature.h"
#include "ProgramOptions/ProgramOptions.h" #include "ProgramOptions/ProgramOptions.h"
@ -168,6 +169,12 @@ void CheckVersionFeature::checkVersion() {
<< "please start the server with option " << "please start the server with option "
"`--database.ignore-datafile-errors true`"; "`--database.ignore-datafile-errors true`";
} }
} else if (res.status == methods::VersionResult::NO_VERSION_FILE) {
// try to install a fresh new, empty VERSION file instead
if (methods::Version::write(vocbase, std::map<std::string, bool>(), true).ok()) {
// give it another try
res = methods::Version::check(vocbase);
}
} }
LOG_TOPIC("53cbb", DEBUG, Logger::STARTUP) << "version check return status " << res.status; LOG_TOPIC("53cbb", DEBUG, Logger::STARTUP) << "version check return status " << res.status;

View File

@ -298,7 +298,7 @@ UpgradeResult methods::Upgrade::runTasks(TRI_vocbase_t& vocbase, VersionResult&
// needs to run in superuser scope, otherwise we get errors // needs to run in superuser scope, otherwise we get errors
ExecContextScope scope(ExecContext::superuser()); ExecContextScope scope(ExecContext::superuser());
// only local should actually write a VERSION file // only local should actually write a VERSION file
bool isLocal = clusterFlag == CLUSTER_NONE || clusterFlag == CLUSTER_LOCAL; bool isLocal = clusterFlag == CLUSTER_NONE || clusterFlag == CLUSTER_LOCAL || clusterFlag == CLUSTER_DB_SERVER_LOCAL;
bool ranOnce = false; bool ranOnce = false;
// execute all tasks // execute all tasks