ExportXMLWordPrintableJSON

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

      Background

      Size metadata (m) on CRUD oplog entries can include sz (replicated fast count size delta), h (continuous internode validation per-document hash), or both. The primary can emit an entry with h and no sz: setSizeMetadata in op_observer_impl.cpp attaches m whenever either field is set. However, we haven't clearly defined whether that case is valid. Each consumer handles it on its own, and the code and comments disagree with each other.

      Current inconsistencies

      • replicated_fast_count_delta_utils.cpp (LOGV2_WARNING 13321400): the comment says CIV strictly depends on replicated fast count, so "if the sz is absent, the hash should be absent too", which means the case should never happen. The code still treats the hash as a real contribution, folds it in against a zero size/count delta when ui is present, and logs a warning on every occurrence.
      • replicated_fast_count_streaming_oplog_delta_accumulator.cpp (tryRecordFastCrud): the comment says such a hash "cannot be folded in" and that Layer 3 will "report it and skip the entry". Layer 3 actually folds it in, so this comment contradicts the delta utils behavior.
      • oplog.cpp (recordHashOnlyDelta, added in SERVER-136298): duplicates the fold-against-zero handling for the secondary-side checkpoint validator. It logs at rate-limited warning/debug(2) (13629800) and silently drops the entry when ui is missing. It's called from the single insert, grouped insert, update, and delete apply paths.
      • Each case decides for itself whether this situation is expected, warning-worthy, or an error, and these choices are inconsistent.

      Proposal

      1.  it's illegal for a m.h to appear without m.sz. Stop the primary from producing it in setSizeMetadata, then make consumers handle it consistently with a single choice: either tassert/massert, or skip it and count it.
      2. Potentially mmove the handling into one shared helper that the delta utils, the streaming accumulator, and the oplog.cpp checkpoint validator path all call, instead of each having its own branch.
      3. Add a server status / OTel metric that counts entries carrying h without sz (and entries missing ui), so we can see how often this happens in the field. This resolves the TODO(SERVER-138104) in oplog.cpp.
      4. Fix the stale comments in the streaming accumulator and delta utils so they match the chosen behavior.

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

              Created:
              Updated: