summaryrefslogtreecommitdiff
path: root/src/mongo/s/write_ops/batch_write_exec.h
diff options
context:
space:
mode:
authorGreg Studer <greg@10gen.com>2013-12-14 16:01:30 -0500
committerGreg Studer <greg@10gen.com>2013-12-16 14:49:01 -0500
commitb0cc3e092880c00cdbd531d88f38cb9e0a52d881 (patch)
treed26701d6c4ed9dc98891ab181d9eded0e8a0c083 /src/mongo/s/write_ops/batch_write_exec.h
parent99dff054c8b83caf43c42d01b0497dcb0e1ee5bf (diff)
downloadmongo-b0cc3e092880c00cdbd531d88f38cb9e0a52d881.tar.gz
SERVER-11681 mongos upconverts all writes by default
Diffstat (limited to 'src/mongo/s/write_ops/batch_write_exec.h')
-rw-r--r--src/mongo/s/write_ops/batch_write_exec.h41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/mongo/s/write_ops/batch_write_exec.h b/src/mongo/s/write_ops/batch_write_exec.h
index 1bc136f3262..d9324f2f8ae 100644
--- a/src/mongo/s/write_ops/batch_write_exec.h
+++ b/src/mongo/s/write_ops/batch_write_exec.h
@@ -30,7 +30,11 @@
#include <boost/scoped_ptr.hpp>
+#include <map>
+#include <string>
+
#include "mongo/base/disallow_copying.h"
+#include "mongo/bson/optime.h"
#include "mongo/s/ns_targeter.h"
#include "mongo/s/multi_command_dispatch.h"
#include "mongo/s/shard_resolver.h"
@@ -39,6 +43,8 @@
namespace mongo {
+ class BatchWriteExecStats;
+
/**
* The BatchWriteExec is able to execute client batch write requests, resulting in a batch
* response to send back to the client.
@@ -60,9 +66,7 @@ namespace mongo {
BatchWriteExec( NSTargeter* targeter,
ShardResolver* resolver,
- MultiCommandDispatch* dispatcher ) :
- _targeter( targeter ), _resolver( resolver ), _dispatcher( dispatcher ) {
- }
+ MultiCommandDispatch* dispatcher );
/**
* Executes a client batch write request by sending child batches to several shard
@@ -77,6 +81,10 @@ namespace mongo {
void executeBatch( const BatchedCommandRequest& clientRequest,
BatchedCommandResponse* clientResponse );
+ const BatchWriteExecStats& getStats();
+
+ BatchWriteExecStats* releaseStats();
+
private:
// Not owned here
@@ -87,5 +95,32 @@ namespace mongo {
// Not owned here
MultiCommandDispatch* _dispatcher;
+
+ // Stats
+ auto_ptr<BatchWriteExecStats> _stats;
+ };
+
+ // Useful comparator for using connection strings in ordered sets and maps
+ struct ConnectionStringComp {
+ bool operator()( const ConnectionString& connStrA,
+ const ConnectionString& connStrB ) const {
+ return connStrA.toString().compare( connStrB.toString() ) < 0;
+ }
+ };
+
+ typedef std::map<ConnectionString, OpTime, ConnectionStringComp> HostOpTimeMap;
+
+ class BatchWriteExecStats {
+ public:
+
+ // TODO: Other stats can go here
+
+ void noteWriteAt( const ConnectionString& host, OpTime opTime );
+
+ const HostOpTimeMap& getWriteOpTimes() const;
+
+ private:
+
+ HostOpTimeMap _writeOpTimes;
};
}