[SERVER-68971] explain_distinct.js fails when database doesn't exist Created: 18/Aug/22  Updated: 29/Oct/23  Resolved: 22/Sep/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Task Priority: Major - P3
Reporter: Dave Rolsky Assignee: Adi Zaimi
Resolution: Fixed Votes: 0
Labels: sharding-nyc-subteam2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-68152 explain_missing_collection.js fails w... Closed
Backwards Compatibility: Fully Compatible
Participants:
Story Points: 3

 Description   

This is the same issue as was fixed in SERVER-68152, but for a different test.



 Comments   
Comment by Vishnu Kaushik [ 28/Sep/22 ]

Wow it looks like the failing run is from a suite that doesn't have it! All other suites seem to have it (I need to confirm this). Having the param gets the cluster to execute the enableSharding command, which I guess implicitly creates the database.

Comment by Adi Zaimi [ 28/Sep/22 ]

Discussed with Max, and there is a section in a yml file that allows the fixture to create/assign a db:
```        enable_sharding:
          - test
```
So either this is missing in some of the yml files in mongosync, or that parameter is not being parsed/applied correctly by mongosync fixture. Will look further into this.

Comment by Adi Zaimi [ 23/Sep/22 ]

This test failure occurs apparently only for mongosync; I dont know where/how mongodb passthroughs create the db (or otherwise why is it not an issue there).
I think what you are suggesting could be a good approach.

Comment by Vishnu Kaushik [ 23/Sep/22 ]

There's another failing test explain_count.js - see here. If we could get a long term solution in mongos that would be great! Alternatively maybe we can do something in our test infra on the mongosync side so that we create the database test as one of the config -> shell_options -> eval options in YAML, if you think that is better.

Comment by Githook User [ 21/Sep/22 ]

Author:

{'name': 'Adi Zaimi', 'email': 'adizaimi@yahoo.com', 'username': 'adizaimi'}

Message: SERVER-68971: Create dummy collection so db can exist for explain cmd (for sharded testing)
Branch: master
https://github.com/mongodb/mongo/commit/f63252fbd6cbb7ef0ac1375542a636bb017dec72

Comment by Adi Zaimi [ 14/Sep/22 ]

The change in https://github.com/10gen/mongo/pull/7563 creates a dummy collection which in turns creates the db which explain needs. Note that I tested that this fixes the test by implicitly dropping the db at the beginning of the test, to make sure that patch will succeed in c2c tests.

Comment by Adi Zaimi [ 14/Sep/22 ]

Note that the error does not occur if I run a sharded test manually–the existing explain_distinct.js does not result in an error:
   

python3  ./build/install/bin/resmoke.py run jstests/core/explain_distinct.js --suites=sharding_jscore_passthrough

however if I modify explain_distinct.js to drop the db at the very beginning of the test, it does result in an error.

I dont know how this test interacts with Cluster 2 Cluster (c2c) testing, but it might be the reason why we don't see this test failing in regular (non c2c) sharded testing – the db already exists in regular testing even when explain_distinct.js is run first.

Comment by Adi Zaimi [ 14/Sep/22 ]

I'm fixing this test by creating a dummy collection (which will in turn create the underlying DB), that way even when this test is run first it will not fail. 

Note that this is a difference in how mongod and mongos behaves with the explain command when the db does not exist, and that may be something that we will want to change–keeping https://jira.mongodb.org/browse/SERVER-69416 to track that.

Comment by Max Hirschhorn [ 26/Aug/22 ]

Thanks for the quick fix! Is there a longer term solution we can implement? Because the same thing seems to be happening with explain_distinct.js here

https://jira.mongodb.org/browse/SERVER-68152?focusedCommentId=4744976&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-4744976

As part of this investigation it would be good to double check if there's something we can do for SERVER-68152 as well like Vishnu had asked about.

Comment by Githook User [ 25/Aug/22 ]

Author:

{'name': 'Dave Rolsky', 'email': 'autarch@urth.org', 'username': 'autarch'}

Message: REP-1303 Exclude explain_distinct.js from all CTC suites (#823)

This is failing because of a known issue. See
https://jira.mongodb.org/browse/SERVER-68971 for the issue and
https://jira.mongodb.org/browse/REP-1215 for the ticket to re-enable this
test.

This PR also adds a small CLI tool to help us find which suites include a
given test. This makes it easier to make sure it's being excluded everywhere
it needs to be.
Branch: main
https://github.com/10gen/mongosync/commit/a56778f6364675c504d41c24389ef54cd582b591

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