1
0
Fork 0

Fixed available. Fixed not found for list. (#10234)

* Fixed available. Fixed not found for list.

* Fixed error reporting.

* Updated changelog.

* Fixed logid.
This commit is contained in:
Lars Maier 2019-10-14 15:51:42 +02:00 committed by KVS85
parent 9044f7de97
commit 5a97acc166
2 changed files with 29 additions and 15 deletions

View File

@ -1,6 +1,10 @@
v3.5.2 (XXXX-XX-XX)
-------------------
* Fixed available flag for hotbackup.
* Fixed list with id for partially available hotbackups.
* Fixed agency TTL bug happening under certain rare conditions.
* Improved performance of some agency helper functions.

View File

@ -3260,8 +3260,7 @@ arangodb::Result hotBackupList(std::vector<ServerID> const& dbServers, VPackSlic
resSlice = resSlice.get("result");
if (!resSlice.hasKey("list") || !resSlice.get("list").isObject()) {
return arangodb::Result(TRI_ERROR_HTTP_NOT_FOUND,
"result is missing backup list");
continue;
}
if (!payload.isNone() && plan.slice().isNone()) {
@ -3313,7 +3312,7 @@ arangodb::Result hotBackupList(std::vector<ServerID> const& dbServers, VPackSlic
front._sizeInBytes = totalSize;
front._nrFiles = totalFiles;
front._serverId = ""; // makes no sense for whole cluster
front._isAvailable = i.second.size() == dbServers.size();
front._isAvailable = i.second.size() == dbServers.size() && i.second.size() == front._nrDBServers;
front._nrPiecesPresent = static_cast<unsigned int>(i.second.size());
hotBackups.insert(std::make_pair(front._id, front));
}
@ -3615,6 +3614,11 @@ arangodb::Result hotRestoreCoordinator(VPackSlice const payload, VPackBuilder& r
<< " on all db servers: " << result.errorMessage();
return result;
}
if (list.size() == 0) {
return arangodb::Result(TRI_ERROR_HTTP_NOT_FOUND,
"result is missing backup list");
}
if (plan.slice().isNone()) {
LOG_TOPIC("54b9a", ERR, Logger::BACKUP)
<< "failed to find agency dump for " << backupId
@ -3622,14 +3626,20 @@ arangodb::Result hotRestoreCoordinator(VPackSlice const payload, VPackBuilder& r
return result;
}
TRI_ASSERT(list.size() == 1);
BackupMeta& meta = list.begin()->second;
if (!meta._isAvailable) {
LOG_TOPIC("ed4df", ERR, Logger::BACKUP)
<< "backup not available" << backupId;
return arangodb::Result(TRI_ERROR_HOT_RESTORE_INTERNAL,
"backup not available for restore");
}
// Check if the version matches the current version
if (!ignoreVersion) {
TRI_ASSERT(list.size() == 1);
using arangodb::methods::Version;
using arangodb::methods::VersionResult;
#ifdef USE_ENTERPRISE
BackupMeta& meta = list.begin()->second;
// Will never be called in community
#ifdef USE_ENTERPRISE // Will never be called in community
if (!RocksDBHotBackup::versionTestRestore(meta._version)) {
return arangodb::Result(TRI_ERROR_HOT_RESTORE_INTERNAL,
"Version mismatch");