[SERVER-62880] Use tid field to construct namespace for applyOps and transactions during oplog application Created: 21/Jan/22  Updated: 29/Oct/23  Resolved: 24/Oct/22

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

Type: Task Priority: Major - P3
Reporter: Janna Golden Assignee: Janna Golden
Resolution: Fixed Votes: 0
Labels: auto-reverted
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-69726 Run multitenancy tests on replica sets Closed
Gantt Dependency
has to be done before SERVER-70540 Enable multi-tenancy support for oplo... Closed
Problem/Incident
Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2022-09-05, Server Serverless 2022-09-19, Server Serverless 2022-10-03, Server Serverless 2022-10-31
Participants:
Linked BF Score: 163

 Description   

An applyOps oplog entry contains a list of individual ops to apply in its "o" field. Each of these ops should have a "tid" field, and the outer applyOps oplog entry should have a "tid" field as well, i.e. it should look something like:

{
op: "c",
"ns" : "<dbName>.$cmd",
"tid": <tenantId>,
"o" : {
"applyOps" : [
    {
    "op" : "i",
    "ns" : <dbName>.<coll>,
    "tid": <tenantId>,
    "o" : { ...},
    }
]
}

Change applyOps to take a DatabaseName obj, and then pass the DatabaseName object from the nss field to applyOps in applyApplyOpsOplogEntry, so that the DatabseName can be used to lock the db. Then, in _applyOps we should construct the NamespaceString for each individual op using the "nss" and "tid" fields.

When writing oplog entries for ops that occurred as part of a transaction, we log an applyOps entry upon either prepareTransaction or commitTransaction (for an unprepared transaction). When applying these operations during oplog application, we'll apply each op individually.



 Comments   
Comment by Githook User [ 24/Oct/22 ]

Author:

{'name': 'jannaerin', 'email': 'golden.janna@gmail.com', 'username': 'jannaerin'}

Message: SERVER-62880 Use tid field to apply applyOps and transactions oplog entries
Branch: master
https://github.com/mongodb/mongo/commit/166b7766db704b1eaa210a533e183c5d4456fdf5

Comment by xgen-buildbaron-user [ 22/Oct/22 ]

Ticket re-opened due to revert. auth_audit began a consistent failure of jstests/auth/commands_user_defined_roles.js,jstests/auth/commands_builtin_roles_standalone.js

Comment by Githook User [ 22/Oct/22 ]

Author:

{'name': 'auto-revert-processor', 'email': 'dev-prod-dag@mongodb.com'}

Message: Revert "SERVER-62880 Use tid field to apply applyOps and transactions oplog entries"

This reverts commit 9a60ad4e90d5e2faccedcea26e31b1992676d395.
Branch: master
https://github.com/mongodb/mongo/commit/e5fa2aabe4ddfe1d18d94e326d1ef3dc4ca2af26

Comment by Githook User [ 21/Oct/22 ]

Author:

{'name': 'jannaerin', 'email': 'golden.janna@gmail.com', 'username': 'jannaerin'}

Message: SERVER-62880 Use tid field to apply applyOps and transactions oplog entries
Branch: master
https://github.com/mongodb/mongo/commit/9a60ad4e90d5e2faccedcea26e31b1992676d395

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