[JAVA-2827] Fix maxAwaitTime test for AggregateOperation to make sure the pipeline creates a tailable cursor Created: 12/Apr/18  Updated: 28/Oct/23  Resolved: 22/Jun/18

Status: Closed
Project: Java Driver
Component/s: Test Coverage
Affects Version/s: None
Fix Version/s: 3.8.0

Type: Improvement Priority: Major - P3
Reporter: Ross Lawley Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Updated Description

The server does not support setting maxTimeMS on getMore unless the cursor is tailable. This is exposed via the maxAwaitTime option for aggregate helper.

Update the test for this to ensure that the aggregate pipeline creates a tailable cursor by adding a $changeStream stage.

Original Description

Latest MongoD's reporting errors and failing in Evergreen.

Query failed with error code 2 and error message 'cannot set maxTimeMS on getMore command for a non-awaitData cursor'

Commands sent to server:

{
  "aggregate" : "JAVA2827",
  "pipeline" : [],
  "cursor" : {
    "batchSize" : 2
  },
  "$db" : "test",
  "$readPreference" : {
    "mode" : "primaryPreferred"
  }
}
 
{
  "getMore" : 9162929968295230509,
  "collection" : "JAVA2827",
  "batchSize" : 2,
  "maxTimeMS" : 5000,
  "$db" : "test",
  "$readPreference" : {
    "mode" : "primaryPreferred"
  }
}



 Comments   
Comment by Githook User [ 22/Jun/18 ]

Author:

{'username': 'jyemin', 'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com'}

Message: JAVA-2827: Re-enable maxAwaitTime test for AggregateOperation

The server only supports maxTimeMS on getMore for tailable cursors,
so added a $changeStream stage to the pipeline.

Note that this is not a particularly good test, since it doesn't
check to see whether maxTimeMS has been added to the getMore command.
It just assumes it has been and is just checking that no exception
is thrown.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/216df07483e3e15fb6e445c53bbe22f41afc21b1

Comment by Jeffrey Yemin [ 12/Apr/18 ]

CC david.storch

Failed against:

db version v3.7.3-420-gfae36f1444
git version: fae36f1444627d28bd18e7395962078a729b940a

Last succeeded against:

db version v3.7.3-295-g9956423bb4
git version: 9956423bb400d54951d2d64deabd6efdbd07752e

If I had to guess I'd pick this commit:

commit 83e1a7097433b98109bbdf67f4ae3eb2421c926f
Author: Charlie Swanson <charlie.swanson@mongodb.com>
Date:   Fri Mar 30 15:54:57 2018 -0400
 
    SERVER-33942 Avoid setting deadline for maxTimeMS on tailable cursors

Comment by Githook User [ 12/Apr/18 ]

Author:

{'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin', 'username': 'jyemin'}

Message: JAVA-2827: Temporarily disable failing test

Will change or re-enable once we determine whether the server will
restore the previous behavior.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/5d45a41e1ac737c0278c0977b35c5121dc392c54

Generated at Thu Feb 08 08:58:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.