8000 ARANGODB_UPGRADE_DURING_RESTORE env variable. by neunhoef · Pull Request #10385 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

ARANGODB_UPGRADE_DURING_RESTORE env variable. #10385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions arangod/RestServer/UpgradeFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,36 @@ void UpgradeFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
}

/// @brief This external is buried in RestServer/arangod.cpp.
/// Used to perform one last action upon shutdown.
extern std::function<int()> * restartAction;

#ifndef _WIN32
static std::string const UPGRADE_ENV = "ARANGODB_UPGRADE_DURING_RESTORE";

static int upgradeRestart() {
unsetenv(UPGRADE_ENV.c_str());
return 0;
}
#endif

void UpgradeFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
#ifndef _WIN32
// The following environment variable is another way to run a database
// upgrade. If the environment variable is set, the system does a database
// upgrade and then restarts itself without the environment variable.
// This is used in hotbackup if a restore to a backup happens which is from
// an older database version. The restore process sets the environment
// variable at runtime and then does a restore. After the restart (with
// the old data) the database upgrade is run and another restart is
// happening afterwards with the environment variable being cleared.
char* upgrade = getenv(UPGRADE_ENV.c_str());
if (upgrade != nullptr) {
_upgrade = true;
restartAction = new std::function<int()>();
*restartAction = upgradeRestart;
}
#endif
if (_upgrade && !_upgradeCheck) {
LOG_TOPIC("47698", FATAL, arangodb::Logger::FIXME)
<< "cannot specify both '--database.auto-upgrade true' and "
Expand Down
0