Revert "Fixed some dangling pointers"

This reverts commit 0c39006b07.
This commit is contained in:
sfc-gh-tclinkenbeard 2020-07-06 15:24:17 -07:00
parent af34b25cd1
commit e516a20c43
5 changed files with 13 additions and 20 deletions

View File

@ -3735,7 +3735,7 @@ int main(int argc, char* argv[]) {
f = stopAfter(
map(ba.abortRestore(db, KeyRef(tagName)), [tagName](FileBackupAgent::ERestoreState s) -> Void {
printf("RESTORE_ABORT Tag: %s State: %s\n", tagName.c_str(),
FileBackupAgent::restoreStateText(s).c_str());
FileBackupAgent::restoreStateText(s).toString().c_str());
return Void();
}));
break;

View File

@ -273,7 +273,7 @@ public:
/** RESTORE **/
enum ERestoreState { UNITIALIZED = 0, QUEUED = 1, STARTING = 2, RUNNING = 3, COMPLETED = 4, ABORTED = 5 };
static std::string restoreStateText(ERestoreState id);
static StringRef restoreStateText(ERestoreState id);
// parallel restore
Future<Void> parallelRestoreFinish(Database cx, UID randomUID, bool unlockDB = true);

View File

@ -87,22 +87,15 @@ const Key FileBackupAgent::keyLastRestorable = LiteralStringRef("last_restorable
// For convenience
typedef FileBackupAgent::ERestoreState ERestoreState;
std::string FileBackupAgent::restoreStateText(ERestoreState id) {
StringRef FileBackupAgent::restoreStateText(ERestoreState id) {
switch(id) {
case ERestoreState::UNITIALIZED:
return "unitialized";
case ERestoreState::QUEUED:
return "queued";
case ERestoreState::STARTING:
return "starting";
case ERestoreState::RUNNING:
return "running";
case ERestoreState::COMPLETED:
return "completed";
case ERestoreState::ABORTED:
return "aborted";
default:
return "Unknown";
case ERestoreState::UNITIALIZED: return LiteralStringRef("unitialized");
case ERestoreState::QUEUED: return LiteralStringRef("queued");
case ERestoreState::STARTING: return LiteralStringRef("starting");
case ERestoreState::RUNNING: return LiteralStringRef("running");
case ERestoreState::COMPLETED: return LiteralStringRef("completed");
case ERestoreState::ABORTED: return LiteralStringRef("aborted");
default: return LiteralStringRef("Unknown");
}
}
@ -3975,7 +3968,7 @@ public:
if(!current.present()) {
if(verbose)
printf("waitRestore: Tag: %s State: %s\n", tagName.toString().c_str(),
FileBackupAgent::restoreStateText(ERestoreState::UNITIALIZED).c_str());
FileBackupAgent::restoreStateText(ERestoreState::UNITIALIZED).toString().c_str());
return ERestoreState::UNITIALIZED;
}

View File

@ -92,7 +92,7 @@ public:
return defaultValue;
return get(task);
}
Key key;
StringRef key;
};
struct ReservedTaskParams {

View File

@ -286,7 +286,7 @@ struct GlobalState
serializer(ar, CLoad, CRun, CDelta, CId, COlIID);
}
Key key() const { return LiteralStringRef("GlobalState"); }
StringRef key() const { return LiteralStringRef("GlobalState"); }
};
const std::vector<std::string> syllables = {