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

listCollections fails on sharded collection after movePrimary is called

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 3.0.11, 3.2.9, 3.3.11
    • Sharding
    • None
    • Sharding
    • ALL

    Description

      Repro steps below, not a regression. Checked back to 3.0.x

      (function() {
          'use strict';
          var checkCollectionExists = function(coll) {
              var collArray = coll.getDB().runCommand("listCollections").cursor.firstBatch;
              var colls = collArray.filter(function(spec) { return spec.name === coll.getName(); });
              assert.eq(1, colls.length, tojson(collArray));
          }
       
          var st = new ShardingTest({shards: 2});
          var mongos = st.s;
          var configDb = st.s.getDB("config");
          var shard0 = st.shard0.shardName;
          var shard1 = st.shard1.shardName;
          var coll = mongos.getCollection('test.list_collections');
       
          assert.commandWorked(mongos.adminCommand({ enableSharding: coll.getDB() + ""}));
          assert.commandWorked(
              mongos.adminCommand({ shardCollection: coll + "", key: { "x" : 1 }}));
       
          jsTestLog("insert a single document into mycoll");
          assert.writeOK(coll.insert({ "x" : 1 }));
          checkCollectionExists(coll);
       
          jsTestLog("check that primary shard is " + shard0 + " then moving primary to " + shard1);
          assert.eq(1, configDb.databases.count({ "_id" : coll.getDB().getName(), "primary" : shard0 }));
          assert.commandWorked(mongos.adminCommand({ movePrimary: coll.getDB().getName(), to: shard1}));
          checkCollectionExists(coll);
       
          st.stop();
      })();
      

      Attachments

        Activity

          People

            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            dan@mongodb.com Daniel Pasette (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: