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

explain_missing_collection.js fails when database doesn't exist

    • Fully Compatible
    • Sharding 2022-08-08, Sharding 2022-08-22

      If no jstest ran before it, the database test will not exist when explain_missing_collection.js is run, since a previous test will not have created the database as a part of creating some other collection. This will cause the explain to fail:

      [js_test:explain_missing_collection] Implicit session: session { "id" : UUID("4a1e56e2-7511-433a-a11b-81fc6009e44e") }
      [js_test:explain_missing_collection] MongoDB server version: 6.0.0-rc13
      [js_test:explain_missing_collection] uncaught exception: Error: explain failed: {
      [js_test:explain_missing_collection] 	"ok" : 0,
      [js_test:explain_missing_collection] 	"errmsg" : "database test not found",
      [js_test:explain_missing_collection] 	"code" : 26,
      [js_test:explain_missing_collection] 	"codeName" : "NamespaceNotFound",
      [js_test:explain_missing_collection] 	"$clusterTime" : {
      [js_test:explain_missing_collection] 		"clusterTime" : Timestamp(1658258619, 62),
      [js_test:explain_missing_collection] 		"signature" : {
      [js_test:explain_missing_collection] 			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      [js_test:explain_missing_collection] 			"keyId" : NumberLong(0)
      [js_test:explain_missing_collection] 		}
      [js_test:explain_missing_collection] 	},
      [js_test:explain_missing_collection] 	"operationTime" : Timestamp(1658258619, 62)
      [js_test:explain_missing_collection] } :
      [js_test:explain_missing_collection] _getErrorWithCode@src/mongo/shell/utils.js:24:13
      [js_test:explain_missing_collection] throwOrReturn@src/mongo/shell/explainable.js:25:19
      [js_test:explain_missing_collection] constructor/this.finish@src/mongo/shell/explain_query.js:114:32
      [js_test:explain_missing_collection] @jstests/core/explain_missing_collection.js:15:56
      [js_test:explain_missing_collection] @jstests/core/explain_missing_collection.js:49:2
      [js_test:explain_missing_collection] failed to load: jstests/core/explain_missing_collection.js
      [js_test:explain_missing_collection] exiting with code -3
      

      You can use this suite to reproduce the problem:

      test_kind: js_test
      
      selector:
        roots:
        - jstests/core/explain_missing_collection.js
      
      executor:
        fixture:
          class: ShardedClusterFixture
          mongod_options:
            set_parameters:
              enableTestCommands: 1
          mongos_options:
            set_parameters:
              enableTestCommands: 1
          num_shards: 1
          num_rs_nodes_per_shard: 1
      

      I don't know if this is a problem with the test or mongos so I'm deferring that to the Sharding Team.

            Assignee:
            erin.liang@mongodb.com Erin Liang
            Reporter:
            vishnu.kaushik@mongodb.com Vishnu Kaushik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: