Skip to content
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

Using ReadPreference.Secondary causes issues if read_secondary is not supplied with true #741

Closed
wants to merge 3 commits into from

Conversation

m4tty
Copy link
Contributor

@m4tty m4tty commented Oct 22, 2012

Allowed for leaving read_secondary option off of ReplicaSet constructor as we have enough information from the new ReadPreference object to know the secondary allowed setting.

Supplying ReadPreference.SecondaryWhatever without read_secondary=true causes allRawConnections() to return with no secondaries in the connections list (to db.authenticate()) and ultimately cause unauthenticated servers to be in the replicaset connection pool but still used and ultimately downstream auth failures.

System Administrator and others added 3 commits October 21, 2012 21:32
…r of new ReadPreference object, as we have enough information to know if we want to allow reading of secondary. Also, setting ReadPreference.SecondaryWhatever without read_secondary=true causes allRawConnections() to return less and ultimately cause unauthenticated servers to be in the replicaset
…r of new ReadPreference object, as we have enough information to know if we want to allow reading of secondary. Also, setting ReadPreference.SecondaryWhatever without read_secondary=true causes allRawConnections() to return less and ultimately cause unauthenticated servers to be in the replicaset
@aheckmann
Copy link
Contributor

thanks for the pull request. would you please add tests that exercise the changes?

@christkv
Copy link
Contributor

I need a test that reproduces the issue, can your provide one please

@christkv
Copy link
Contributor

actually setting the read_secondary is correct as it triggers a specific slaveOk bit

@christkv christkv closed this Oct 29, 2012
@m4tty
Copy link
Contributor Author

m4tty commented Oct 29, 2012

Not sure what you meant in the last comment, but the change referenced above ( f6ca881 ) takes care of the issue I posted... with .readSecondary not being set and truncating the return from allRawConnections(). Now we have a "default" value for readSecondary when using the readpreference object.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants