| 5079 | } |
| 5080 | |
| 5081 | ACTOR static Future<std::string> getStatus(FileBackupAgent* backupAgent, |
| 5082 | Database cx, |
| 5083 | ShowErrors showErrors, |
| 5084 | std::string tagName) { |
| 5085 | state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx)); |
| 5086 | state std::string statusText; |
| 5087 | |
| 5088 | loop { |
| 5089 | try { |
| 5090 | tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); |
| 5091 | tr->setOption(FDBTransactionOptions::LOCK_AWARE); |
| 5092 | |
| 5093 | state KeyBackedTag tag; |
| 5094 | state BackupConfig config; |
| 5095 | state EBackupState backupState; |
| 5096 | |
| 5097 | statusText = ""; |
| 5098 | tag = makeBackupTag(tagName); |
| 5099 | state Optional<UidAndAbortedFlagT> uidAndAbortedFlag = wait(tag.get(tr)); |
| 5100 | state Future<Optional<Value>> fPaused = tr->get(backupAgent->taskBucket->getPauseKey()); |
| 5101 | if (uidAndAbortedFlag.present()) { |
| 5102 | config = BackupConfig(uidAndAbortedFlag.get().first); |
| 5103 | EBackupState status = |
| 5104 | wait(config.stateEnum().getD(tr, Snapshot::False, EBackupState::STATE_NEVERRAN)); |
| 5105 | backupState = status; |
| 5106 | } |
| 5107 | |
| 5108 | if (!uidAndAbortedFlag.present() || backupState == EBackupState::STATE_NEVERRAN) { |
| 5109 | statusText += "No previous backups found.\n"; |
| 5110 | } else { |
| 5111 | state std::string backupStatus(BackupAgentBase::getStateText(backupState)); |
| 5112 | state Reference<IBackupContainer> bc; |
| 5113 | state Optional<Version> latestRestorableVersion; |
| 5114 | state Version recentReadVersion; |
| 5115 | |
| 5116 | wait(store(latestRestorableVersion, config.getLatestRestorableVersion(tr)) && |
| 5117 | store(bc, config.backupContainer().getOrThrow(tr)) && |
| 5118 | store(recentReadVersion, tr->getReadVersion())); |
| 5119 | |
| 5120 | bool snapshotProgress = false; |
| 5121 | |
| 5122 | switch (backupState) { |
| 5123 | case EBackupState::STATE_SUBMITTED: |
| 5124 | statusText += "The backup on tag `" + tagName + "' is in progress (just started) to " + |
| 5125 | bc->getURL() + ".\n"; |
| 5126 | break; |
| 5127 | case EBackupState::STATE_RUNNING: |
| 5128 | statusText += "The backup on tag `" + tagName + "' is in progress to " + bc->getURL() + ".\n"; |
| 5129 | snapshotProgress = true; |
| 5130 | break; |
| 5131 | case EBackupState::STATE_RUNNING_DIFFERENTIAL: |
| 5132 | statusText += "The backup on tag `" + tagName + "' is restorable but continuing to " + |
| 5133 | bc->getURL() + ".\n"; |
| 5134 | snapshotProgress = true; |
| 5135 | break; |
| 5136 | case EBackupState::STATE_COMPLETED: |
| 5137 | statusText += "The previous backup on tag `" + tagName + "' at " + bc->getURL() + |
| 5138 | " completed at version " + format("%lld", latestRestorableVersion.orDefault(-1)) + |
nothing calls this directly
no test coverage detected