Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-61265

XDCR - <key, revID> pair as "UniqueKey" may not be unique to distinguish mutations over dcp stream

    XMLWordPrintable

Details

    Description

      We construct "UniqueKey" using docKey and docRevSeqNo. But since we skip targetCR with set_with_meta, we can have multiple mutations (atleast two mutations I can think of) with the same revID, breaking the uniqueness promise. Might need to look at monotonic integers for constructing unique keys.
      KV team reasoning - 
      https://couchbase.slack.com/archives/CFJDXSGUA/p1711111783349729?thread_ts=1711110695.923309&cid=CFJDXSGUA

      As of now, we know of 3 reasons as to when this situation can occur:

      1. RevID-based CR used. Source mutation wins even though revIDs are same, based on higher CAS/expiry/flags/xattrs.
      2. CAS-based CR used. Source wins because of higher CAS but revIDs are equal.
      3. Any CR mode. Cluster A has no HLV, Cluster B has no HLV. A mutation from cluster A is replicated to cluster B, which is replicated back to A as a special case where CR is done using xattrs (source wins when source_has_xattrs && !target_has_xattrs)

      (1) and (2) - two mutations with same <key, revID> can be in the same xmem batch and hence can break things.
      (3) - two such mutations won't be in a single xmem batch and shouldn't be a problem.

      Attachments

        For Gerrit Dashboard: MB-61265
        # Subject Branch Project Status CR V

        Activity

          People

            sumukh.bhat Sumukh Bhat
            sumukh.bhat Sumukh Bhat
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty