diff --git a/CHANGELOG b/CHANGELOG index 1bbb7f118b..668207c948 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,14 @@ v1.1.beta3 (XXXX-XX-XX) +* WARNING: + arangod now performs a database version check at startup. It will look for a file + named "VERSION" in its database directory. If the file is not present, arangod will + refuse to start and ask the user to run arango-upgrade first. If the VERSION file + is present but is from an older version of ArangoDB, arangod will also refuse to + start and ask the user to run the upgrade script first. This procedure shall ensure + that users have full control over when they perform any updates/upgrades of their + data, and do not risk running an incompatible server/database state tandem. + * fixed issue #283: AQL LENGTH() now works on documents, too * fixed issue #281: documentation for skip lists shows wrong example diff --git a/arangod/V8Server/ApplicationV8.cpp b/arangod/V8Server/ApplicationV8.cpp index a70d392b7f..86a5f77b97 100644 --- a/arangod/V8Server/ApplicationV8.cpp +++ b/arangod/V8Server/ApplicationV8.cpp @@ -691,6 +691,8 @@ bool ApplicationV8::prepareV8Instance (const size_t i) { if (i == 0 && _runVersionCheck) { + LOGGER_DEBUG << "running database version check"; + const string script = _startupLoader.buildScript(JS_server_version_check); // special check script to be run just once in first thread (not in all) @@ -709,6 +711,8 @@ bool ApplicationV8::prepareV8Instance (const size_t i) { return false; } + + LOGGER_DEBUG << "database version check passed"; } // load all actions diff --git a/js/server/arango-upgrade.js b/js/server/arango-upgrade.js index 7c750bf8a8..f39daad5ae 100644 --- a/js/server/arango-upgrade.js +++ b/js/server/arango-upgrade.js @@ -58,8 +58,12 @@ function main (argv) { var versionInfo = SYS_READ(versionFile); if (versionInfo != '') { var versionValues = JSON.parse(versionInfo); - lastVersion = parseFloat(versionValues.version); - lastTasks = versionValues.tasks; + if (versionValues && versionValues.version && ! isNaN(versionValues.version)) { + lastVersion = parseFloat(versionValues.version); + } + if (versionValues && versionValues.tasks && typeof(versionValues.tasks) === 'object') { + lastTasks = versionValues.tasks || { }; + } } } diff --git a/js/server/version-check.js b/js/server/version-check.js index 4a999f2e90..64629adb74 100644 --- a/js/server/version-check.js +++ b/js/server/version-check.js @@ -54,7 +54,14 @@ var versionInfo = SYS_READ(versionFile); if (versionInfo != '') { var versionValues = JSON.parse(versionInfo); - lastVersion = parseFloat(versionValues.version); + if (versionValues && versionValues.version && ! isNaN(versionValues.version)) { + lastVersion = parseFloat(versionValues.version); + } + } + + if (lastVersion == null) { + console.error("No version information file found in database directory."); + return false; } var currentServerVersion = VERSION.match(/^(\d+\.\d+).*$/); @@ -67,7 +74,8 @@ if (lastVersion != null && lastVersion > currentVersion) { // downgrade?? - console.warn("Database directory version is higher than server version. This seems like you are running arangodb on a database directory that was created with a newer version. This is not supported."); + console.error("Database directory version is higher than server version."); + console.error("It seems like you are running arangodb on a database directory that was created with a newer version. This is not supported."); // still, allow the start }