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

Tailable cursors do not honor $maxScan values

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.6.0, 2.6.1-rc0
    • Querying
    • None
    • ALL
    • Hide

      db.createCollection("tailable", {size: 1000000, capped: true});
       
      for (var i = 0; i < 10000; i++) {
          db.tailable.insert({i: i});
      }
       
      db.tailable.find().addOption(DBQuery.Option.tailable)._addSpecial("$maxScan", 100).explain();

      Show
      db.createCollection("tailable", {size: 1000000, capped: true});   for (var i = 0; i < 10000; i++) { db.tailable.insert({i: i}); }   db.tailable.find().addOption(DBQuery.Option.tailable)._addSpecial("$maxScan", 100).explain();

    Description

      In 2.4.10, tailable cursors seem to honor $maxScan values:

      > db.tailable.find().addOption(DBQuery.Option.tailable)._addSpecial("$maxScan", 100).explain();
      {
      	"cursor" : "ForwardCappedCursor",
      	"isMultiKey" : false,
      	"n" : 100,
      	"nscannedObjects" : 100,
      	"nscanned" : 101,
      	"nscannedObjectsAllPlans" : 100,
      	"nscannedAllPlans" : 101,
      ...

      In 2.6 and 2.6.1-rc0, they do not:

      > db.tailable.find().addOption(DBQuery.Option.tailable)._addSpecial("$maxScan", 100).explain();
      {
      	"cursor" : "BasicCursor",
      	"isMultiKey" : false,
      	"n" : 10000,
      	"nscannedObjects" : 10000,
      	"nscanned" : 10000,
      	"nscannedObjectsAllPlans" : 10000,
      	"nscannedAllPlans" : 10000,
      ...

      Attachments

        Activity

          People

            Unassigned Unassigned
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: