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

Tailing oplog on secondary fails with CappedPositionLost

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 3.6.3, 3.7.2
    • Affects Version/s: 3.6.0, 3.6.1
    • Component/s: Querying
    • None
    • Fully Compatible
    • ALL
    • v3.6
    • Storage 2018-01-29

      function repro() {
      
          uri="mongodb://localhost:27017/test?replicaSet=rs"
      
          # tail the oplog on the secondary
          mongo $uri --eval '
              var ol = db.getSiblingDB("local").oplog.rs
              var c = ol.find({}).readPref("secondaryPreferred").tailable({isAwaitData: true})
              var i = 0
              while (true) {
                  c.forEach(function (o) {
                      print(i++, o.wall)
                  })
              }
          ' &
      
          sleep 5
      
          # generate some traffic
          mongo $uri --eval '
              while (true)
                  db.c.insert({})
          '
      }
      

      Fails reliably with

      2018-01-09T15:56:56.703-0500 E QUERY    [thread1] Error: getMore command failed: {
      	"ok" : 0,
      	"errmsg" : "PlanExecutor killed: CappedPositionLost: CollectionScan died due to failure to restore tailable cursor position. Last seen record id: RecordId(6509157867780571265)",
      	"code" : 175,
      	"codeName" : "QueryPlanKilled",
      	"operationTime" : Timestamp(1515531416, 129),
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1515531416, 131),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      } :
      

      Does not fail on the primary.

        1. repro.js
          2 kB
          Charlie Swanson
        2. server32606_debug.patch
          7 kB
          Daniel Gottlieb

            Assignee:
            geert.bosch@mongodb.com Geert Bosch
            Reporter:
            bruce.lucas@mongodb.com Bruce Lucas (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved: