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

db.stats reports different replicaset information for shard after rs.remove

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.2.2
    • Component/s: Admin
    • Labels:
      None
    • Environment:
      Tested on Mac also reported on linux
    • Fully Compatible
    • ALL

      After removing a replicaset member from a sharded server setup, db.stats continues to report the old replicaset information for the shard.

      Initially reported here: https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/jRmxV0rujvc

      mongos> use test
      switched to db test
      mongos> db.stats()
      {
         "raw" : {
            "s01/localhost:10010,localhost:10020,localhost:10030" : {
               "db" : "test",
               "collections" : 0,
               "objects" : 0,
               "avgObjSize" : 0,
               "dataSize" : 0,
               "storageSize" : 0,
               "numExtents" : 0,
               "indexes" : 0,
               "indexSize" : 0,
               "fileSize" : 0,
               "nsSizeMB" : 0,
               "ok" : 1
            }
         },
         "objects" : 0,
         "avgObjSize" : NaN,
         "dataSize" : 0,
         "storageSize" : 0,
         "numExtents" : 0,
         "indexes" : 0,
         "indexSize" : 0,
         "fileSize" : 0,
         "ok" : 1
      }
      mongos> sh.status()
      --- Sharding Status ---
        sharding version: { "_id" : 1, "version" : 3 }
        shards:
         {  "_id" : "s01",  "host" : "s01/localhost:10010,localhost:10020,localhost:10030" }
         {  "_id" : "s02",  "host" : "s02/localhost:20010,localhost:20020,localhost:20030" }
        databases:
         {  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }
         {  "_id" : "test",  "partitioned" : true,  "primary" : "s01" }
      
      mongos>
      bye
      
      08:22:20 [jlee@Jeffs-MacBook-Air.local] - /Users/jlee
      $ mongo localhost:10010/admin --eval "rs.remove('localhost:10030')"
      MongoDB shell version: 2.2.2
      connecting to: localhost:10010/admin
      Tue Jan 29 08:22:55 DBClientCursor::init call() failed
      Tue Jan 29 08:22:55 query failed : admin.$cmd { replSetReconfig: { _id: "s01", version: 2, members: [ { _id: 0, host: "localhost:10010" }, { _id: 1, host: "localhost:10020" } ] } } to: localhost:10010
      Tue Jan 29 08:22:55 Error: error doing query: failed src/mongo/shell/collection.js:155
      
      08:22:55 [jlee@Jeffs-MacBook-Air.local] - /Users/jlee
      $ mongo
      MongoDB shell version: 2.2.2
      connecting to: test
      mongos> sh.status()
      --- Sharding Status ---
        sharding version: { "_id" : 1, "version" : 3 }
        shards:
         {  "_id" : "s01",  "host" : "s01/localhost:10010,localhost:10020" }
         {  "_id" : "s02",  "host" : "s02/localhost:20010,localhost:20020,localhost:20030" }
        databases:
         {  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }
         {  "_id" : "test",  "partitioned" : true,  "primary" : "s01" }
      
      mongos> db.stats()
      {
         "raw" : {
            "s01/localhost:10010,localhost:10020,localhost:10030" : {
               "db" : "test",
               "collections" : 0,
               "objects" : 0,
               "avgObjSize" : 0,
               "dataSize" : 0,
               "storageSize" : 0,
               "numExtents" : 0,
               "indexes" : 0,
               "indexSize" : 0,
               "fileSize" : 0,
               "nsSizeMB" : 0,
               "ok" : 1
            }
         },
         "objects" : 0,
         "avgObjSize" : NaN,
         "dataSize" : 0,
         "storageSize" : 0,
         "numExtents" : 0,
         "indexes" : 0,
         "indexSize" : 0,
         "fileSize" : 0,
         "ok" : 1
      }
      

            Assignee:
            daniel.alabi@10gen.com Daniel Alabi
            Reporter:
            jlee Jeff lee
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: