increase retry and use eat instead of parsing

This commit is contained in:
sramamoorthy 2019-04-29 15:24:19 -07:00 committed by Alex Miller
parent 6f42337c09
commit 591ff96b93
2 changed files with 10 additions and 16 deletions

View File

@ -3315,8 +3315,14 @@ ACTOR Future<Void> snapCreate(Database inputCx, StringRef snapCmd, UID snapUID)
.detail("UID", snapUID)
.detail("PreSnapClientUID", preSnapClientUID);
tr.debugTransaction(snapUID);
StringRef snapCmdArgs = snapCmd;
StringRef snapCmdPart = snapCmdArgs.eat(":");
state Standalone<StringRef> snapUIDRef(snapUID.toString());
state Standalone<StringRef> snapPayloadRef = snapCmdPart
.withSuffix(LiteralStringRef(":uid="))
.withSuffix(snapUIDRef)
.withSuffix(LiteralStringRef(","))
.withSuffix(snapCmdArgs);
state Standalone<StringRef>
tLogCmdPayloadRef = LiteralStringRef("empty-binary:uid=").withSuffix(snapUIDRef);
// disable popping of TLog
@ -3335,19 +3341,6 @@ ACTOR Future<Void> snapCreate(Database inputCx, StringRef snapCmd, UID snapUID)
TraceEvent("SnapCreateAfterLockingTLogs").detail("UID", snapUID);
const uint8_t* ptr = snapCmd.begin();
while (*ptr != ':' && ptr < snapCmd.end()) {
ptr++;
}
state Standalone<StringRef> snapPayloadRef;
if (ptr == snapCmd.end()) {
snapPayloadRef =
snapCmd.withSuffix(LiteralStringRef(":uid=")).withSuffix(snapUIDRef);
} else {
snapPayloadRef =
snapCmd.withSuffix(LiteralStringRef(",uid=")).withSuffix(snapUIDRef);
}
// snap the storage and Tlogs
// if we retry the below command in failure cases with the same snapUID
// then the snapCreate can end up creating multiple snapshots with

View File

@ -202,8 +202,9 @@ public: // workload functions
break;
} catch (Error& e) {
++retry;
TraceEvent(retry > 3 ? SevWarn : SevInfo, "SnapCreateCommandFailed").detail("Error", e.what());
if (retry > 3) {
TraceEvent(retry > 100 ? SevWarn : SevInfo, "SnapCreateCommandFailed").detail("Error", e.what());
if (retry > 100) {
TraceEvent(SevError, "SnapCreateCommandFailed").detail("Error", e.what());
throw operation_failed();
}
}