Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-101043

Fix the list of collections to move returned by removeShard

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • CAR Team 2025-02-17, CAR Team 2025-03-03
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            silvia.surroca@mongodb.com Silvia Surroca
            Reporter:
            silvia.surroca@mongodb.com Silvia Surroca
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: