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

Tailing oplog on secondary fails with CappedPositionLost

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Fixed
    • 3.6.0, 3.6.1
    • 3.6.3, 3.7.2
    • Querying
    • None
    • Fully Compatible
    • ALL
    • v3.6
    • Storage 2018-01-29

    Description

      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.

      Attachments

        1. server32606_debug.patch
          7 kB
        2. repro.js
          2 kB

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: