Verify document hash (h) for updates on non-primaries

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      On non-primaries, verify update oplog entries: after applying the update, use the RID lookup post-image and recompute its hash, then compare this hashed value against the primary's h.

      On a mismatch, fassert with a stack crash until we have different modes for handling a mismatch.

      Runs only on non-primaries (OplogApplication::Mode::kSecondary), with the feature flag on, for supported collections, and only when h is present. We may want to add a helper for checking these conditions.

      Acceptance criteria

      • After applying an update on a non-primary, the document's post-image is available from the RID lookup. The hash (SHA-256) of the document's post-image must be computed and compared against h.
      • On mismatch, fassert and crash.
      • Skipped on the primary, when the feature flag is off, on unsupported collections, and when h is absent.
      • No delete/insert handling (done in SERVER-128533 and SERVER-128516 respectively)
      • Unit-test!
        • Round-trip / happy path: The recomputed h and size match the primary's h and no mismatch is reported.
        • Mismatch detected: when the h values diverge, the comparison reports a mismatch.
        • Without the feature flag or without h, we don't perform the check.
        • Non-steady-state modes (initial sync, recovering) neither generate nor compare h.
        • Unsupported collections, and entries without h, are skipped.
        • Any helper functions that we use that can be unit tested are also unit-tested.

            Assignee:
            Unassigned
            Reporter:
            Stephanie Eristoff
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: