The onCommit handler in IndexBuildBlock::init() should capture pointers by value

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.0.0-rc0
    • Affects Version/s: None
    • Component/s: Storage
    • None
    • Fully Compatible
    • ALL
    • Storage NYC 2018-05-07
    • 56
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      This following code captures the this pointer by reference. When the onCommit handler is run, the class has already been destructed and the pointer's value has changed. _opCtx, _entry, and _collection should be captured by value.

              _opCtx->recoveryUnit()->onCommit([&] {
                  // This will prevent the unfinished index from being visible on index iterators.
                  auto minVisible =
                      repl::ReplicationCoordinator::get(_opCtx)->getMinimumVisibleSnapshot(_opCtx);
                  _entry->setMinimumVisibleSnapshot(minVisible);
                  _collection->setMinimumVisibleSnapshot(minVisible);
              });
      

            Assignee:
            Louis Williams
            Reporter:
            Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: