diff options
author | Marko Vojvodic <marko.vojvodic@mongodb.com> | 2016-10-27 15:51:24 -0400 |
---|---|---|
committer | Marko Vojvodic <marko.vojvodic@mongodb.com> | 2016-11-01 09:50:08 -0400 |
commit | 8e75b8cf7aaae55a0d68e1105a69ae9f505720ad (patch) | |
tree | c393b7623b3f181d2de13af6975bb7f338ce9ec2 /src/mongo/s/write_ops/batch_write_op.cpp | |
parent | 3e3f56165984bb89022ab8eb720753fef007759e (diff) | |
download | mongo-8e75b8cf7aaae55a0d68e1105a69ae9f505720ad.tar.gz |
SERVER-26194 Account for collation specification size in batch_write_op getWriteSizeBytes
Diffstat (limited to 'src/mongo/s/write_ops/batch_write_op.cpp')
-rw-r--r-- | src/mongo/s/write_ops/batch_write_op.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mongo/s/write_ops/batch_write_op.cpp b/src/mongo/s/write_ops/batch_write_op.cpp index fbd0b945b23..4f7a4efe52c 100644 --- a/src/mongo/s/write_ops/batch_write_op.cpp +++ b/src/mongo/s/write_ops/batch_write_op.cpp @@ -156,14 +156,19 @@ static int getWriteSizeBytes(const WriteOp& writeOp) { return item.getDocument().objsize(); } else if (batchType == BatchedCommandRequest::BatchType_Update) { // Note: Be conservative here - it's okay if we send slightly too many batches - int estSize = item.getUpdate()->getQuery().objsize() + - item.getUpdate()->getUpdateExpr().objsize() + kEstUpdateOverheadBytes; + auto collationSize = + item.getUpdate()->isCollationSet() ? item.getUpdate()->getCollation().objsize() : 0; + auto estSize = item.getUpdate()->getQuery().objsize() + + item.getUpdate()->getUpdateExpr().objsize() + collationSize + kEstUpdateOverheadBytes; dassert(estSize >= item.getUpdate()->toBSON().objsize()); return estSize; } else { dassert(batchType == BatchedCommandRequest::BatchType_Delete); // Note: Be conservative here - it's okay if we send slightly too many batches - int estSize = item.getDelete()->getQuery().objsize() + kEstDeleteOverheadBytes; + auto collationSize = + item.getDelete()->isCollationSet() ? item.getDelete()->getCollation().objsize() : 0; + auto estSize = + item.getDelete()->getQuery().objsize() + collationSize + kEstDeleteOverheadBytes; dassert(estSize >= item.getDelete()->toBSON().objsize()); return estSize; } |