Permalink
Browse files

Make C++ driver call GLE after storing gridFS chunks, before calling …

…filemd5. SERVER-6742

This ensures that there are no pending writebacks from the chunks being inserted.
  • Loading branch information...
1 parent 0786517 commit 5eaf375b0c9e6fef220e71916e83c3c3e265158f @stbrody stbrody committed with monkey101 Aug 9, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 client/gridfs.cpp
View
@@ -130,6 +130,12 @@ namespace mongo {
}
BSONObj GridFS::insertFile(const string& name, const OID& id, gridfs_offset length, const string& contentType) {
+ // Wait for any pending writebacks to finish
+ string err = _client.getLastError();
+ uassert( 16428,
+ str::stream() << "Error storing GridFS chunk for file: " << name
+ << ", error: " << err,
+ err == "" );
BSONObj res;
if ( ! _client.runCommand( _dbName.c_str() , BSON( "filemd5" << id << "root" << _prefix ) , res ) )

0 comments on commit 5eaf375

Please sign in to comment.