[SERVER-69416] Mongos fails explain cmd when database doesn't exist Created: 02/Sep/22  Updated: 12/Dec/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Adi Zaimi Assignee: Backlog - Cluster Scalability
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Cluster Scalability
Participants:

 Description   

There is a difference in behavior between mongod and mongos when running explain command and db does not exist. 
Mongod returns the explain plan, whereas mongos return a "database not found" error. 
This can be seen in SERVER-68152 and https://jira.mongodb.org/browse/SERVER-68971 where explain_distinct.js fails when database doesn't exist:

 

[js_test:explain_distinct] assert: command failed: {
[js_test:explain_distinct] "ok" : 0,
[js_test:explain_distinct] "errmsg" : "database test not found",
[js_test:explain_distinct] "code" : 26,
[js_test:explain_distinct] "codeName" : "NamespaceNotFound",
[js_test:explain_distinct] "$clusterTime" : {
[js_test:explain_distinct] "clusterTime" : Timestamp(1660233344, 7),
[js_test:explain_distinct] "signature" :
{ [js_test:explain_distinct] "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), [js_test:explain_distinct] "keyId" : NumberLong(0) [js_test:explain_distinct] }
[js_test:explain_distinct] },
[js_test:explain_distinct] "operationTime" : Timestamp(1660233344, 7)
[js_test:explain_distinct] 

 

From:
https://evergreen.mongodb.com/lobster/build/88ee203b553c2020128ed292340a9d9d/test/62f5268154f2484378a8aab0#bookmarks=0%2C114



 Comments   
Comment by Adi Zaimi [ 14/Sep/22 ]

Thank you Max and Lingzhi for pointing out related tickets.
I will fix the test explain_distinct.js in SERVER-68971 and keep this ticket open for now and repurpose it to point out to Garaudy et al. that there is a difference in behavior between mongos and mongod in what we do in the explain command if db does not exist.

Comment by Max Hirschhorn [ 03/Sep/22 ]

adi.zaimi@mongodb.com, it looks like the similar issue for explain_distinct.js had come up in SERVER-68971 already. Mentioning it because there were a couple comments on the other ticket.

Generated at Thu Feb 08 06:13:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.