diff options
Diffstat (limited to 'src/mongo/s/client/shard_local.h')
-rw-r--r-- | src/mongo/s/client/shard_local.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mongo/s/client/shard_local.h b/src/mongo/s/client/shard_local.h index b39aba621d0..1c65015b78e 100644 --- a/src/mongo/s/client/shard_local.h +++ b/src/mongo/s/client/shard_local.h @@ -30,7 +30,9 @@ #include "mongo/base/disallow_copying.h" #include "mongo/client/dbclientinterface.h" +#include "mongo/db/repl/optime.h" #include "mongo/s/client/shard.h" +#include "mongo/stdx/mutex.h" namespace mongo { @@ -75,6 +77,23 @@ private: const BSONObj& query, const BSONObj& sort, boost::optional<long long> limit) final; + + /** + * Checks if an OpTime was set on the current Client (ie if the current operation performed a + * write) and if so updates _lastOpTime to the OpTime from the write that was just performed. + */ + void _updateLastOpTimeFromClient(OperationContext* txn); + + repl::OpTime _getLastOpTime(); + + // Guards _lastOpTime below. + stdx::mutex _mutex; + + // Stores the optime that was generated by the last operation to perform a write that was run + // through _runCommand. Used in _exhaustiveFindOnConfig for waiting for that optime to be + // committed so that readConcern majority reads will read the writes that were performed without + // a w:majority write concern. + repl::OpTime _lastOpTime{}; }; } // namespace mongo |