[SERVER-56370] Correctly set prevOpTime of time-series oplog entries by a batched retryable write inserts with {ordered: true} Created: 27/Apr/21  Updated: 29/Oct/23  Resolved: 11/May/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Yuhong Zhang Assignee: Yuhong Zhang
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Related
is related to SERVER-55268 Add jstests for tenant migrations wit... Closed
is related to SERVER-54816 Improve performance for time-series i... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2021-05-17
Participants:
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.



 Comments   
Comment by Githook User [ 11/May/21 ]

Author:

{'name': 'Yuhong Zhang', 'email': 'danielzhangyh@gmail.com', 'username': 'YuhongZhang98'}

Message: SERVER-56370 Correctly set prevOpTime of time-series oplog entries by a batched retryable write inserts with

{ordered: true}

Branch: master
https://github.com/mongodb/mongo/commit/a090d9887e0c13128d058bd1c7faf0d39686b5aa

Generated at Thu Feb 08 05:39:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.