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

change index build initial write timestamp logic

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.1, 4.3.1
    • Component/s: Indexing
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v4.2
    • Sprint:
      Execution Team 2019-08-26
    • Linked BF Score:
      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

          Issue Links

            Activity

              People

              Assignee:
              milkie Eric Milkie
              Reporter:
              milkie Eric Milkie
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: