[SERVER-14555] double floating point values are not retrieved exactly Created: 15/Jul/14 Updated: 10/Dec/14 Resolved: 16/Jul/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Client |
| Affects Version/s: | 2.6.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Stefan Achatz | Assignee: | Thomas Rueckstiess |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: |
output (exemplary, not deterministic):
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: |
| Description |
|
1. Retrieving a double value from the database may differ from the originally stored value. This is a critical issue for us, because we have to trust that stored and retrieved numbers are exactly equal. Versions: we use mongo db 2.6.1 server with 2.4.8 C++ driver (unfortunately we have severe problems to get the 2.6 C++ driver incorporated into our project, but this is different story...) |
| Comments |
| Comment by Thomas Rueckstiess [ 16/Jul/14 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Hi Stefan, We can't see any evidence of a bug here and the SERVER project is only for reporting bugs and feature requests. Unfortunately we can't do code reviews or support answers in this project. For this kind of question I think the mongodb-user (http://groups.google.com/group/mongodb-user) group would be better suited to get you some helpful answers, so I recommend you post your question there. Regards, | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Stefan Achatz [ 16/Jul/14 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Hi Tyler, I confirm that calling lastError fixes the problem in the given test program. In our project we call getLastErrorDetailed after every mongdb command and we evaluate and log the error (see details below). No error was ever reported. I will now investigate in more detail our problem and try to come up with an updated test program which reproduces the error.
| |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tyler Brock [ 15/Jul/14 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
I have confirmed the legacy driver simply works out of the box with your program (as expected) and that the 26compat version of the driver works with my suggested change:
| |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tyler Brock [ 15/Jul/14 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Hey Stefan, You just need to call {{ connection1.getLastError(); }} right after you do the update. With the 26compat version of the driver writes are not acknowledged by default so you need to call getLastError to ensure that the write is completed before querying. Without that, there are no guarantees the write happens before the first query, before the second query, or at all. With the legacy version of the driver, we have updated the code such that acknowledged write concern is the default so the program works as expected by default. |