-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed mongo instance locking bug #836
Conversation
bee1568
to
de41336
Compare
de41336
to
678c7e9
Compare
Added use of 'nameOnly' tag when fetching database names for mongo versions >= 3.2
678c7e9
to
a7281f8
Compare
cceaba3
to
d85c066
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a single comment here, after you fix that, it's good to go I think!
Thanks!
@@ -862,7 +865,21 @@ def total_seconds(td): | |||
except KeyError: | |||
pass | |||
|
|||
dbnames = cli.database_names() | |||
cmd = SON([("listDatabases", 1)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment with a link to the code in the mongo driver here and a comment with a reminder to fix this after the upgrade is done!
PyMongo 3.5 already contains a fix for this issue - no need to wait for the next version to come out. This problem is fixed by #747 |
What does this PR do?
We currently use PyMongo's
database_names()
command to fetch the names of all the databases; this in turn uses MongoDB'slistDatabases
command. For Mongo versions >= 3.2, the command supports an additional fieldnameOnly
which returns only the names of the databases and does not require database locks ( documentation ). PyMongo does not currently support this option, but the next version is supposed to, so this is just a temporary workaround until that version is released ( PyMongo changelog ).This PR checks which version of Mongo the user is running and calls the
listDatabases
command directly, using thenameOnly
field if the version is high enough.Motivation
#606
Testing Guidelines
An overview on testing
is available in our contribution guidelines.
Versioning
manifest.json
CHANGELOG.md
. Please useUnreleased
as the date in the titlefor the new section.
Additional Notes
Anything else we should know when reviewing?