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

mapreduce and aggregation with output don't work on rs to cluster upgrade

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0, 4.4.2
    • Affects Version/s: 4.5.1
    • Component/s: Querying
    • Fully Compatible
    • ALL
    • v4.4
      1. Set up a replica set
      2. Add some data
      3. Restart the replica set with --shardsvr
      4. Add the replica set to a sharded cluster
      5. Run a mapreduce with output on the primary directly
    • Query 2020-06-01, Query 2020-06-15, Query 2020-06-29, Query 2020-07-13, Query 2020-07-27, Query 2020-08-10

      DOCSP-10021 describe the basic steps followed on Atlas to upgrade from a replica set to a sharded cluster. SERVER-47701 adds a test to ensure this process works, however, the mapreduce and aggregation commands with output don't work when connected to the primary MongoD directly, they fail with a similar error:

       uncaught exception: Error: command failed: {
       	"operationTime" : Timestamp(1589285086, 3),
       	"ok" : 0,
       	"errmsg" : "MapReduce internal error :: caused by :: don't know dbVersion for database test",
       	"code" : 249,
       	"codeName" : "StaleDbVersion",
       	"db" : "test",
       	"vReceived" : {
       		"uuid" : UUID("f4c5c7df-b0bc-4401-a1b4-98135ec255bf"),
       		"lastMod" : 1
       	},
       	"$gleStats" : {
       		"lastOpTime" : {
       			"ts" : Timestamp(1589285085, 4),
       			"t" : NumberLong(2)
       		},
       		"electionId" : ObjectId("7fffffff0000000000000002")
       	},
       	"lastCommittedOpTime" : Timestamp(1589285086, 3),
       	"$configServerState" : {
       		"opTime" : {
       			"ts" : Timestamp(1589285086, 1),
       			"t" : NumberLong(1)
       		}
       	},
       	"$clusterTime" : {
       		"clusterTime" : Timestamp(1589285086, 3),
       		"signature" : {
       			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
       			"keyId" : NumberLong(0)
       		}
       	}
       }
      

      And it looks like it fails while doing a listCollections:

      d20020| 2020-05-12T14:19:53.932+02:00 D2 COMMAND  [conn35] About to run the command{"db":"test","commandArgs":{"listCollections":1,"filter":{"name":"mrOutput"},"databaseVersion":{"uuid":{"$uuid":"110b9724-a042-4c7d-85aa-2a9dfcc31c0d"},"lastMod":1},"$clusterTime":{"clusterTime":{"$timestamp":{"t":1589285993,"i":4}},"signature":{"hash":{"$binary":{"base64":"PkCmXSWB1yC5LPJZOPOYdjkFbt0=","subType":"0"}},"keyId":6825931235076866061}},"$configServerState":{"opTime":{"ts":{"$timestamp":{"t":1589285992,"i":8}},"t":1}},"$db":"test"}}
      d20020| 2020-05-12T14:19:53.933+02:00 W  -        [conn35] DBException thrown{"error":{"code":249,"codeName":"StaleDbVersion","errmsg":"don't know dbVersion for database test","db":"test","vReceived":{"uuid":{"$uuid":"110b9724-a042-4c7d-85aa-2a9dfcc31c0d"},"lastMod":1}}}
      

      With the following stacktrace:

      ...
      mongo::uassertedWithLocation+0x315 [.../src/mongo/util/assert_util.cpp @ 256]
      <lambda_e2366172eb6715dc0c9d847effa7a2b3>::operator()+0x25C [.../src/mongo/db/s/database_sharding_state.cpp @ 149]
      mongo::DatabaseShardingState::checkDbVersion+0x2A0 [.../src/mongo/db/s/database_sharding_state.cpp @ 149]
      mongo::AutoGetDb::AutoGetDb+0x156 [.../src/mongo/db/catalog_raii.cpp @ 54]
      mongo::`anonymous namespace'::CmdListCollections::run+0x63B [.../src/mongo/db/commands/list_collections.cpp @ 292]
      mongo::BasicCommand::runWithReplyBuilder+0xAA [.../src/mongo/db/commands.h @ 807]
      mongo::BasicCommandWithReplyBuilderInterface::Invocation::run+0x178 [.../src/mongo/db/commands.cpp @ 770]
      mongo::CommandHelpers::runCommandInvocation+0xDC [.../src/mongo/db/commands.cpp @ 186]
      ...
      

            Assignee:
            bernard.gorman@mongodb.com Bernard Gorman
            Reporter:
            marcos.grillo@mongodb.com Marcos José Grillo Ramirez
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: