summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorGreg Studer <greg@10gen.com>2014-03-14 11:59:18 -0400
committerGreg Studer <greg@10gen.com>2014-03-17 10:02:22 -0400
commitb5756056a7b5acba550a7d31a587f3a5b7651e00 (patch)
treec74127db66b4845b2a9ff44b468551dadfeb75f6 /src/mongo/s
parentecc00b5bfba8961e0884e591ba1866eeb0cb67ab (diff)
downloadmongo-b5756056a7b5acba550a7d31a587f3a5b7651e00.tar.gz
SERVER-12977 disallow empty write batches
Also fix shell batch processing to avoid extra empty batches.
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/cluster_write.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/s/cluster_write.cpp b/src/mongo/s/cluster_write.cpp
index 5a8e690d61e..8b2008f02b8 100644
--- a/src/mongo/s/cluster_write.cpp
+++ b/src/mongo/s/cluster_write.cpp
@@ -333,8 +333,15 @@ namespace mongo {
return;
}
+ if ( request.sizeWriteOps() == 0u ) {
+ toBatchError( Status( ErrorCodes::InvalidLength,
+ "no write ops were included in the batch" ),
+ response );
+ return;
+ }
+
if ( request.sizeWriteOps() > BatchedCommandRequest::kMaxWriteBatchSize ) {
- toBatchError( Status( ErrorCodes::FailedToParse,
+ toBatchError( Status( ErrorCodes::InvalidLength,
str::stream() << "exceeded maximum write batch size of "
<< BatchedCommandRequest::kMaxWriteBatchSize ),
response );