diff options
author | Greg Studer <greg@10gen.com> | 2014-03-14 11:59:18 -0400 |
---|---|---|
committer | Greg Studer <greg@10gen.com> | 2014-03-17 10:02:22 -0400 |
commit | b5756056a7b5acba550a7d31a587f3a5b7651e00 (patch) | |
tree | c74127db66b4845b2a9ff44b468551dadfeb75f6 /src/mongo/s | |
parent | ecc00b5bfba8961e0884e591ba1866eeb0cb67ab (diff) | |
download | mongo-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.cpp | 9 |
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 ); |