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( f = stopAfter(
map(ba.abortRestore(db, KeyRef(tagName)), [tagName](FileBackupAgent::ERestoreState s) -> Void { map(ba.abortRestore(db, KeyRef(tagName)), [tagName](FileBackupAgent::ERestoreState s) -> Void {
printf("RESTORE_ABORT Tag: %s State: %s\n", tagName.c_str(), printf("RESTORE_ABORT Tag: %s State: %s\n", tagName.c_str(),
FileBackupAgent::restoreStateText(s).c_str()); FileBackupAgent::restoreStateText(s).toString().c_str());
return Void(); return Void();
})); }));
break; break;

View File

@ -273,7 +273,7 @@ public:
/** RESTORE **/ /** RESTORE **/
enum ERestoreState { UNITIALIZED = 0, QUEUED = 1, STARTING = 2, RUNNING = 3, COMPLETED = 4, ABORTED = 5 }; 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 // parallel restore
Future<Void> parallelRestoreFinish(Database cx, UID randomUID, bool unlockDB = true); 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 // For convenience
typedef FileBackupAgent::ERestoreState ERestoreState; typedef FileBackupAgent::ERestoreState ERestoreState;
std::string FileBackupAgent::restoreStateText(ERestoreState id) { StringRef FileBackupAgent::restoreStateText(ERestoreState id) {
switch(id) { switch(id) {
case ERestoreState::UNITIALIZED: case ERestoreState::UNITIALIZED: return LiteralStringRef("unitialized");
return "unitialized"; case ERestoreState::QUEUED: return LiteralStringRef("queued");
case ERestoreState::QUEUED: case ERestoreState::STARTING: return LiteralStringRef("starting");
return "queued"; case ERestoreState::RUNNING: return LiteralStringRef("running");
case ERestoreState::STARTING: case ERestoreState::COMPLETED: return LiteralStringRef("completed");
return "starting"; case ERestoreState::ABORTED: return LiteralStringRef("aborted");
case ERestoreState::RUNNING: default: return LiteralStringRef("Unknown");
return "running";
case ERestoreState::COMPLETED:
return "completed";
case ERestoreState::ABORTED:
return "aborted";
default:
return "Unknown";
} }
} }
@ -3975,7 +3968,7 @@ public:
if(!current.present()) { if(!current.present()) {
if(verbose) if(verbose)
printf("waitRestore: Tag: %s State: %s\n", tagName.toString().c_str(), 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; return ERestoreState::UNITIALIZED;
} }

View File

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

View File

@ -286,7 +286,7 @@ struct GlobalState
serializer(ar, CLoad, CRun, CDelta, CId, COlIID); 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 = { const std::vector<std::string> syllables = {