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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • Execution Team 2021-05-17
    • 168
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Yuhong Zhang
            Reporter:
            Yuhong Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: