summaryrefslogtreecommitdiff
path: root/src/mongo/s/write_ops/batch_write_op.cpp
diff options
context:
space:
mode:
authorMarko Vojvodic <marko.vojvodic@mongodb.com>2016-10-27 15:51:24 -0400
committerMarko Vojvodic <marko.vojvodic@mongodb.com>2016-11-01 09:50:08 -0400
commit8e75b8cf7aaae55a0d68e1105a69ae9f505720ad (patch)
treec393b7623b3f181d2de13af6975bb7f338ce9ec2 /src/mongo/s/write_ops/batch_write_op.cpp
parent3e3f56165984bb89022ab8eb720753fef007759e (diff)
downloadmongo-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.cpp11
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;
}