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

Write and test the query for a tenant migration recipient to copy config.transactions entries for transactions that committed before a particular Timestamp

    • Fully Compatible
    • Sharding 2020-11-02

      The recipient needs to use an aggregate or find to copy the donor's config.transactions entries with "state: committed" and lastWriteOpTime < startApplyingOpTime, and put these entries into the recipient's config.transactions with a null lastWriteOpTime.

      This ticket is to write the exact aggregate pipeline that can be used to do this, and to write a test that uses it to fetch the entries from a donor and insert them into a recipient's config.transactions, then confirm that a commitTransaction retry against the recipient returns success.

      The query shape would look something like:

      // Get all config.transactions entries for committed transactions whose lastWriteOpTime
      // is less than the migration's startApplyingOpTime.
      {
          aggregate: "transactions",
          pipeline: [
              {$match: {"lastWriteOpTime.ts": {$lt: <startApplyingTimestamp>, "state": "committed"}}},
          ],
          readConcern: {level: "majority", afterClusterTime: <startApplyingTimestamp>},
          hint: "_id_",
          cursor: {},
      }
      

            Assignee:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: