The removeShard command should not return those collections that can't be moved inside the list of `collectionsToMove`.
Therefore, we need to update the internal command removeShard uses to fetch the movable collections to:
db.aggregate([
{ $listClusterCatalog: { shards: true } },
{ $match: {
$and: [
{ sharded: false },
{ shards: '<shard_to_remove>' },
{ type: { $nin: ["timeseries","view"] } },
{ ns: { $not: { $regex: "^enxcol_\..*(\.esc|\.ecc|\.ecoc|\.ecoc\.compact)$" }}},
{ $or: [{ns: {$not: { $regex: "\.system\." }}}, {ns: {$regex: "\.system\.buckets\."}}]},
{ db: { $ne: 'config' } },
{ db: { $ne: 'admin' } }
]}},
{ $project: {
_id: 0,
ns: {
$cond: [
"$options.timeseries",
{
$replaceAll: {
input: "$ns",
find: ".system.buckets",
replacement: ""
}
},
"$ns"
]
}
}}
])
You'll find the reasoning behind every step in the proposal document attached to this Jira ticket.
- related to
-
SERVER-98655 Test when the removeShard command response reaches BSONObjMaxUserSize
-
- Closed
-
-
SERVER-99235 removeShard hint follow up task, fix test comment
-
- Closed
-
-
SERVER-89883 removeShard should hint about how to move data of tracked unsharded collections
-
- Closed
-
- links to