summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/global_index/global_index_cloner_fetcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/global_index/global_index_cloner_fetcher.cpp')
-rw-r--r--src/mongo/db/s/global_index/global_index_cloner_fetcher.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/s/global_index/global_index_cloner_fetcher.cpp b/src/mongo/db/s/global_index/global_index_cloner_fetcher.cpp
index b67dfc4c717..e8421758f8f 100644
--- a/src/mongo/db/s/global_index/global_index_cloner_fetcher.cpp
+++ b/src/mongo/db/s/global_index/global_index_cloner_fetcher.cpp
@@ -156,6 +156,10 @@ GlobalIndexClonerFetcher::GlobalIndexClonerFetcher(NamespaceString nss,
boost::optional<GlobalIndexClonerFetcher::FetchedEntry> GlobalIndexClonerFetcher::getNext(
OperationContext* opCtx) {
+ if (!_pipeline) {
+ _pipeline = _restartPipeline(opCtx);
+ }
+
_pipeline->reattachToOperationContext(opCtx);
ON_BLOCK_EXIT([this] { _pipeline->detachFromOperationContext(); });
@@ -164,10 +168,6 @@ boost::optional<GlobalIndexClonerFetcher::FetchedEntry> GlobalIndexClonerFetcher
_pipeline.reset();
});
- if (!_pipeline) {
- _pipeline = _restartPipeline(opCtx);
- }
-
auto next = _pipeline->getNext();
guard.dismiss();