summaryrefslogtreecommitdiff
path: root/src/mongo/s/write_ops/batch_downconvert.h
diff options
context:
space:
mode:
authorGreg Studer <greg@10gen.com>2014-01-14 16:35:28 -0500
committerGreg Studer <greg@10gen.com>2014-01-16 11:39:53 -0500
commit6be5ff60cf3233dff7fff542ded1a06b541076b1 (patch)
treeac81d4ebedc235266c999b186b107fd3981efe32 /src/mongo/s/write_ops/batch_downconvert.h
parent1721db7bddcec2c61c121de961a899622f47c6ec (diff)
downloadmongo-6be5ff60cf3233dff7fff542ded1a06b541076b1.tar.gz
SERVER-12274 mongos GLE changes for better backwards compatibility
Diffstat (limited to 'src/mongo/s/write_ops/batch_downconvert.h')
-rw-r--r--src/mongo/s/write_ops/batch_downconvert.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/mongo/s/write_ops/batch_downconvert.h b/src/mongo/s/write_ops/batch_downconvert.h
index 1c81858c55c..cd5440ae993 100644
--- a/src/mongo/s/write_ops/batch_downconvert.h
+++ b/src/mongo/s/write_ops/batch_downconvert.h
@@ -35,6 +35,8 @@
#include "mongo/bson/bsonobj.h"
#include "mongo/bson/optime.h"
#include "mongo/client/dbclientinterface.h"
+#include "mongo/s/multi_command_dispatch.h"
+#include "mongo/s/write_ops/batch_write_exec.h"
#include "mongo/s/write_ops/batch_write_op.h"
#include "mongo/s/write_ops/batched_command_request.h"
#include "mongo/s/write_ops/batched_command_response.h"
@@ -67,7 +69,7 @@ namespace mongo {
* write command emulation.
*/
virtual Status enforceWriteConcern( DBClientBase* conn,
- const std::string& dbName,
+ const StringData& dbName,
const BSONObj& writeConcern,
BSONObj* gleResponse ) = 0;
};
@@ -91,10 +93,6 @@ namespace mongo {
const BatchedCommandRequest& request,
BatchedCommandResponse* response );
- //
- // Exposed for testing
- //
-
// Helper that acts as an auto-ptr for write and wc errors
struct GLEErrors {
auto_ptr<WriteErrorDetail> writeError;
@@ -124,9 +122,33 @@ namespace mongo {
*/
static void extractGLEStats( const BSONObj& gleResponse, GLEStats* stats );
+ /**
+ * Given a GLE response, strips out all non-write-concern related information
+ */
+ static BSONObj stripNonWCInfo( const BSONObj& gleResponse );
+
private:
SafeWriter* _safeWriter;
};
+ // Used for reporting legacy write concern responses
+ struct LegacyWCResponse {
+ string shardHost;
+ BSONObj gleResponse;
+ string errToReport;
+ };
+
+ /**
+ * Uses GLE and the shard hosts and opTimes last written by write commands to enforce a
+ * write concern across the previously used shards.
+ *
+ * Returns OK with the LegacyWCResponses containing only write concern error information
+ * Returns !OK if there was an error getting a GLE response
+ */
+ Status enforceLegacyWriteConcern( MultiCommandDispatch* dispatcher,
+ const StringData& dbName,
+ const BSONObj& options,
+ const HostOpTimeMap& hostOpTimes,
+ vector<LegacyWCResponse>* wcResponses );
}