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

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

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

      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@mongodb.com Louis Williams
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: