mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-22 04:59:34 +01:00
SERVER-84589 Update drop timeseries buckets collection error message (#18431)
GitOrigin-RevId: 09ed5a3568046863fc034463dfbd1a3fca074cd3
This commit is contained in:
parent
7e7c88c734
commit
7a921397c7
@ -569,6 +569,8 @@ last-continuous:
|
||||
ticket: SERVER-84151
|
||||
- test_file: jstests/core/timeseries/timeseries_collmod.js
|
||||
ticket: SERVER-83370
|
||||
- test_file: jstests/sharding/timeseries_drop.js
|
||||
ticket: SERVER-84589
|
||||
suites: null
|
||||
last-lts:
|
||||
all:
|
||||
@ -1196,4 +1198,6 @@ last-lts:
|
||||
ticket: SERVER-84151
|
||||
- test_file: jstests/core/timeseries/timeseries_collmod.js
|
||||
ticket: SERVER-83370
|
||||
- test_file: jstests/sharding/timeseries_drop.js
|
||||
ticket: SERVER-84589
|
||||
suites: null
|
||||
|
@ -37,6 +37,11 @@ function generateBatch(size) {
|
||||
}));
|
||||
}
|
||||
|
||||
function ensureCollectionExists(collName, db) {
|
||||
const collections = db.getCollectionNames();
|
||||
assert(collections.includes(collName), collections);
|
||||
}
|
||||
|
||||
function ensureCollectionDoesNotExist(collName) {
|
||||
const databases = [mainDB, st.shard0.getDB(dbName), st.shard1.getDB(dbName)];
|
||||
for (const db of databases) {
|
||||
@ -102,6 +107,12 @@ function runTest(getShardKey, performChunkSplit) {
|
||||
assert.eq(1, counts[otherShard.shardName], counts);
|
||||
}
|
||||
|
||||
// Confirm it's illegal to directly drop the ticket-series buckets collection.
|
||||
assert.commandFailedWithCode(mainDB.runCommand({drop: `system.buckets.${collName}`}),
|
||||
ErrorCodes.IllegalOperation);
|
||||
ensureCollectionExists(collName, mainDB);
|
||||
ensureCollectionExists(`system.buckets.${collName}`, mainDB);
|
||||
|
||||
// Drop the time-series collection.
|
||||
assert(coll.drop());
|
||||
|
||||
@ -134,4 +145,4 @@ try {
|
||||
}
|
||||
} finally {
|
||||
st.stop();
|
||||
}
|
||||
}
|
||||
|
@ -101,8 +101,9 @@ public:
|
||||
try {
|
||||
const auto coll = Grid::get(opCtx)->catalogClient()->getCollection(opCtx, ns());
|
||||
|
||||
uassert(ErrorCodes::NotImplemented,
|
||||
"drop collection of a sharded time-series collection is not supported",
|
||||
uassert(ErrorCodes::IllegalOperation,
|
||||
"Sharded time-series buckets collections cannot be dropped directly; drop "
|
||||
"the logical namespace instead",
|
||||
!coll.getTimeseriesFields());
|
||||
} catch (ExceptionFor<ErrorCodes::NamespaceNotFound>&) {
|
||||
// The collection is not sharded or doesn't exist.
|
||||
|
Loading…
Reference in New Issue
Block a user