summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/tenant_migration_recipient_service.h
diff options
context:
space:
mode:
authorJason Chan <jason.chan@mongodb.com>2021-02-17 20:11:31 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-24 17:49:12 +0000
commit275bc8977cfd8845cb4773d639504698cd99de90 (patch)
treeb9be23d4c09f420adceb4db8bb72ccf306813182 /src/mongo/db/repl/tenant_migration_recipient_service.h
parent686dc9a29c3444759d538c3e0055f66dba4031d9 (diff)
downloadmongo-275bc8977cfd8845cb4773d639504698cd99de90.tar.gz
SERVER-52719 Restart TenantMigrationRecipientService future chain on donor failurer4.9.0-alpha5
Diffstat (limited to 'src/mongo/db/repl/tenant_migration_recipient_service.h')
-rw-r--r--src/mongo/db/repl/tenant_migration_recipient_service.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/mongo/db/repl/tenant_migration_recipient_service.h b/src/mongo/db/repl/tenant_migration_recipient_service.h
index 504fffb0596..fde90d1327a 100644
--- a/src/mongo/db/repl/tenant_migration_recipient_service.h
+++ b/src/mongo/db/repl/tenant_migration_recipient_service.h
@@ -209,14 +209,16 @@ public:
case kRunning:
return newState == kInterrupted || newState == kDone;
case kInterrupted:
- return newState == kDone;
+ return newState == kDone || newState == kRunning;
case kDone:
return false;
}
MONGO_UNREACHABLE;
}
- void setState(StateFlag state, boost::optional<Status> interruptStatus = boost::none) {
+ void setState(StateFlag state,
+ boost::optional<Status> interruptStatus = boost::none,
+ bool isExternalInterrupt = false) {
invariant(checkIfValidTransition(state),
str::stream() << "current state: " << toString(_state)
<< ", new state: " << toString(state));
@@ -230,6 +232,16 @@ public:
_state = state;
_interruptStatus = (interruptStatus) ? interruptStatus.get() : _interruptStatus;
+ _isExternalInterrupt = isExternalInterrupt;
+ }
+
+ void clearInterruptStatus() {
+ _interruptStatus = Status{ErrorCodes::InternalError, "Uninitialized value"};
+ _isExternalInterrupt = false;
+ }
+
+ bool isExternalInterrupt() const {
+ return (_state == kInterrupted) && _isExternalInterrupt;
}
bool isNotStarted() const {
@@ -276,6 +288,9 @@ public:
// task interrupt status. Set to Status::OK() only when the recipient service has not
// been interrupted so far, and is used to remember the initial interrupt error.
Status _interruptStatus = Status::OK();
+ // Indicates if the task was interrupted externally due to a 'recipientForgetMigration'
+ // or stepdown/shutdown.
+ bool _isExternalInterrupt = false;
};
/*
@@ -495,6 +510,8 @@ public:
std::unique_ptr<TenantMigrationSharedData> _sharedData; // (S)
// Indicates whether the main task future continuation chain state kicked off by run().
TaskState _taskState; // (M)
+ // Used to indicate whether the migration is able to be retried on fetcher error.
+ boost::optional<Status> _oplogFetcherStatus; // (M)
// Promise that is resolved when the state document is initialized and persisted.
SharedPromise<void> _stateDocPersistedPromise; // (W)