[CSHARP-269] GridFS upload bug Created: 18/Jul/11  Updated: 02/Apr/15  Resolved: 19/Jul/11

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.2
Fix Version/s: 1.2

Type: Bug Priority: Minor - P4
Reporter: Aristarkh Zagorodnikov Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: commands, driver, gridfs
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File CSHARP-269.patch    
Issue Links:
Depends
Backwards Compatibility: Fully Compatible

 Description   

This problem was already found and described at http://groups.google.com/group/mongodb-user/browse_thread/thread/dddeeb7be75a944a. To recap – adding a file to a newly created GridFS database that is hosted in a replica set, when slaveOk is set to true, leads to a "Command 'filemd5' failed: exception: best guess plan requested, but scan and order required" error.
The problem is that indexes are not created for a new database, since the check in MongoGridFS.EnsureIndexes(int) prohibits index creation for slaveOk connections.
I concluded a patch (will attach it later) that fixes the problem. Please take note that it does it in a bit indirect way – I thought that introducing some kind of "ignoreSlaveOk" parameter to MognoGridFS.EnsureIndex methods wouldn't be any good, so I just check the request nesting level (GridFS writes are done within nested requests so it's a fine indicator).



 Comments   
Comment by Robert Stam [ 19/Jul/11 ]

See commit comments:

https://github.com/mongodb/mongo-csharp-driver/commit/23346cd0f440eb70be46c161065c7ddb55f45099

Comment by Aristarkh Zagorodnikov [ 18/Jul/11 ]

I would like to note that this patch does not address the problem of calling EnsureIndex manually when slaveOk is enabled, so maybe a completely different solution is required (e.g. EnsureIndex ignoring slaveOk completely, since I don't know the original reasons for this check).

Generated at Wed Feb 07 21:36:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.