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

Correctly set prevOpTime of time-series oplog entries by a batched retryable write inserts with {ordered: true}

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0.0-rc0
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Execution Team 2021-05-17
    • Linked BF Score:
      168

      Description

      When running a command inserting a batch of time-series documents resulting in multiple buckets, multiple oplog entries will be generated. With {ordered: true} option, currently the field "prevOpTime" in each oplog entry will be set to the same zero timestamp instead of the timestamp of the previous operation.

      In the test when setting the command with {ordered: true}, the oplog entries in donorPrimary.getDB("local").oplog.rs look like 

      {
          "lsid" : {
              "id" : UUID("ff76a7f5-239c-4c67-a6ef-d6930899ef5a"),
              "uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=")
          },
          "txnNumber" : NumberLong(0),
          "op" : "i",
          ...,
          "ts" : Timestamp(1619470064, 5),
          ...,
          "stmtId" : [
              0,
              1,
              2
          ],
          "prevOpTime" : {
              "ts" : Timestamp(0, 0),
              "t" : NumberLong(-1)
          }
      },
      {
          "lsid" : {
              "id" : UUID("ff76a7f5-239c-4c67-a6ef-d6930899ef5a"),
              "uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=")
          },
          "txnNumber" : NumberLong(0),
          "op" : "u",
          ...,
          "ts" : Timestamp(1619470064, 6),
          ...,
          "stmtId" : [
              3,
              4,
              5
          ],
          "prevOpTime" : {
              "ts" : Timestamp(0, 0),
              "t" : NumberLong(-1)
          }
      },
      

      The field "prevOpTime" in the second oplog entry should be the field "ts" in the first oplog entry.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              yuhong.zhang Yuhong Zhang
              Reporter:
              yuhong.zhang Yuhong Zhang
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: