Bug fixes with transaction options and exception handling that were causing internal errors.
This commit is contained in:
parent
aeebe711ce
commit
eadf93826d
|
@ -1504,7 +1504,9 @@ namespace fileBackup {
|
|||
if(e.code() == error_code_actor_cancelled)
|
||||
throw;
|
||||
state Error err = e;
|
||||
Void _ = wait(config.logError(cx, err, format("Failed to write restorable metadata to `%s'", bc->getURL().c_str())));
|
||||
if(bc) {
|
||||
Void _ = wait(config.logError(cx, err, format("Failed to write restorable metadata to `%s'", bc->getURL().c_str())));
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
|
@ -2710,6 +2712,8 @@ public:
|
|||
try {
|
||||
Void _ = wait(timeoutError(bc->create(), 30));
|
||||
} catch(Error &e) {
|
||||
if(e.code() == error_code_actor_cancelled)
|
||||
throw;
|
||||
fprintf(stderr, "ERROR: Could not create backup container: %s\n", e.what());
|
||||
throw backup_error();
|
||||
}
|
||||
|
|
|
@ -306,13 +306,33 @@ public:
|
|||
}
|
||||
|
||||
ACTOR static Future<Void> extendTimeoutRepeatedly(Database cx, Reference<TaskBucket> taskBucket, Reference<Task> task) {
|
||||
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
|
||||
state Version versionNow = wait(runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr) {
|
||||
taskBucket->setOptions(tr);
|
||||
return map(tr->getReadVersion(), [=](Version v) {
|
||||
return v;
|
||||
});
|
||||
}));
|
||||
|
||||
loop {
|
||||
// Wait until we are half way to the timeout version of this task
|
||||
Version versionNow = wait((new ReadYourWritesTransaction(cx))->getReadVersion());
|
||||
Void _ = wait(delay(0.5 * (BUGGIFY ? (2 * g_random->random01()) : 1.0) * (double)(task->timeoutVersion - (uint64_t)versionNow) / CLIENT_KNOBS->CORE_VERSIONSPERSECOND));
|
||||
|
||||
// Attempt to extend the task's timeout
|
||||
Void _ = wait(taskBucket->extendTimeout(cx, task, false));
|
||||
loop {
|
||||
try {
|
||||
tr->reset();
|
||||
taskBucket->setOptions(tr);
|
||||
|
||||
// Attempt to extend the task's timeout
|
||||
state Version newTimeout = wait(taskBucket->extendTimeout(tr, task, false));
|
||||
Void _ = wait(tr->commit());
|
||||
task->timeoutVersion = newTimeout;
|
||||
versionNow = tr->getCommittedVersion();
|
||||
break;
|
||||
} catch(Error &e) {
|
||||
Void _ = wait(tr->onError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ public:
|
|||
Future<bool> valid = isVerified(tr, task);
|
||||
return map(success(finished) && success(valid), [=](Void) {
|
||||
if(finished.get() || !valid.get()) {
|
||||
throw task_interrupted();
|
||||
}
|
||||
return Void();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue