Commits

Aristarkh Zagorodnikov  committed 055ba26

Fixed SlaveOK patch (now GridFSSlaveOk works properly)

  • Participants
  • Parent commits 02b1a86
  • Branches v0.2

Comments (0)

Files changed (1)

File patches/gridfs-slaveok

---- mongo-cxx-driver/src/mongo/client/gridfs.h	2012-04-19 21:45:44.000000000 +0400
-+++ mongo-cxx-driver/src/mongo/client/gridfs.h	2012-04-20 00:08:12.000000000 +0400
-@@ -101,22 +101,22 @@
+--- mongo-cxx-driver/src/mongo/client/gridfs.h	2012-11-18 21:01:59.935920891 +0400
++++ mongo-cxx-driver/src/mongo/client/gridfs.h	2012-11-20 11:34:51.000000000 +0400
+@@ -103,22 +103,22 @@
          /**
           * returns a file object matching the query
           */
  
      private:
          DBClientBase& _client;
-@@ -192,12 +192,13 @@
+@@ -194,12 +194,13 @@
          gridfs_offset write( const string& where ) const;
  
      private:
  
          friend class GridFS;
      };
---- mongo-cxx-driver/src/mongo/client/gridfs.cpp	2012-04-19 21:45:44.000000000 +0400
-+++ mongo-cxx-driver/src/mongo/client/gridfs.cpp	2012-04-20 00:03:50.000000000 +0400
-@@ -174,26 +174,27 @@
+--- mongo-cxx-driver/src/mongo/client/gridfs.cpp	2012-11-18 21:02:23.879888343 +0400
++++ mongo-cxx-driver/src/mongo/client/gridfs.cpp	2012-11-20 11:55:57.000000000 +0400
+@@ -184,26 +184,27 @@
          }
      }
  
 +    GridFile GridFS::findFile( BSONObj query , bool slaveOk ) const {
          query = BSON("query" << query << "orderby" << BSON("uploadDate" << -1));
 -        return GridFile( this , _client.findOne( _filesNS.c_str() , query ) );
-+        return GridFile( this , _client.findOne( _filesNS.c_str() , query ) , slaveOk );
++        return GridFile( this , _client.findOne( _filesNS.c_str() , query, 0 , slaveOk ? QueryOption_SlaveOk : 0 ) , slaveOk );
      }
  
 -    auto_ptr<DBClientCursor> GridFS::list() const {
      }
  
      BSONObj GridFile::getMetadata() const {
+@@ -221,7 +222,7 @@
+         b.appendAs( _obj["_id"] , "files_id" );
+         b.append( "n" , n );
+ 
+-        BSONObj o = _grid->_client.findOne( _grid->_chunksNS.c_str() , b.obj() );
++        BSONObj o = _grid->_client.findOne( _grid->_chunksNS.c_str() , b.obj() , 0 , _slaveOk ? QueryOption_SlaveOk : 0 );
+         uassert( 10014 ,  "chunk is empty!" , ! o.isEmpty() );
+         return GridFSChunk(o);
+     }