[SERVER-17912] Primary shard for a DB is assigned to last shard node Created: 07/Apr/15  Updated: 24/Apr/15  Resolved: 08/Apr/15

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

Type: Bug Priority: Major - P3
Reporter: Jonathan Abrahams Assignee: Jonathan Abrahams
Resolution: Cannot Reproduce Votes: 0
Labels: 32qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Tested
Operating System: ALL
Steps To Reproduce:

Scenario

  • 2 mongod shard nodes - s0 & s1
  • 1 mongod configsvr
  • 1 mongos
  • Connect to s0 via mongo shell
    • Insert in a collection on test2 DB
    • Insert in a collection on test3 DB
  • Connect to mongos via mongo shell
    • sh.addShard(<s0>)
    • sh.addShard(<s1>)
    • sh.enableSharding("test2")
    • sh.enableSharding("test3")
    • sh.enableSharding("test4")
    • sh.status()

The primary shard node for the DBs are

  • test2 - s0
  • test3 - s1
  • test4 - s1
Participants:

 Description   

If a database has been created on a shard node, before it's been sharded, the enabledSharding() will associate the primary shard to the last shard node in the cluster. This happens for all databases, except for the first one which is enabled.



 Comments   
Comment by Jonathan Abrahams [ 08/Apr/15 ]

Could not reproduce as originally described.

There is an assignment of the primary shard to a new DB, after sharding has been enabled, where it is always assigned to the same shard node, which may not be the other holding the DB. This is not the recommended method, as once sharding has been enabled, it is not recommended to directly connect to a shard node (mongod) to create new DBs and collections.

Comment by Jonathan Abrahams [ 07/Apr/15 ]

If the user then shards a collection, then the resulting chunk will be on the primary node, which does not hold the data. The data on the non-primary node is not visible via mongos.

Comment by Jonathan Abrahams [ 07/Apr/15 ]

Perhaps the primary should be the node which has the DB.

Generated at Thu Feb 08 03:45:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.