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

The getMore command should not take a nested AutoGetCollectionForReadCommand instance for agg cursors when waitAfterPinningCursorBeforeGetMoreBatch is enabled

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.9.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Query 2021-02-08
    • 25

      CommonMongodProcessInterface::getIndexStats() instantiates an AutoGetCollectionForReadCommand instance. That code can be called by the getMore command per this stack trace in the linked BF.

      .........
      "Frame","attr":{"frame":{"a":"7FA593352F9C","b":"7FA593347000","o":"BF9C","s":"_ZN5mongo24AutoGetCollectionForReadC2EPNS_16OperationContextERKNS_21NamespaceStringOrUUIDENS_25AutoGetCollectionViewModeENS_6Date_tE","s+":"3C"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.264+0000 d20521| 2021-01-08T14:59:41.262+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA593357962","b":"7FA593347000","o":"10962","s":"_ZN5mongo35AutoGetCollectionForReadCommandBaseINS_24AutoGetCollectionForReadEEC2EPNS_16OperationContextERKNS_21NamespaceStringOrUUIDENS_25AutoGetCollectionViewModeENS_6Date_tENS_16AutoStatsTracker7LogModeE","s+":"32"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.265+0000 d20521| 2021-01-08T14:59:41.262+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA595B5FA0E","b":"7FA595B41000","o":"1EA0E","s":"_ZN5mongo28CommonMongodProcessInterface13getIndexStatsEPNS_16OperationContextERKNS_15NamespaceStringENS_10StringDataEb","s+":"15E"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.265+0000 d20521| 2021-01-08T14:59:41.262+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA592F52B7D","b":"7FA592E2B000","o":"127B7D","s":"_ZN5mongo24DocumentSourceIndexStats9doGetNextEv","s+":"ED"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.265+0000 d20521| 2021-01-08T14:59:41.262+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA592F011E4","b":"7FA592E2B000","o":"D61E4","s":"_ZN5mongo14DocumentSource7getNextEv","s+":"44"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.265+0000 d20521| 2021-01-08T14:59:41.262+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA592F4BE03","b":"7FA592E2B000","o":"120E03","s":"_ZN5mongo19DocumentSourceGroup10initializeEv","s+":"63"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.265+0000 d20521| 2021-01-08T14:59:41.262+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA592F4D0A9","b":"7FA592E2B000","o":"1220A9","s":"_ZN5mongo19DocumentSourceGroup9doGetNextEv","s+":"A9"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.265+0000 d20521| 2021-01-08T14:59:41.265+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA592F011E4","b":"7FA592E2B000","o":"D61E4","s":"_ZN5mongo14DocumentSource7getNextEv","s+":"44"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.265+0000 d20521| 2021-01-08T14:59:41.265+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA592FBDDEC","b":"7FA592E2B000","o":"192DEC","s":"_ZN5mongo8Pipeline7getNextEv","s+":"3C"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.266+0000 d20521| 2021-01-08T14:59:41.265+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA59416CCBB","b":"7FA594013000","o":"159CBB","s":"_ZN5mongo20PlanExecutorPipeline8_getNextEv","s+":"2B"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.266+0000 d20521| 2021-01-08T14:59:41.266+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA59416CD8F","b":"7FA594013000","o":"159D8F","s":"_ZN5mongo20PlanExecutorPipeline15getNextDocumentEPNS_8DocumentEPNS_8RecordIdE","s+":"4F"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.266+0000 d20521| 2021-01-08T14:59:41.266+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA59416CF0E","b":"7FA594013000","o":"159F0E","s":"_ZN5mongo20PlanExecutorPipeline7getNextEPNS_7BSONObjEPNS_8RecordIdE","s+":"EE"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.266+0000 d20521| 2021-01-08T14:59:41.266+00:00 I  CONTROL  31445   [conn53] 
      "Frame","attr":{"frame":{"a":"7FA58E1EF66B","b":"7FA58E139000","o":"B666B","s":"_ZN5mongo12_GLOBAL__N_110GetMoreCmd10Invocation28acquireLocksAndIterateCursorEPNS_16OperationContextEPNS_3rpc21ReplyBuilderInterfaceEPNS_13CursorManagerERNS_15ClientCursorPinEPNS_5CurOpE.isra.1022","s+":"105B"}}[js_test:kill_pinned_cursor] 2021-01-08T14:59:41.273+0000 d20521| 2021-01-08T14:59:41.273+00:00 I  CONTROL  31445   [conn53] "Frame","attr":{"frame":{"a":"7FA58E1F153A","b":"7FA58E139000","o":"B853A","s":"_ZN5mongo12_GLOBAL__N_110GetMoreCmd10Invocation3runEPNS_16OperationContextEPNS_3rpc21ReplyBuilderInterfaceE","s+":"19A"}}
      .........
      

      The invariant problem showing this stack trace has been fixed by SERVER-53701. However, the invariant was only possible to hit if the AutoGetCollectionForReadCommand instance was nested under a higher level lock helper instance. AutoGetCollectionForReadCommand contains an AutoStatsTracker and handles CurrentOp and Top entry updates: there's already a higher level AutoStatsTracker for the code path in question.

      I suspect the getMore command has this AutoGetCollectionForRead instance instantiated when calling into CommonMongodProcessInterface::getIndexStats().

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: