[SERVER-10656] Cursor hangs on compound index query Created: 30/Aug/13  Updated: 10/Dec/14  Resolved: 19/Mar/14

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.4.5
Fix Version/s: None

Type: Bug Priority: Blocker - P1
Reporter: Matthew Cross Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

osx ssd 8gb


Attachments: Text File mongo.log    
Operating System: OS X
Steps To Reproduce:

Database with 8M items.

Collection has this basic structure.
{ xys: [ { xy:

{ x: 11111, y: 11111 }

} ] }

Index looks like this
{
"v" : 1,
"key" :

{ "xys.xy.x" : 1, "xys.xy.y" : 1 }

,
"ns" : "db.foos",
"name" : "xys.xy.x_1_xys.xy.y_1"
}

Query looks like this:

BasicDBObject query = new BasicDBObject("xys",
new BasicDBObject("$elemMatch",
new BasicDBObject("xy.x",new BasicDBObject("$gt",boundingBox.minX).append("$lt", boundingBox.maxX))
.append("xy.y",new BasicDBObject("$gt",boundingBox.minY).append("$lt", boundingBox.maxY))
)
);

Then just iterate over the results using the latest java driver.

All the expected results come back but then the cursor remains open for ages.

I have also attached the log showing the excessive yields after the final results.

Participants:

 Description   

I am doing a range query that uses a compound index. It covers about 1.7M results. In java I run the query and iterate over all the results. After the last result is read the cursor.hasNext() function hangs for over 8 minutes.

If I look at the log when it finally returns it has yielded over 843,000 times.

There is no other load on the server or the machine.

What's going on here?



 Comments   
Comment by Stennie Steneker (Inactive) [ 19/Mar/14 ]

Hi Matthew,

Given that we have thus far been unable to reproduce this issue, I'm going to close it out.

If you do see any further recurrences, please feel free to reopen with additional details.

Thanks,
Stephen

Comment by Daniel Pasette (Inactive) [ 08/Sep/13 ]

Yes, I was asking if this was reproducible.
Could you attach another log file with log level set to 5 and attach the log to this ticket? The documentation shows how you can set the log level on a running instance: http://docs.mongodb.org/manual/reference/parameters/#param.logLevel

Doesn't appear to have anything to do with the driver, but just in case, would you be able to run the experiment from the mongo shell?

Comment by Matthew Cross [ 03/Sep/13 ]

I'm not sure what you mean. I tried it this morning and I still see this hanging behavior if that is what you are asking. I get most or all of the results and then the cursor waits on hasNext for minutes.

Let me know what additional information if any, you need.

Comment by Daniel Pasette (Inactive) [ 02/Sep/13 ]

The log file seems to indicate the cursor finished iterating over the results. Have you been able to reproduce the same behavior?

Comment by Matthew Cross [ 30/Aug/13 ]

The logs seem to disagree with my assertion that I have all of my results back. I will research further. In any case the query goes out to lunch for 8 minutes after returning 1.675M results in 116 seconds.

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