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

system.js can be sharded via rename

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • None
    • None
    • ALL
    • Sharding EMEA 2022-06-13, Sharding EMEA 2022-06-27
    • 3

    Description

      Currently, the system.js collection has the following semantics:

      1. It cannot be dropped
      2. It cannot be sharded
      3. It CAN be renamed
      4. Another collection can be renamed to system.js as long as it doesn't require dropping an existing system.js

      Despite rule (2), it is possible to create a sharded system.js via rename because of (4):

      mongos> sh.enableSharding("test")
      mongos> sh.shardCollection("test.testing", {_id: "hashed"})
      mongos> db.testing.renameCollection("system.js")
      {
      	"ok" : 1,
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1647059453, 59),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	},
      	"operationTime" : Timestamp(1647059453, 53)
      }
      mongos> sh.status()
      --- Sharding Status ---
        ...
        databases:
              {  "_id" : "config",  "primary" : "config",  "partitioned" : true }
              {  "_id" : "test",  "primary" : "shard02",  "partitioned" : true,  "version" : {  "uuid" : UUID("2458a8d6-d249-4abd-80bd-104febddd0ac"),  "timestamp" : Timestamp(1647059429, 1),  "lastMod" : 1 } }
                      test.system.js
                              shard key: { "_id" : "hashed" }
                              unique: false
                              balancing: true
                              chunks:
                                      shard01	2
                                      shard02	2
                              { "_id" : { "$minKey" : 1 } } -->> { "_id" : NumberLong("-4611686018427387902") } on : shard01 Timestamp(1, 0)
                              { "_id" : NumberLong("-4611686018427387902") } -->> { "_id" : NumberLong(0) } on : shard01 Timestamp(1, 1)
                              { "_id" : NumberLong(0) } -->> { "_id" : NumberLong("4611686018427387902") } on : shard02 Timestamp(1, 2)
                              { "_id" : NumberLong("4611686018427387902") } -->> { "_id" : { "$maxKey" : 1 } } on : shard02 Timestamp(1, 4)
      

      We should disallow this, and probably reconsider whether we want to ban renaming of system.js entirely.

      Attachments

        Issue Links

          Activity

            People

              enrico.golfieri@mongodb.com Enrico Golfieri
              bernard.gorman@mongodb.com Bernard Gorman
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: