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.
@ -48,10 +52,10 @@ v3.5.1 (2019-10-07)
`--javascript.copy-installation`. This potentially fixes the following
error message at startup:
Error copying JS installation files to '...':
Error copying JS installation files to '...':
failed to open source file ...: No such file or directory
* Added startup option `--cluster.max-number-of-shards` for restricting the
* Added startup option `--cluster.max-number-of-shards` for restricting the
maximum number of shards when creating new collections. The default
value for this setting is `1000`, which is also the previously hard-coded
built-in limit. A value of `0` for this option means "unrestricted".
@ -71,8 +75,8 @@ v3.5.1 (2019-10-07)
No collections can be created which have a replication factor value
above this setting's value. The default value is 10.
- `--cluster.default-replication-factor`: this settings controls the default
replication factor value that is used when creating new collections and
no value of replication factor has been specified.
replication factor value that is used when creating new collections and
no value of replication factor has been specified.
If no value is set for this option, the value of the option
`--cluster.min-replication-factor` will be used.
@ -144,7 +148,7 @@ v3.5.1 (2019-10-07)
* Added UI support to create documents in a collection using smartGraphAttribute
and/or smartJoinAttribute.
* Add count of objects to latency reporting in arangoimport.
* Harden database creation against spurious "duplicate name" errors that

View File

@ -312,7 +312,7 @@ static void mergeResults(std::vector<std::pair<ShardID, VPackValueLength>> const
namespace {
// velocypack representation of object
// {"error":true,"errorMessage":"document not found","errorNum":1202}
static const char* notFoundSlice =
static const char* notFoundSlice =
"\x14\x36\x45\x65\x72\x72\x6f\x72\x1a\x4c\x65\x72\x72\x6f\x72\x4d"
"\x65\x73\x73\x61\x67\x65\x52\x64\x6f\x63\x75\x6d\x65\x6e\x74\x20"
"\x6e\x6f\x74\x20\x66\x6f\x75\x6e\x64\x48\x65\x72\x72\x6f\x72\x4e"
@ -327,7 +327,7 @@ static void mergeResultsAllShards(std::vector<std::shared_ptr<VPackBuilder>> con
TRI_ASSERT(errorCounter.find(TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND) ==
errorCounter.end());
size_t realNotFound = 0;
resultBody->clear();
resultBody->openArray();
for (VPackValueLength currentIndex = 0; currentIndex < expectedResults; ++currentIndex) {
@ -336,7 +336,7 @@ static void mergeResultsAllShards(std::vector<std::shared_ptr<VPackBuilder>> con
VPackSlice oneRes = it->slice();
TRI_ASSERT(oneRes.isArray());
oneRes = oneRes.at(currentIndex);
int errorNum = TRI_ERROR_NO_ERROR;
VPackSlice errorNumSlice = oneRes.get(StaticStrings::ErrorNum);
if (errorNumSlice.isNumber()) {
@ -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");