Details
-
Bug
-
Resolution: Duplicate
-
Major - P3
-
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:
- It cannot be dropped
- It cannot be sharded
- It CAN be renamed
- 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
- duplicates
-
SERVER-64491 Reconsider allowing the system.js collection to be renamed
-
- Closed
-
- is related to
-
SERVER-64491 Reconsider allowing the system.js collection to be renamed
-
- Closed
-
- related to
-
SERVER-64476 system.js fails to work seamlessly in sharded collections
-
- Closed
-