[SERVER-4218] update key set difference implementation does not account for equal but inequivalent numeric values Created: 07/Nov/11 Updated: 06/Dec/22 Resolved: 27/Dec/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance, Write Ops |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Guanqun Lu | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | pull-request | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Assigned Teams: |
Query
|
| Backwards Compatibility: | Minor Change |
| Operating System: | ALL |
| Participants: |
| Description |
|
The DataFileMgr::updateRecord() and getIndexChanges() code finds the index key sets for a document both pre and post update. Values present in one but not both of these key sets are added / removed from the appropriate indexes, while values present in both are untouched in the indexes. The implementation uses key equality rather than bit equivalence to determine if a key exists in both the pre and post update key set. So if a key is changed from one numeric type to another but its new value is equal to its original value, the key will not be updated in the index. As a result a covered index query can return a key with the wrong data type. Test:
– Aaron ------------------------------------------------------- run the following script:
The last output should be:
but actually, the output is:
The type info is lost. |
| Comments |
| Comment by Asya Kamsky [ 27/Dec/16 ] |
|
This was fixed for 3.4 with work on |
| Comment by Benety Goh [ 28/Aug/14 ] |
|
server4218.js - previously updatej.js in the pull request: |
| Comment by Guanqun Lu [ 07/Nov/11 ] |
|
I've sent a pull request here: https://github.com/mongodb/mongo/pull/143 |