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

[4.2] IndexBuildInterceptor::areAllWritesApplied may return false despite all records being visibly applied

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.2.9
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Execution Team 2020-06-29
    • 10

      Due to a not-well-understood bug in hybrid index builds, we can count (in-memory) more side writes applied than we recorded. This has not caused any data inconsistencies but may cause the server to crash in very rare scenarios.

      As of, SERVER-44507, even when the side-writes table is visibly empty, we will return 'false' when writesRecorded does not equal _numApplied such that this invariant fails.

      • If _numApplied, the number of keys read from the side table and written into the index, is less than writesRecorded, the number inserted into the side table, this suggests there are keys not visible in our snapshot. We could complete the index build with inconsistencies. This was addressed by SERVER-44507.
      • If, however, _numApplied is greater than writesRecorded, this suggests we either double-counted or double-applied a key. Double counting would suggest a bug in the code that tracks inserts. These counters are only used for progress reporting and invariants, so I am not concerned about this. Double-inserting could be concerning, but indexes allow key overwrites, so we would never introduce an inconsistency in this case, we would just overwrite a previous key.

      I would suggest modifying the logic to only return 'false' if _numApplied is less than numRecorded. This partially reverts to the behavior of SERVER-44507, such that we log a warning, but always return 'true' if these counts differ.

            Assignee:
            gregory.noma@mongodb.com Gregory Noma
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: