diff options
author | Yoonsoo Kim <yoonsoo.kim@mongodb.com> | 2022-10-29 02:20:12 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-29 02:51:13 +0000 |
commit | ab34541c92e3ee679ea155b6331253a4e031d451 (patch) | |
tree | 8e694ab20f5dd8681290afe62ec209cc13fd3f82 /src/mongo/db/clientcursor.cpp | |
parent | ad79c681888c4f470c9d3cd8b6feeae221b7e75b (diff) | |
download | mongo-ab34541c92e3ee679ea155b6331253a4e031d451.tar.gz |
SERVER-69687 Add $_externalDataSources aggregate command option
Diffstat (limited to 'src/mongo/db/clientcursor.cpp')
-rw-r--r-- | src/mongo/db/clientcursor.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp index 2a471eb1288..c9994c1ea7f 100644 --- a/src/mongo/db/clientcursor.cpp +++ b/src/mongo/db/clientcursor.cpp @@ -40,6 +40,7 @@ #include "mongo/db/auth/privilege.h" #include "mongo/db/client.h" #include "mongo/db/commands.h" +#include "mongo/db/commands/external_data_source_scope_guard.h" #include "mongo/db/commands/server_status.h" #include "mongo/db/commands/server_status_metric.h" #include "mongo/db/curop.h" @@ -65,6 +66,10 @@ static CounterMetric cursorStatsTimedOut{"cursor.timedOut"}; static CounterMetric cursorStatsTotalOpened{"cursor.totalOpened"}; static CounterMetric cursorStatsMoreThanOneBatch{"cursor.moreThanOneBatch"}; +const ClientCursor::Decoration<std::shared_ptr<ExternalDataSourceScopeGuard>> + ExternalDataSourceScopeGuard::get = + ClientCursor::declareDecoration<std::shared_ptr<ExternalDataSourceScopeGuard>>(); + ClientCursor::ClientCursor(ClientCursorParams params, CursorId cursorId, OperationContext* operationUsingCursor, @@ -133,6 +138,9 @@ void ClientCursor::dispose(OperationContext* opCtx) { } _exec->dispose(opCtx); + // Update opCtx of the decorated ExternalDataSourceScopeGuard object so that it can drop virtual + // collections in the new 'opCtx'. + ExternalDataSourceScopeGuard::updateOperationContext(this, opCtx); _disposed = true; } |