[JAVA-364] MapReduceOutput sometimes returns empty results in a replica set when SLAVE_OK=true Created: 02/Jun/11 Updated: 25/Jun/13 Resolved: 12/Aug/11 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Cluster Management |
| Affects Version/s: | 2.6.1 |
| Fix Version/s: | 2.7 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Tal Liron | Assignee: | Antoine Girbal |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Description |
|
After debugging this, I found that the map-reduce output collection is written to the master, but if you connected to the replica set with SLAVE_OK=true, you may very well be reading from a slave node before the output collection has been synced there, which will indeed give you empty results. The workaround I put in my code is to ensure that the output collection never has the SLAVE_OK=true option, no matter what connection options were set. However, I suggest putting this in the MapReduceOutput code. This could be added to the constructor: _coll = db.getCollection( _collname ); I have tested similar code with my applications, and it has indeed made this bug go away! |
| Comments |
| Comment by auto [ 12/Aug/11 ] |
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: |
| Comment by Antoine Girbal [ 12/Aug/11 ] |
|
Hey Tal, thanks for report and fix. |
| Comment by Tal Liron [ 10/Aug/11 ] |
|
Version 2.6.5 just came out, and still my incredibly simple patch has not been applied since version 2.6.1. |