Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-10656

Cursor hangs on compound index query

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Blocker - P1
    • Resolution: Cannot Reproduce
    • 2.4.5
    • None
    • Querying
    • None
    • osx ssd 8gb
    • OS X
    • Hide

      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.

      Show
      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.

    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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            mattx Matthew Cross
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: