diff options
author | Eric Milkie <milkie@10gen.com> | 2014-01-24 11:19:18 -0500 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2014-01-29 23:09:38 -0500 |
commit | f83e6f60ab26f037b686d54168376fa1c8df82ce (patch) | |
tree | ef34faa214ffc8d24f74d2ce7b9bfb288557a372 /src/mongo/s/write_ops/batched_command_response.h | |
parent | a40d78d52823547b5cfe8de8b50edb95b45cf902 (diff) | |
download | mongo-f83e6f60ab26f037b686d54168376fa1c8df82ce.tar.gz |
SERVER-12419 add electionId to mongos batch response structure
Note that this will require some modifications/backporting to 2.4.10 for full support.
Diffstat (limited to 'src/mongo/s/write_ops/batched_command_response.h')
-rw-r--r-- | src/mongo/s/write_ops/batched_command_response.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mongo/s/write_ops/batched_command_response.h b/src/mongo/s/write_ops/batched_command_response.h index a27af2b9759..fa96d742e02 100644 --- a/src/mongo/s/write_ops/batched_command_response.h +++ b/src/mongo/s/write_ops/batched_command_response.h @@ -60,6 +60,7 @@ namespace mongo { static const BSONField<long long> nModified; static const BSONField<std::vector<BatchedUpsertDetail*> > upsertDetails; static const BSONField<OpTime> lastOp; + static const BSONField<OID> electionId; static const BSONField<std::vector<WriteErrorDetail*> > writeErrors; static const BSONField<WCErrorDetail*> writeConcernError; @@ -125,6 +126,11 @@ namespace mongo { bool isLastOpSet() const; OpTime getLastOp() const; + void setElectionId(const OID& electionId); + void unsetElectionId(); + bool isElectionIdSet() const; + OID getElectionId() const; + void setErrDetails(const std::vector<WriteErrorDetail*>& errDetails); // errDetails ownership is transferred to here. void addToErrDetails(WriteErrorDetail* errDetails); @@ -171,10 +177,20 @@ namespace mongo { // Should only be present if _singleUpserted is not. boost::scoped_ptr<std::vector<BatchedUpsertDetail*> >_upsertDetails; - // (O) XXX What is lastop? + // (O) Timestamp assigned to the write op when it was written to the oplog. + // Normally, getLastError can use Client::_lastOp, but this is not valid for + // mongos which loses track of the session due to RCAR. Therefore, we must + // keep track of the lastOp manually ourselves. OpTime _lastOp; bool _isLastOpSet; + // (O) In addition to keeping track of the above lastOp timestamp, we must also keep + // track of the primary we talked to. This is because if the primary moves, + // subsequent calls to getLastError are invalid. The only way we know if an + // election has occurred is to use the unique electionId. + OID _electionId; + bool _isElectionIdSet; + // (O) Array of item-level error information boost::scoped_ptr<std::vector<WriteErrorDetail*> >_writeErrorDetails; |