diff options
author | Spencer T Brody <spencer@10gen.com> | 2012-08-09 16:11:41 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2012-08-09 16:23:00 -0400 |
commit | 33bb2435347e1b5423c05c521e8106b65b0e411b (patch) | |
tree | 2a20e68b5ef2ad211c3e7a827b6532a4248534f9 /src | |
parent | 8ce807a63f06d045c7801d4273f6589d8720e2c2 (diff) | |
download | mongo-33bb2435347e1b5423c05c521e8106b65b0e411b.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.
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/client/gridfs.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/client/gridfs.cpp b/src/mongo/client/gridfs.cpp index ddc2e12aeac..ff4939a8120 100644 --- a/src/mongo/client/gridfs.cpp +++ b/src/mongo/client/gridfs.cpp @@ -139,6 +139,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 ) ) |