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

SlaveOK queries and getMores need to go to same member

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.7.6
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL

      > var rt = new ReplSetTest(

      {nodes:7, name:'slave_ok_no_master'}

      );
      > rt.startSet(

      {oplogSize:200}

      )
      > rt.initiate()

      Start up a mongos with rt.getURL() as a shard() and connect

      > s='x'
      x
      > while (s.length < 128*1024) s += s; s.length
      131072
      > for (var i=0; i<1000; i++) db.foo.insert(

      {s:s}

      )
      [takes a little while]
      > db.foo.count()
      1000
      > db.foo.find().itcount()
      1000
      > db.getMongo().setSlaveOk()
      > db.foo.find().itcount()
      Fri Feb 4 17:18:30 Error: getMore: cursor didn't exist on server, possible restart or timeout? shell/query.js:104

      It looks like the works/doesn't work threshold is 32/33 which is the same threshold where a the results won't fit into a single message:

      > db.foo.find().limit(32).itcount()
      32
      > db.foo.find().limit(33).itcount()
      Fri Feb 4 17:28:59 Error: getMore: cursor didn't exist on server, possible restart or timeout? shell/query.js:104
      > Object.bsonsize({_id:ObjectId(), s:s})*32
      4195264
      > Object.bsonsize({_id:ObjectId(), s:s})*33
      4326366
      > 4*1024*1024
      4194304

      I added some debugging info into the code and it looks like the getMore is going to the master.

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: