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

Tailing oplog on secondary fails with CappedPositionLost

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 3.6.0, 3.6.1
    • Fix Version/s: 3.6.3, 3.7.2
    • Component/s: Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.6
    • Sprint:
      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. repro.js
          2 kB
        2. server32606_debug.patch
          7 kB

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                21 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: