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}

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 5.0.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • ALL
    • Execution Team 2021-05-17
    • 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

        Activity

          People

            yuhong.zhang@mongodb.com Yuhong Zhang
            yuhong.zhang@mongodb.com Yuhong Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: