[SERVER-74750] reshardCollection allowed on config.system.sessions via mongos with config shard Created: 10/Mar/23  Updated: 29/Oct/23  Resolved: 03/Apr/23

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

Type: Bug Priority: Major - P3
Reporter: James Wahlin Assignee: Wenqin Ye
Resolution: Fixed Votes: 0
Labels: skunkelodeon-odcs
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding NYC
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

1) Setup a 2 shard config shard cluster

2) Run the following command via mongos

db.adminCommand({reshardCollection: "config.system.sessions", key: {uid: 1}, numInitialChunks: 2})  

Sprint: Sharding NYC 2023-04-03, Sharding NYC 2023-04-17
Participants:

 Description   

On CSRS, an attempt to run reshardCollection on config.system.sessions fails:

mongos> db.adminCommand({reshardCollection: "config.system.sessions", key: {uid: 1}, numInitialChunks: 2})
{
	"ok" : 0,
	"errmsg" : "Cannot accept sharding commands if not started with --shardsvr",
	"code" : 193,
	"codeName" : "NoShardingEnabled",
	"$clusterTime" : {
		"clusterTime" : Timestamp(1678464167, 1),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	},
	"operationTime" : Timestamp(1678464167, 1)
} 

With a config shard configuration, it is allowed and appears to hang:

mongos> db.adminCommand({reshardCollection: "config.system.sessions", key: {uid: 1}, numInitialChunks: 2}) 

The following log messages are printed every 10 seconds in the config shard mongod.log file. Note the balancer error: "Unable to enforce zone range policy for collection" / "Expected collection config.system.resharding.edad0981-4f37-4de4-a52c-1a1b117a5ac9 to be sharded"

{"t":{"$date":"2023-03-10T11:06:37.536-05:00"},"s":"I",  "c":"SH_REFR",  "id":4619902, "ctx":"CatalogCache-4","msg":"Collection has found to be unsharded after refresh","attr":{"namespace":"config.system.resharding.edad0981-4f37-4de4-a52c-1a1b117a5ac9","durationMillis":0}}
{"t":{"$date":"2023-03-10T11:06:37.536-05:00"},"s":"W",  "c":"SHARDING", "id":21852,   "ctx":"Balancer","msg":"Unable to enforce zone range policy for collection","attr":{"namespace":"config.system.resharding.edad0981-4f37-4de4-a52c-1a1b117a5ac9","error":{"code":118,"codeName":"NamespaceNotSharded","errmsg":"Expected collection config.system.resharding.edad0981-4f37-4de4-a52c-1a1b117a5ac9 to be sharded"}}}
{"t":{"$date":"2023-03-10T11:06:37.539-05:00"},"s":"I",  "c":"SH_REFR",  "id":4619901, "ctx":"CatalogCache-4","msg":"Refreshed cached collection","attr":{"namespace":"config.system.sessions","lookupSinceVersion":"1|1029||640a3ba7530410d994f8fe59||Timestamp(1678392231, 9)","newVersion":"{ chunkVersion: { e: ObjectId('640a3ba7530410d994f8fe59'), t: Timestamp(1678392231, 9), v: Timestamp(1, 1029) }, forcedRefreshSequenceNum: 7839, epochDisambiguatingSequenceNum: 7840 }","timeInStore":"{ chunkVersion: \"None\", forcedRefreshSequenceNum: 7838, epochDisambiguatingSequenceNum: 7839 }","durationMillis":2}}
{"t":{"$date":"2023-03-10T11:06:37.550-05:00"},"s":"I",  "c":"SH_REFR",  "id":4619901, "ctx":"CatalogCache-4","msg":"Refreshed cached collection","attr":{"namespace":"config.system.sessions","lookupSinceVersion":"1|1029||640a3ba7530410d994f8fe59||Timestamp(1678392231, 9)","newVersion":"{ chunkVersion: { e: ObjectId('640a3ba7530410d994f8fe59'), t: Timestamp(1678392231, 9), v: Timestamp(1, 1029) }, forcedRefreshSequenceNum: 7841, epochDisambiguatingSequenceNum: 7842 }","timeInStore":"{ chunkVersion: \"None\", forcedRefreshSequenceNum: 7840, epochDisambiguatingSequenceNum: 7841 }","durationMillis":1}}



 Comments   
Comment by Githook User [ 03/Apr/23 ]

Author:

{'name': 'wenqinYe', 'email': 'wenqin908@gmail.com', 'username': 'wenqinYe'}

Message: SERVER-74750: reshardCollection allowed on config.system.sessions via mongos with config shard
Branch: master
https://github.com/mongodb/mongo/commit/6b01fb7c8a988fc296c4291f124638f4091f286f

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