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

Use tid field to construct namespace for applyOps and transactions during oplog application

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • Server Serverless 2022-09-05, Server Serverless 2022-09-19, Server Serverless 2022-10-03, Server Serverless 2022-10-31
    • 163

      An applyOps oplog entry contains a list of individual ops to apply in its "o" field. Each of these ops should have a "tid" field, and the outer applyOps oplog entry should have a "tid" field as well, i.e. it should look something like:

      {
      op: "c",
      "ns" : "<dbName>.$cmd",
      "tid": <tenantId>,
      "o" : {
      "applyOps" : [
          {
          "op" : "i",
          "ns" : <dbName>.<coll>,
          "tid": <tenantId>,
          "o" : { ...},
          }
      ]
      }
      

      Change applyOps to take a DatabaseName obj, and then pass the DatabaseName object from the nss field to applyOps in applyApplyOpsOplogEntry, so that the DatabseName can be used to lock the db. Then, in _applyOps we should construct the NamespaceString for each individual op using the "nss" and "tid" fields.

      When writing oplog entries for ops that occurred as part of a transaction, we log an applyOps entry upon either prepareTransaction or commitTransaction (for an unprepared transaction). When applying these operations during oplog application, we'll apply each op individually.

            Assignee:
            janna.golden@mongodb.com Janna Golden
            Reporter:
            janna.golden@mongodb.com Janna Golden
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: