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

GridFS should support sharding of the chunks collection with hashed shard keys

    • Sharding EMEA

      I have created a sharded cluster for use with GridFS.

      I would like to use a hashed shard key for the chunks to ensure the data is uniformly distributed across the cluster. When I try to use the filemd5 command to validate the files I receive an error saying the collection has to be indexed on the {{

      {files_id:1}

      or

      {files_id:1, n:1}

      }}.

      mongos> db.gridfs.chunks.runCommand( { filemd5 : ObjectId("51b535788544eb45b4cdaab5"), root : 'gridfs' } )
      {
          "ok" : 0,
          "errmsg" : "GridFS fs.chunks collection must be sharded on either {files_id:1} or {files_id:1, n:1}"
      }
      

      I think the set of acceptable indexes should be updated to include the hashed type.

      The stats() for the chunks collection is attached.

        1. gridfs-stats.txt
          2 kB
          Robert Moore

            Assignee:
            matt.panton@mongodb.com Matt Panton
            Reporter:
            robert.j.moore@allanbank.com Robert Moore
            Votes:
            8 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated:
              Resolved: