[SERVER-18955] mongoS doesn't set batch size (and keeps the old one, 0) on getMore if performed on first _cursor->more() Created: 12/Jun/15  Updated: 03/Jan/18  Resolved: 30/Jun/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.6.10, 3.0.3, 3.1.4
Fix Version/s: 2.6.11, 3.0.5, 3.1.6

Type: Bug Priority: Major - P3
Reporter: Charlie Page Assignee: Charlie Page
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-19317 Run all tests against large sharded c... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: Sharding 6 07/17/15
Participants:
Case:

 Description   

mongos in cursors.cpp only sets batch size (and always sets batch size) after a document is returned. This leads to the batch size being set to 0 every time a full load of ntoreturn documents are sent back to the client. If the cursor is exhausted at that point, then the next getMore request to the mongoD (which will be sent on the next will request to the mongoS) will have a batch size of 0. This returns all results and can lead to cursors timing out.

Moving the setBatchSize before the loop starts and after all breaks (so no useless work is performed setting an invalid batch size on break) should fix this.



 Comments   
Comment by Githook User [ 01/Jul/15 ]

Author:

{u'username': u'lissom', u'name': u'charlie.page@gmail.com', u'email': u'charlie.page@gmail.com'}

Message: SERVER-18955 Have ShardedClientCursor set the batch size before all calls

comment update

Signed-off-by: Randolph Tan <randolph@10gen.com>
(cherry picked from commit 52840b1595449155acecb1a7401a332cbdb53fad)

Conflicts:
src/mongo/s/cursors.cpp
src/mongo/s/cursors.h

(cherry picked from commit 61349d3c00c5a6a4fecfcd12f528574d25ba1bf1)
Branch: v2.6
https://github.com/mongodb/mongo/commit/dd56a8285ff95bcb4bf185710a483a150ccf29ca

Comment by Githook User [ 01/Jul/15 ]

Author:

{u'username': u'lissom', u'name': u'charlie.page@gmail.com', u'email': u'charlie.page@gmail.com'}

Message: SERVER-18955 Have ShardedClientCursor set the batch size before all calls

comment update

Signed-off-by: Randolph Tan <randolph@10gen.com>
(cherry picked from commit 52840b1595449155acecb1a7401a332cbdb53fad)

Conflicts:
src/mongo/s/cursors.cpp
src/mongo/s/cursors.h
Branch: v3.0
https://github.com/mongodb/mongo/commit/61349d3c00c5a6a4fecfcd12f528574d25ba1bf1

Comment by Githook User [ 30/Jun/15 ]

Author:

{u'username': u'lissom', u'name': u'charlie.page@gmail.com', u'email': u'charlie.page@gmail.com'}

Message: SERVER-18955 Have ShardedClientCursor set the batch size before all calls

comment update

Signed-off-by: Randolph Tan <randolph@10gen.com>
Branch: master
https://github.com/mongodb/mongo/commit/52840b1595449155acecb1a7401a332cbdb53fad

Comment by Randolph Tan [ 17/Jun/15 ]

Note: the key to reproducing this issue is to make sure that the mongos will open cursors to multiple shards.

Generated at Thu Feb 08 03:49:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.