The MovePrimarySourceManager currently calls ShardingStateRecovery::endMetadataOp() if in state 'kCloneCompleted'.
This is probably an accident, since 'kCloneCompleted' state in the MigrationSourceManager and MovePrimarySourceManager represent different logical states:
enum State {
kCreated,
kCloning,
kCloneCaughtUp,
kCriticalSection,
kCloneCompleted,
kDone
};
enum State {
kCreated,
kCloning,
kCloneCompleted,
kCriticalSection,
kCommitted,
kNeedCleanStaleData,
kDone
};
We should rename the MovePrimarySourceManager's states to match the MigrationSourceManager's.