[SERVER-64458] system.js can be sharded via rename Created: 12/Mar/22  Updated: 27/Jun/22  Resolved: 23/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Bernard Gorman Assignee: Enrico Golfieri
Resolution: Duplicate Votes: 0
Labels: shardingemea-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-64491 Reconsider allowing the system.js col... Closed
Related
related to SERVER-64476 system.js fails to work seamlessly in... Closed
is related to SERVER-64491 Reconsider allowing the system.js col... Closed
Operating System: ALL
Sprint: Sharding EMEA 2022-06-13, Sharding EMEA 2022-06-27
Participants:
Story Points: 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.



 Comments   
Comment by Enrico Golfieri [ 23/Jun/22 ]

I can confirm the problem as been solved SERVER-64491

This ticket can be closed

Comment by Enrico Golfieri [ 22/Jun/22 ]

It looks like the problem has been already solved in the past.

I am not able to reproduce the error in a local cluster, do you think the ticket can be closed?

Comment by Louis Williams [ 14/Mar/22 ]

I think it's completely reasonable to ban renames on system.js. We ban renames and all user writes to system.views.

Generated at Thu Feb 08 06:00:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.