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

change index build initial write timestamp logic

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.2.1, 4.3.1
    • None
    • Index Maintenance
    • None
    • Fully Compatible
    • v4.2
    • Execution Team 2019-08-26
    • 69

    Description

      The code currently does this to timestamp the initial catalog write for index builds:

             if (opCtx->recoveryUnit()->getCommitTimestamp().isNull() &&
                  replCoord->canAcceptWritesForDatabase(opCtx, "admin")) {
                  // Only primaries must timestamp this write. Secondaries run this from within a
                  // `TimestampBlock`. Primaries performing an index build via `applyOps` may have a
                  // wrapping commit timestamp that will be used instead.
                  opCtx->getServiceContext()->getOpObserver()->onOpMessage(
                      opCtx,
                      BSON("msg" << std::string(str::stream() << "Creating indexes. Coll: " << ns)));
              }
      

      Instead of canAcceptWritesForDatabase(), which incorrectly captures times when a primary is attempting to step down but hasn't yet, we can check for the node state to be STARTUP2; this bit of logic is attempting to differentiate between normal index builds that must be timestamped and index builds that are part of initial sync and must not be timestamped.

      Attachments

        Activity

          People

            milkie@mongodb.com Eric Milkie
            milkie@mongodb.com Eric Milkie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: