[SERVER-69233] Incorrect top-level tenant id in transactional oplog entry Created: 29/Aug/22  Updated: 29/Oct/23  Resolved: 08/Sep/22

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

Type: Bug Priority: Major - P3
Reporter: Rishab Joshi (Inactive) Assignee: Hugh Tong (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-71385 logOplogEntries() retrieves tenant ID... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Server Serverless 2022-09-05, Server Serverless 2022-09-19
Participants:

 Description   

 

The tenant id in the top level applyOps entry is incorrect. The top-level tenant id contains the kSystemTenatId and not the tenant id.

For eg, the correct tenant id here is ObjectId("6308e6f7498ed88d8073b94a") and not ObjectId("156500000102030405060708"):

{
        "lsid" : {
            "id" : UUID("7d243c06-aac4-4f7f-b337-64e34f39c622"),
            "uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=")
        },
        "txnNumber" : NumberLong(0),
        "op" : "c",
        "tid" : ObjectId("156500000102030405060708"),
        "ns" : "admin.$cmd",
        "o" : {
            "applyOps" : [
                {
                    "op" : "c",
                    "tid" : ObjectId("6308e6f7498ed88d8073b94a"),
                    "ns" : "motill.$cmd",
                    "ui" : UUID("c2dd4c81-5557-4b80-8993-c700d090305f"),
                    "o" : {
                        "create" : "thedogss",
                        "idIndex" : {
                            "v" : 2,
                            "key" : {
                                "_id" : 1
                            },
                            "name" : "_id_"
                        }
                    }
                },

The logApplyOps function hard codes the kSystemTenatId. This method should set the tenant id with the one in the nested applyOps entry. The applyOps block should be associated with only one tenant id as such it should be safe to extract the tenant id from the nested applyOps entry and set it to the top-level tenant id.

The correct tenant id can be extracted from the operationIter and passed to the logApplyOps function.

 



 Comments   
Comment by Githook User [ 01/Sep/22 ]

Author:

{'name': 'Hugh Tong', 'email': 'hugh.tong@mongodb.com', 'username': 'cortrain'}

Message: SERVER-69233 Replace transaction top level tenantId with operation doc tenantId
Branch: master
https://github.com/mongodb/mongo/commit/07a8f061b8c63c799c1d6ecbc13656eaae0d1922

Generated at Thu Feb 08 06:12:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.