summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/getmore_cmd.cpp
diff options
context:
space:
mode:
authorMickey. J Winters <mickey.winters@mongodb.com>2023-04-22 20:39:49 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-22 22:19:19 +0000
commitbd7b3ee926b2cd488c0c71c4208d5737345f7ed8 (patch)
treea3e19c794ed19d0a29cae6eecbc3da4a8e90db3c /src/mongo/db/commands/getmore_cmd.cpp
parent5a018a8b6964fa4cf16260d7a940ed7fcc82e654 (diff)
downloadmongo-bd7b3ee926b2cd488c0c71c4208d5737345f7ed8.tar.gz
SERVER-75470 Reject change stream getMore commands after a split or merge has been committed
Diffstat (limited to 'src/mongo/db/commands/getmore_cmd.cpp')
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index 40e307e999c..796f4efd621 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -56,6 +56,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/speculative_majority_read_info.h"
+#include "mongo/db/repl/tenant_migration_access_blocker_util.h"
#include "mongo/db/service_context.h"
#include "mongo/db/stats/counters.h"
#include "mongo/db/stats/resource_consumption_metrics.h"
@@ -588,6 +589,12 @@ public:
curOp->setGenericCursor_inlock(cursorPin->toGenericCursor());
}
+ // If this is a change stream cursor, check whether the tenant has migrated elsewhere.
+ if (cursorPin->getExecutor()->getPostBatchResumeToken()["_data"]) {
+ tenant_migration_access_blocker::assertCanGetMoreChangeStream(opCtx,
+ _cmd.getDbName());
+ }
+
// If the 'failGetMoreAfterCursorCheckout' failpoint is enabled, throw an exception with
// the given 'errorCode' value, or ErrorCodes::InternalError if 'errorCode' is omitted.
failGetMoreAfterCursorCheckout.executeIf(