summaryrefslogtreecommitdiff
path: root/src/mongo/s/chunk_manager_targeter.h
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-02-23 11:37:20 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-03-03 10:53:07 -0500
commit41986e669a4ef32b38c433a2cfd0b70e872e6899 (patch)
tree675ec225c7e9fad5902a78e71efc2e6c9d167325 /src/mongo/s/chunk_manager_targeter.h
parentacea28520290e793c1ff9e6ed4117ff543c59a98 (diff)
downloadmongo-41986e669a4ef32b38c433a2cfd0b70e872e6899.tar.gz
SERVER-17151 ConfigCoordinator should not call fsync
This is expensive to do, especially with WiredTiger and is not a deterministic check. This change replaces it with something cheaper, but has the same outcome - validates that previous writes were successfully journaled, which is an approximate predictor that subsequent writes have high chance of succeeding.
Diffstat (limited to 'src/mongo/s/chunk_manager_targeter.h')
-rw-r--r--src/mongo/s/chunk_manager_targeter.h38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/mongo/s/chunk_manager_targeter.h b/src/mongo/s/chunk_manager_targeter.h
index b082ad62eec..aaa115b044b 100644
--- a/src/mongo/s/chunk_manager_targeter.h
+++ b/src/mongo/s/chunk_manager_targeter.h
@@ -40,7 +40,13 @@
namespace mongo {
- struct TargeterStats;
+ class Grid;
+
+ struct TargeterStats {
+ // Map of chunk shard minKey -> approximate delta. This is used for deciding
+ // whether a chunk might need splitting or not.
+ std::map<BSONObj, int> chunkSizeDelta;
+ };
/**
* NSTargeter based on a ChunkManager implementation. Wraps all exception codepaths and
@@ -51,7 +57,7 @@ namespace mongo {
class ChunkManagerTargeter : public NSTargeter {
public:
- ChunkManagerTargeter();
+ ChunkManagerTargeter(const NamespaceString& nss);
/**
* Initializes the ChunkManagerTargeter with the latest targeting information for the
@@ -59,7 +65,7 @@ namespace mongo {
*
* Returns !OK if the information could not be initialized.
*/
- Status init( const NamespaceString& nss );
+ Status init();
const NamespaceString& getNS() const;
@@ -101,7 +107,6 @@ namespace mongo {
private:
// Different ways we can refresh metadata
- // TODO: Improve these ways.
enum RefreshType {
// No refresh is needed
RefreshType_None,
@@ -111,6 +116,9 @@ namespace mongo {
RefreshType_ReloadDatabase
};
+ typedef std::map<std::string, ChunkVersion> ShardVersionMap;
+
+
/**
* Performs an actual refresh from the config server.
*/
@@ -140,7 +148,14 @@ namespace mongo {
long long estDataSize,
ShardEndpoint** endpoint) const;
- NamespaceString _nss;
+ // Full namespace of the collection for this targeter
+ const NamespaceString _nss;
+
+ // Stores whether we need to check the remote server on refresh
+ bool _needsTargetingRefresh;
+
+ // Represents only the view and not really part of the targeter state.
+ mutable TargeterStats _stats;
// Zero or one of these are filled at all times
// If sharded, _manager, if unsharded, _primary, on error, neither
@@ -148,20 +163,7 @@ namespace mongo {
ShardPtr _primary;
// Map of shard->remote shard version reported from stale errors
- typedef std::map<std::string, ChunkVersion> ShardVersionMap;
ShardVersionMap _remoteShardVersions;
-
- // Stores whether we need to check the remote server on refresh
- bool _needsTargetingRefresh;
-
- // Represents only the view and not really part of the targeter state.
- mutable boost::scoped_ptr<TargeterStats> _stats;
- };
-
- struct TargeterStats {
- // Map of chunk shard minKey -> approximate delta. This is used for deciding
- // whether a chunk might need splitting or not.
- std::map<BSONObj, int> chunkSizeDelta;
};
} // namespace mongo