diff options
author | Spencer T Brody <spencer@10gen.com> | 2012-08-09 16:11:41 -0400 |
---|---|---|
committer | Dan Pasette <dan@10gen.com> | 2012-10-15 17:17:09 -0400 |
commit | 5eaf375b0c9e6fef220e71916e83c3c3e265158f (patch) | |
tree | ab1cbf2ffd0e29d1a0842fec62d037217557b663 | |
parent | 07865170991cb07cab95a57e49f3ed3f44b8a8ba (diff) | |
download | mongo-5eaf375b0c9e6fef220e71916e83c3c3e265158f.tar.gz |
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.
-rw-r--r-- | client/gridfs.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/client/gridfs.cpp b/client/gridfs.cpp index 233724ae8e5..b1ab2d5d550 100644 --- a/client/gridfs.cpp +++ b/client/gridfs.cpp @@ -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 ) ) |