| 1393 | REGISTER_TASKFUNC(BackupRangeTaskFunc); |
| 1394 | |
| 1395 | struct BackupSnapshotDispatchTask : BackupTaskFuncBase { |
| 1396 | static StringRef name; |
| 1397 | static constexpr uint32_t version = 1; |
| 1398 | |
| 1399 | static struct { |
| 1400 | // Set by Execute, used by Finish |
| 1401 | static TaskParam<int64_t> shardsBehind() { return LiteralStringRef(__FUNCTION__); } |
| 1402 | // Set by Execute, used by Finish |
| 1403 | static TaskParam<bool> snapshotFinished() { return LiteralStringRef(__FUNCTION__); } |
| 1404 | // Set by Execute, used by Finish |
| 1405 | static TaskParam<Version> nextDispatchVersion() { return LiteralStringRef(__FUNCTION__); } |
| 1406 | } Params; |
| 1407 | |
| 1408 | StringRef getName() const override { return name; }; |
| 1409 | |
| 1410 | Future<Void> execute(Database cx, |
| 1411 | Reference<TaskBucket> tb, |
| 1412 | Reference<FutureBucket> fb, |
| 1413 | Reference<Task> task) override { |
| 1414 | return _execute(cx, tb, fb, task); |
| 1415 | }; |
| 1416 | Future<Void> finish(Reference<ReadYourWritesTransaction> tr, |
| 1417 | Reference<TaskBucket> tb, |
| 1418 | Reference<FutureBucket> fb, |
| 1419 | Reference<Task> task) override { |
| 1420 | return _finish(tr, tb, fb, task); |
| 1421 | }; |
| 1422 | |
| 1423 | ACTOR static Future<Key> addTask(Reference<ReadYourWritesTransaction> tr, |
| 1424 | Reference<TaskBucket> taskBucket, |
| 1425 | Reference<Task> parentTask, |
| 1426 | int priority, |
| 1427 | TaskCompletionKey completionKey, |
| 1428 | Reference<TaskFuture> waitFor = Reference<TaskFuture>(), |
| 1429 | Version scheduledVersion = invalidVersion) { |
| 1430 | Key key = wait(addBackupTask( |
| 1431 | name, |
| 1432 | version, |
| 1433 | tr, |
| 1434 | taskBucket, |
| 1435 | completionKey, |
| 1436 | BackupConfig(parentTask), |
| 1437 | waitFor, |
| 1438 | [=](Reference<Task> task) { |
| 1439 | if (scheduledVersion != invalidVersion) |
| 1440 | ReservedTaskParams::scheduledVersion().set(task, scheduledVersion); |
| 1441 | }, |
| 1442 | priority)); |
| 1443 | return key; |
| 1444 | } |
| 1445 | |
| 1446 | enum DispatchState { SKIP = 0, DONE = 1, NOT_DONE_MIN = 2 }; |
| 1447 | |
| 1448 | ACTOR static Future<Void> _execute(Database cx, |
| 1449 | Reference<TaskBucket> taskBucket, |
| 1450 | Reference<FutureBucket> futureBucket, |
| 1451 | Reference<Task> task) { |
| 1452 | state Reference<FlowLock> lock(new FlowLock(CLIENT_KNOBS->BACKUP_LOCK_BYTES)); |
nothing calls this directly
no test coverage detected