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

Explaning distinct command on non-existent database succeeds

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 8.0.0
    • Component/s: None
    • None
    • Query Execution
    • ALL
    • Hide

      Repro script:

      cat <<EOF > jstests/core/repro.js
      const coll = db.test;
      coll.drop();
      assert.commandWorked(db.runCommand({explain: {distinct: coll.getName(), key: "a"}}));
      EOF

       

      Running on replica sets ❌

      buildscripts/resmoke.py run --suite=replica_sets_jscore_passthrough jstests/core/repro.js 

      Running on sharded clusters ✅

      buildscripts/resmoke.py run --suite=sharding_jscore_passthrough jstests/core/repro.js  

      fails with the following:

          The following tests failed (with exit code):
              jstests/core/query/distinct/distinct_semantics.js (253 Failure executing JS file)
                  [FIRST Part of Exception]
                  uncaught exception: Error: command failed: {
                      "ok" : 0,
                      "errmsg" : "database test not found",
                      "code" : 26,
                      "codeName" : "NamespaceNotFound",
                      "$clusterTime" : {
                          "clusterTime" : Timestamp(1730290420, 98),
                          "signature" : {
                              "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                              "keyId" : NumberLong(0) 

       

       

      Show
      Repro script: cat <<EOF > jstests/core/repro.js const coll = db.test; coll.drop(); assert .commandWorked(db.runCommand({explain: {distinct: coll.getName(), key: "a" }})); EOF   Running on replica sets ❌ buildscripts/resmoke.py run --suite=replica_sets_jscore_passthrough jstests/core/repro.js Running on sharded clusters ✅ buildscripts/resmoke.py run --suite=sharding_jscore_passthrough jstests/core/repro.js fails with the following:     The following tests failed (with exit code):         jstests/core/query/distinct/distinct_semantics.js (253 Failure executing JS file)             [FIRST Part of Exception]             uncaught exception: Error: command failed: {                 "ok" : 0,                 "errmsg" : "database test not found" ,                 "code" : 26,                 "codeName" : "NamespaceNotFound" ,                 "$clusterTime" : {                     "clusterTime" : Timestamp(1730290420, 98),                     "signature" : {                         "hash" : BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA=" ),                         "keyId" : NumberLong(0)    

      Explaning distinct commands works on replica sets, but fails with 'database not found' on sharded environments. 

            Assignee:
            Unassigned Unassigned
            Reporter:
            catalin.sumanaru@mongodb.com Catalin Sumanaru
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: