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
Update to Mongo 3.2 #6957
Comments
Hi @tmeasday. I am in between jobs right now, and I've been looking to contribute to meteor for a while. I think this is a great opportunity to start with, and something I can tackle. I have a couple questions, since I've never contributed before.
Anyways, I will start digging deeper on this issue later today, and if anyone eager to work with me on this shows up, I would be grateful to work together. |
Hi @Fabs! Thanks for volunteering. We have some basic contributing guidelines here: https://github.com/meteor/meteor/blob/devel/Contributing.md#making-changes-to-meteor-core I think for now we can just communicate here on this issue, I'll do my best to be responsive. I'm not sure if you had a plan around how you wanted to tackle this, but I've created a
We'll still need to evaluate if we need a fork of that package or not (with the overarching concern being: can you install it without a toolchain on our 4 platforms), but this seems like a nice useful self contained piece of work. |
I have made modifications to Hopefully this helps the effort. |
Nice :). @tmeasday, I set up an environment with mongo Anyways, going forward and changing the driver I have a few questions:
Anyway, I think I am set up and I can move forward with the work to fix the errors that I have, now that I changed to the new driver. I will keep you guys updated. @dgtlife, thanks for the link, I took a brief look and I am quite sure I will end up using it for help. So, the journey begins :) |
Also, very frequently (just one or two times I did not see it) I also get the error |
Cool!
A failing test in a vanilla setup? That would be quite surprising. Or do you mean failing when you run mongo yourself (from the dev bundle) and use
Not at all, I must have mis-read something (or they released 9 versions in the last week :) ). I'll update the top comment to avoid confusion.
No reason not to but I wouldn't expect many mongo-touching changes to devel to land. |
That |
I took the time now to read the test carefully, I think maybe I know what the issue could be. I have OSX Server, and the address http://0.0.0.0/ resolves an webpage (apache is running, port 80). So the assumption behind the test Also, I am at |
On a side note, already used something from @dgtlife to fix finding the primary replica set upon connection :). Thanks! |
Whoa, Re: #4970 -- that test includes a timeout. I wonder if that's what's tripping for you (I've been looking at fixing flaky tests recently and not seen that one before, so I wonder what's different for you). Perhaps you could play around with the timeout? |
PS I am on leave from tomorrow until Tuesday but @benjamn will jump in and help out with any other questions. |
About #4970, I am thinking about playing with it once I have the mongo done. Is that alright? Thanks @abernix. Wish you a good time @tmeasday, thanks for the help you gave already. Just an update, so far, |
👋 folks |
This is pretty awesome! 👍 |
Update time :). The upsert method, specially Anyways, I am still dwelling in some corner cases, but I am confident I will be able to get rid of the previous implementation of upsert (with the Got 20 tests working today, 40 more to go. |
From #5809, this may also be relevant https://jira.mongodb.org/browse/SERVER-14322 |
More Updates. I am now 5 failing tests to have it working without oplog and using upsert. All my troubles are with the _id field, but I think I am getting close. I believe by the end of this week I will have it working for this particular case. If anybody has any ideas, one problem I am dealing is setting the "right" ID, on STRING id type collections when the user supply an upsert (or update with, upsert:true) without any modifier operators ( I try using $setOnInsert to add a String ID (and $set for the rest of the update document). This fix the insert but brakes the update, when the expected behaviour would be replacing the entire document {$set does not do that}. Also I think I break some behaviour that does not have failing tests so I will take time to double check it and add the tests like when (like I don't see a failing test because I used update(selector, {$set: obj}) instead of update(selector, obj) when I am quite sure the latter replaces the entire document). |
@Fabs --- I see you're "personal" mongo-3.2 branch is 42 commits (at the time of this writing) ahead of the "official" mongo-3.2 branch. Is it safe to say---despite not having the last test completed---that we can clone your "personal" mongo-3.2 in order to begin experimenting with MongoDB 3.2 behind Meteor? Will this become the PR for 1.4? I went though the entire gitlog on your branch. What's left to fix after tests are complete and passed? Thank you for moving this forward! Hats off to you. |
It would seem that #4436 will be getting resolved through this upgrade as the I'm not certain, but it would seem that Meteor was previously using the If this is the case, this should be mentioned very clearly in the |
@Fabs I've been pondering @abernix's comment above. At first I thought it made sense to just stick with changing the But re-reading the issue and thinking about it more, I have some objections to that:
There just doesn't seem to be all that a compelling case for sticking with changing it. I'd love to hear your thoughts, but I'm thinking we should change it back to |
I have never ever needed number of matched documents, but I have always needed number of changed documents. Can somebody tell me use cases where first would be preferred over others. (Let's imagine that we are designing this from scratch and that we can decide on one value to be returned.) We also have documentation so that we have an "excuse" to fixing this in a backwards incompatible manner. But we should add some switch to return the whole object for those who really need previous behavior. But I really do not know when you would need number of matched documents. |
I have not changed any of the tests during the driver changes and I returned nModified (or 1 for insertions) for all update tests. So, I believe either the documentation was always wrong, or there is no test where My preference would be to do something in the direction of @davidecantini proposal, returning at least two values One feature I think we are in a good position to add now though, is returning the whole Another more simplistic idea, would be returning the internal result object as a property of the meteor result, all the time. |
Guys, am I missing something? I went to the docs, and they read:
Was that updated? |
This comment explains some examples where both are useful: #4436 (comment). Ultimately, this is clearly why MongoDB changed the wire protocol.
Unfortunately we don't live in a world where we can design things in a white room. Back-compat is a real thing. If I was designing it from scratch, I'd return the full However, I'm wary of making that change to the default API, because if anyone has code of the form
The documentation was indeed always wrong[1], and I think you are right that there is no test.
I think this is the right approach. It should be easy to send a PR to do this after 1.4
You are looking at the upsert docs. The update docs say: "Returns the number of affected documents." [1] Or at best confusing. |
I just don't think there's a strong enough case to be made to break back-compat (even though I agree most people probably would never had made the distinction between I definitely think we should add a test to avoid unintentionally changing this in future (and to ensure consistency between the Mongo Driver and Minimongo). |
Hm, but to me it is a bug. I was programming against documentation and I reported a bug that Meteor is not returning correct value. This change will always be incompatible for some users. Or those who read documentation, or those who ignored it. The question is then into which direction we want to move. Which set of users we want to inconvenience? |
I don't think it's fair to say that it's "breaking compatibility" if people mis-understood the API because of poor documentation and we don't change it. It's just not a bug, pure and simple. The documentation was wrong/confusing. You think the API should work differently, but that doesn't make it a bug. |
I had in one my code for 2 years this bug because I read documentation and do not always check implementation because I trust code. I suspect that others have similar code based on documentation. For them this is a breaking change. |
How can it be a breaking change when we aren't changing anything? You've lost me.. |
It is a breaking change because for those who implemented code based on documentation have a hidden bug. I had such bug for two years and I had very nasty issues with it: my code went into an infinite loop blocking the whole server. Of course it was hard to find it. Because it happened only when there was a race condition that document has already the same values as I wanted to update to. Tricky to debug. Probably my case is an extreme case, but still. Anyway, I do not really case. I fixed it for myself and it works. I just think more people program against documentation than program against implementation. |
Hi guys, a) change the documentation to reflect the current (and past) implementation; The question should be: which one has less chances of breaking existing codes? Any real code/app gets tested and it's the implementation, in the end, that causes your tests to pass or fail. So, while it's true that one should follow the documentation, it's also true that as soon as your tests fail (because you expected nModified and actually got nMatched) you'd surely have to follow the implementation (if you want your tests to pass). That said, it appears reasonable to say that option a) has less chances of breaking existing codes than option b), and, so, a) should be the way to go. If so, would the following be something we can agree on?
I hope this helps, thanks. |
Even Meteor do not have tests for this edge case. And this is pretty tricky to test because it might depend on a race condition. |
I think so, but only because of my sample size of 1 (me). :-) Anyway, I will leave to others to decide this. I have spoken too much on this topic. |
@mitar, it's fine to have opinions, regardless of the sample size :) Here is a simple case from a real app:
As you can see, that is a case where a user opens the UI to update an item and saves it without modifying anything. It's something quite common and easy to test. Well, if you go for option b) then each and every existing code similar to that would get broken. |
So. I Made numberAffected return I hope once those modifications of the driver hit 1.4, somebody (probably me, but anyone could ;)) will make the About the docs. What is the process to fix them (if no one is planning to do that I volunteer)? @mitar , do you think once we have added the |
Yea, it is OK. |
|
@tmeasday the fork of |
Actually we don't use a fork any more. But it was just for dev, yeah. |
The changes associated with this issue have been merged into |
PR: #7163
This issue is an attempt to outline what needs to be considered as part of this transition. We plan to look at this in the short/medium term, however if someone is keen to contribute to the project and wants to see it land earlier, this would be a great opportunity to make a larger contribution!
Update Mongo Driver to 3.2 compatible version #5763
node-mongodb-native
package used here: https://github.com/meteor/meteor/blob/devel/packages/npm-mongo/package.js to at least 2.1.0 (I guess we may as well get the latest 2.1.18).(We should also probably remove the
npm-mongo
wrapper package and just peer-depend on the npm package frommongo
, but I think we should wait to do this, it'll be a larger issue we have to solve with the 1.4 move to npm).Update bundled Mongo in the dev bundle to 3.2 #5809
meteor reset
or look into taking steps to upgrading your db contentsErrata
Notes on testing mongo binary SSL support:
I don't think we need to do this:
node-mongodb-native
to include this commit mongodb/node-mongodb-native@634759e (which would now need to be against https://github.com/christkv/mongodb-core/blob/1.3/package.json)The text was updated successfully, but these errors were encountered: