diff options
author | Randolph Tan <randolph@10gen.com> | 2014-01-10 13:07:04 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2014-01-13 11:41:31 -0500 |
commit | 77148d5a6c3e775c8e5e2944fac9695833f11b52 (patch) | |
tree | 58f222cf63bfd1ff5eaf2d040720fbe2cdc4c59a /src/mongo/s | |
parent | fef75c6b2d337151b37e3e77c54df72a9327b54e (diff) | |
download | mongo-77148d5a6c3e775c8e5e2944fac9695833f11b52.tar.gz |
SERVER-12319 nDocsModified in write commands to nModified
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/write_ops/batch_write_op.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batched_command_response.cpp | 44 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batched_command_response.h | 14 |
3 files changed, 31 insertions, 31 deletions
diff --git a/src/mongo/s/write_ops/batch_write_op.cpp b/src/mongo/s/write_ops/batch_write_op.cpp index b1b10f13c2b..a2f28d16db9 100644 --- a/src/mongo/s/write_ops/batch_write_op.cpp +++ b/src/mongo/s/write_ops/batch_write_op.cpp @@ -369,7 +369,7 @@ namespace mongo { numUpserted = response.sizeUpsertDetails(); } stats->numUpdated += ( response.getN() - numUpserted ); - stats->numModified += response.getNDocsModified(); + stats->numModified += response.getNModified(); stats->numUpserted += numUpserted; } else { @@ -597,7 +597,7 @@ namespace mongo { + _stats->numDeleted; batchResp->setN( nValue ); if ( _clientRequest->getBatchType() == BatchedCommandRequest::BatchType_Update ) - batchResp->setNDocsModified( _stats->numModified ); + batchResp->setNModified( _stats->numModified ); dassert( batchResp->isValid( NULL ) ); } diff --git a/src/mongo/s/write_ops/batched_command_response.cpp b/src/mongo/s/write_ops/batched_command_response.cpp index 4512c2a1eeb..3fb0fc805f3 100644 --- a/src/mongo/s/write_ops/batched_command_response.cpp +++ b/src/mongo/s/write_ops/batched_command_response.cpp @@ -39,7 +39,7 @@ namespace mongo { const BSONField<int> BatchedCommandResponse::errCode("code", ErrorCodes::UnknownError); const BSONField<string> BatchedCommandResponse::errMessage("errmsg"); const BSONField<long long> BatchedCommandResponse::n("n", 0); - const BSONField<long long> BatchedCommandResponse::nDocsModified("nDocsModified", 0); + const BSONField<long long> BatchedCommandResponse::nModified("nModified", 0); const BSONField<std::vector<BatchedUpsertDetail*> > BatchedCommandResponse::upsertDetails("upserted"); const BSONField<OpTime> BatchedCommandResponse::lastOp("lastOp"); @@ -79,7 +79,7 @@ namespace mongo { if (_isErrMessageSet) builder.append(errMessage(), _errMessage); - if (_isNDocsModifiedSet) builder.appendNumber(nDocsModified(), _nDocsModified); + if (_isNModifiedSet) builder.appendNumber(nModified(), _nModified); if (_isNSet) builder.appendNumber(n(), _n); if (_upsertDetails.get()) { @@ -150,18 +150,18 @@ namespace mongo { // We're using appendNumber on generation so we'll try a smaller type // (int) first and then fall back to the original type (long long). - BSONField<int> fieldNUpdated(nDocsModified()); + BSONField<int> fieldNUpdated(nModified()); int tempNUpdated; fieldState = FieldParser::extract(source, fieldNUpdated, &tempNUpdated, errMsg); if (fieldState == FieldParser::FIELD_INVALID) { // try falling back to a larger type - fieldState = FieldParser::extract(source, nDocsModified, &_nDocsModified, errMsg); + fieldState = FieldParser::extract(source, nModified, &_nModified, errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; - _isNDocsModifiedSet = fieldState == FieldParser::FIELD_SET; + _isNModifiedSet = fieldState == FieldParser::FIELD_SET; } else if (fieldState == FieldParser::FIELD_SET) { - _isNDocsModifiedSet = true; - _nDocsModified = tempNUpdated; + _isNModifiedSet = true; + _nModified = tempNUpdated; } std::vector<BatchedUpsertDetail*>* tempUpsertDetails = NULL; @@ -205,8 +205,8 @@ namespace mongo { _errMessage.clear(); _isErrMessageSet = false; - _nDocsModified = 0; - _isNDocsModifiedSet = false; + _nModified = 0; + _isNModifiedSet = false; _n = 0; _isNSet = false; @@ -249,8 +249,8 @@ namespace mongo { other->_errMessage = _errMessage; other->_isErrMessageSet = _isErrMessageSet; - other->_nDocsModified = _nDocsModified; - other->_isNDocsModifiedSet = _isNDocsModifiedSet; + other->_nModified = _nModified; + other->_isNModifiedSet = _isNModifiedSet; other->_n = _n; other->_isNSet = _isNSet; @@ -351,25 +351,25 @@ namespace mongo { return _errMessage; } - void BatchedCommandResponse::setNDocsModified(long long n) { - _nDocsModified = n; - _isNDocsModifiedSet = true; + void BatchedCommandResponse::setNModified(long long n) { + _nModified = n; + _isNModifiedSet = true; } - void BatchedCommandResponse::unsetNDocsModified() { - _isNDocsModifiedSet = false; + void BatchedCommandResponse::unsetNModified() { + _isNModifiedSet = false; } - bool BatchedCommandResponse::isNDocsModified() const { - return _isNDocsModifiedSet; + bool BatchedCommandResponse::isNModified() const { + return _isNModifiedSet; } - long long BatchedCommandResponse::getNDocsModified() const { - if ( _isNDocsModifiedSet ) { - return _nDocsModified; + long long BatchedCommandResponse::getNModified() const { + if ( _isNModifiedSet ) { + return _nModified; } else { - return nDocsModified.getDefault(); + return nModified.getDefault(); } } diff --git a/src/mongo/s/write_ops/batched_command_response.h b/src/mongo/s/write_ops/batched_command_response.h index 8a06b76b192..92df56a3198 100644 --- a/src/mongo/s/write_ops/batched_command_response.h +++ b/src/mongo/s/write_ops/batched_command_response.h @@ -57,7 +57,7 @@ namespace mongo { static const BSONField<int> errCode; static const BSONField<string> errMessage; static const BSONField<long long> n; - static const BSONField<long long> nDocsModified; + static const BSONField<long long> nModified; static const BSONField<std::vector<BatchedUpsertDetail*> > upsertDetails; static const BSONField<OpTime> lastOp; static const BSONField<std::vector<WriteErrorDetail*> > writeErrors; @@ -102,10 +102,10 @@ namespace mongo { bool isErrMessageSet() const; const std::string& getErrMessage() const; - void setNDocsModified(long long n); - void unsetNDocsModified(); - bool isNDocsModified() const; - long long getNDocsModified() const; + void setNModified(long long n); + void unsetNModified(); + bool isNModified() const; + long long getNModified() const; void setN(long long n); void unsetN(); @@ -159,8 +159,8 @@ namespace mongo { bool _isNSet; // (O) number of documents updated - long long _nDocsModified; - bool _isNDocsModifiedSet; + long long _nModified; + bool _isNModifiedSet; // (O) "promoted" _upserted, if the corresponding request contained only one batch item // Should only be present if _upserted is not. |