Added schema version string to backup JSON status docs. Bug fix in backup status JSON, the document was being created outside the transaction retry loop so retries would combine partial element sets across all tries into the result.

This commit is contained in:
Stephen Atherton 2019-03-14 02:10:14 -07:00
parent dbacfcbc82
commit c6edcc7f06
2 changed files with 6 additions and 4 deletions

View File

@ -165,6 +165,7 @@ std::string BackupDescription::toString() const {
std::string BackupDescription::toJSON() const {
JsonBuilderObject doc;
doc.setKey("SchemaVersion", "1.0.0");
doc.setKey("URL", url.c_str());
doc.setKey("Restorable", maxRestorableVersion.present());

View File

@ -3908,10 +3908,12 @@ public:
ACTOR static Future<std::string> getStatusJSON(FileBackupAgent* backupAgent, Database cx, std::string tagName) {
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
state JsonBuilderObject doc;
loop {
try {
state JsonBuilderObject doc;
doc.setKey("SchemaVersion", "1.0.0");
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
@ -4033,14 +4035,13 @@ public:
}
doc.setKey("Errors", errorList);
}
break;
return doc.getJson();
}
catch (Error &e) {
wait(tr->onError(e));
}
}
return doc.getJson();
}
ACTOR static Future<std::string> getStatus(FileBackupAgent* backupAgent, Database cx, bool showErrors, std::string tagName) {