Revert "SERVER-120914 UnshardCollection now fails with NamespaceNotSharded for untracked collections (#49130)" (#49219)
Co-authored-by: auto-revert-processor <devprod-si-team@mongodb.com> GitOrigin-RevId: c9a2e7dd02bb7055136848a0dbd7cdb9a262bfb7
This commit is contained in:
committed by
MongoDB Bot
parent
8ceb6ed988
commit
6bc0d4cba2
@@ -149,8 +149,6 @@ last-continuous:
|
||||
ticket: SERVER-112273
|
||||
- test_file: jstests/replsets/retryable_write_interrupted_on_stepdown.js
|
||||
ticket: SERVER-110728
|
||||
- test_file: jstests/sharding/unshard_collection_basic.js
|
||||
ticket: SERVER-120914
|
||||
suites: null
|
||||
last-lts:
|
||||
all:
|
||||
@@ -798,6 +796,4 @@ last-lts:
|
||||
ticket: SERVER-112273
|
||||
- test_file: jstests/replsets/retryable_write_interrupted_on_stepdown.js
|
||||
ticket: SERVER-110728
|
||||
- test_file: jstests/sharding/unshard_collection_basic.js
|
||||
ticket: SERVER-120914
|
||||
suites: null
|
||||
|
||||
@@ -49,7 +49,7 @@ const unshardedCollName = "foo_unsharded";
|
||||
const unshardedCollNS = dbName + "." + unshardedCollName;
|
||||
assert.commandWorked(st.s.getDB(dbName).runCommand({create: unshardedCollName}));
|
||||
let res = mongos.adminCommand({unshardCollection: unshardedCollNS});
|
||||
assert.commandFailedWithCode(res, ErrorCodes.NamespaceNotSharded);
|
||||
assert.commandFailedWithCode(res, [ErrorCodes.NamespaceNotFound, ErrorCodes.NamespaceNotSharded]);
|
||||
|
||||
jsTest.log("Verify unshardCollection succeeds with explicit toShard option");
|
||||
let coll = mongos.getDB(dbName)[collName];
|
||||
|
||||
@@ -149,21 +149,6 @@ ExecutorFuture<void> ReshardCollectionCoordinator::_runImpl(
|
||||
Grid::get(opCtx)->catalogCache()->getCollectionPlacementInfoWithRefresh(opCtx,
|
||||
nss()));
|
||||
|
||||
// For unshardCollection on untracked collections that exist locally, return
|
||||
// NamespaceNotSharded. Non-existent collections fall through to NamespaceNotFound
|
||||
// below. Tracked-unsplittable collections are handled downstream for idempotency.
|
||||
if (resharding::isUnshardCollection(_doc.getProvenance()) && !cmOld.hasRoutingTable()) {
|
||||
auto coll = acquireCollectionMaybeLockFree(
|
||||
opCtx,
|
||||
CollectionAcquisitionRequest::fromOpCtx(
|
||||
opCtx, nss(), AcquisitionPrerequisites::kRead));
|
||||
if (coll.exists()) {
|
||||
uasserted(ErrorCodes::NamespaceNotSharded,
|
||||
str::stream() << "Collection '" << nss().toStringForErrorMsg()
|
||||
<< "' is not sharded.");
|
||||
}
|
||||
}
|
||||
|
||||
uassert(ErrorCodes::NamespaceNotFound,
|
||||
str::stream() << "Collection '" << nss().toStringForErrorMsg()
|
||||
<< "' not found in cluster catalog",
|
||||
|
||||
Reference in New Issue
Block a user