summaryrefslogtreecommitdiff
path: root/src/mongo/s/config.h
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2015-08-10 16:52:11 -0400
committerRandolph Tan <randolph@10gen.com>2015-08-14 17:47:59 -0400
commit2a0c88b48eb28231b6bfe81b6b717ceafdece0a6 (patch)
treeb92a020833df8dfcfaeb455718817bbe1ed37779 /src/mongo/s/config.h
parent0bb07f47f2fff10d8d4eaacfacb90307af6ff8d0 (diff)
downloadmongo-2a0c88b48eb28231b6bfe81b6b717ceafdece0a6.tar.gz
SERVER-19736 Add opTime invariant checks when updating cached config server data
Diffstat (limited to 'src/mongo/s/config.h')
-rw-r--r--src/mongo/s/config.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mongo/s/config.h b/src/mongo/s/config.h
index a779c8ee70c..6c5d362f2b3 100644
--- a/src/mongo/s/config.h
+++ b/src/mongo/s/config.h
@@ -31,6 +31,7 @@
#include <set>
#include "mongo/db/jsobj.h"
+#include "mongo/db/repl/optime.h"
#include "mongo/s/client/shard.h"
#include "mongo/util/concurrency/mutex.h"
@@ -48,7 +49,7 @@ struct CollectionInfo {
_dropped = false;
}
- CollectionInfo(OperationContext* txn, const CollectionType& in);
+ CollectionInfo(OperationContext* txn, const CollectionType& in, repl::OpTime);
~CollectionInfo();
bool isSharded() const {
@@ -85,12 +86,17 @@ struct CollectionInfo {
return _key;
}
+ repl::OpTime getConfigOpTime() const {
+ return _configOpTime;
+ }
+
private:
BSONObj _key;
bool _unique;
std::shared_ptr<ChunkManager> _cm;
bool _dirty;
bool _dropped;
+ repl::OpTime _configOpTime;
};
/**
@@ -98,7 +104,7 @@ private:
*/
class DBConfig {
public:
- DBConfig(std::string name, const DatabaseType& dbt);
+ DBConfig(std::string name, const DatabaseType& dbt, repl::OpTime configOpTime);
~DBConfig();
/**
@@ -192,6 +198,9 @@ protected:
stdx::mutex _lock;
CollectionInfoMap _collections;
+ // OpTime of config server when the database definition was loaded.
+ repl::OpTime _configOpTime;
+
// Ensures that only one thread at a time loads collection configuration data from
// the config server
stdx::mutex _hitConfigServerLock;