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

Futzing with read preference #3963

Merged

Conversation

davimacedo
Copy link
Member

Contributing to #3959

@codecov
Copy link

codecov bot commented Jun 27, 2017

Codecov Report

Merging #3963 into master will decrease coverage by <.01%.
The diff coverage is 84.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3963      +/-   ##
==========================================
- Coverage   94.04%   94.03%   -0.01%     
==========================================
  Files         129      129              
  Lines        9214     9243      +29     
==========================================
+ Hits         8665     8692      +27     
- Misses        549      551       +2
Impacted Files Coverage Δ
src/vendor/mongodbUrl.js 100% <ø> (ø) ⬆️
src/Adapters/Storage/Mongo/MongoStorageAdapter.js 91.72% <100%> (+0.04%) ⬆️
src/RestQuery.js 95.47% <70%> (-0.63%) ⬇️
src/Routers/ClassesRouter.js 96.62% <92.85%> (+1.82%) ⬆️
src/RestWrite.js 93.27% <0%> (-0.18%) ⬇️
src/ParseServer.js 97.88% <0%> (+0.8%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a8a947...2d537c8. Read the comment docs.

src/Routers/ClassesRouter.js Outdated Show resolved Hide resolved
src/Routers/ClassesRouter.js Outdated Show resolved Hide resolved
@acinader
Copy link
Contributor

another suggestion I have is to force any string input into lower case i.e. lower case SECONDARY_PREFERRED before running it through the case or validating in any way.

In the mongo docs its all camel case. So kinda a bummer that we're inconsistent? Its out there now, in 2.5, but we should probably accept both the mongo standard as what we now have and deprecate the non mongo syntax? I know that we support more backing engines, but since we're only doing mongo for slave/secondary for now, why not be consistent??

@davimacedo
Copy link
Member Author

It was upper case because mongo node driver is upper case. But I agree it should handle both. So I turned it case insensitive.

I also added support to choose read preference for includes and subqueries directly from API.

Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davimacedo This all looks good to me -- and I can take a stab at the documentation, which I think I can now fill out much better, for you to review.

But I do have one observation which I'd like your feedback on. There are three options now:

  1. readPreference
  2. includeReadPreference
  3. subqueryReadPreference

I question that we need this. It's hard for me to imagine why we need this level of granularity and it adds complexity that I just don't think is worth its value. I'd think that if we simply had the option for readPreference and then set all include and subqueries to use the same readPreference that would be adequate. If there is a reason to have the granularity, I'd suggest that we should default to having readPreference set the other two, but give the ability to explicitly override in the case that it is needed. I know that this is not a trivial change. Let me know what you think.

@TylerBrock I'd be very interested in your feedback on this issue too.

@stale
Copy link

stale bot commented Sep 18, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@davimacedo davimacedo reopened this May 14, 2019
@stale stale bot removed the wontfix label May 14, 2019
@davimacedo
Copy link
Member Author

I've just rebased this request and also changed the subqueryReadPreference and includeReadPreference options behavior according to @acinader suggestion a while ago. Basically they now follow readPreference option by default, but can be override if wanted.

@acinader
Copy link
Contributor

ha. nice.

@davimacedo davimacedo merged commit afa74d6 into parse-community:master May 14, 2019
UnderratedDev pushed a commit to UnderratedDev/parse-server that referenced this pull request Mar 21, 2020
* allow setting readpreference when using rest api.

* take out partially complete unit test.

* oops. nit

* Include read preference option for find directly from api and adding few more tests

* Adding catch for all tests

* Keep same check for get and find

* Turn read preference case insensitive

* Includes and subqueries read preferences through API

* Fixing bugs regarding changes that were done in master branch during the last year

* Changing behavior to make includeReadPreference and subqueryReadPreference to follow readPreference by default
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.

2 participants