[SERVER-62764] Include "tid" field in insert oplog entries Created: 19/Jan/22  Updated: 29/Oct/23  Resolved: 31/May/22

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

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

Issue Links:
Depends
depends on SERVER-64608 Add tenantID to NamespaceString Closed
Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2022-02-07, Server Serverless 2022-04-18, Server Serverless 2022-05-02, Server Serverless 2022-05-16, Server Serverless 2022-05-30, Server Serverless 2022-06-13
Participants:

 Description   

The insert path calls OpObserver::onInserts() (here and here) in order to log an op in the oplog.

OpObserverImpl::onInserts() constructs oplog entries differently depending on whether the op is part of a multi-document transaction or not. If it is part of a transaction, we construct the oplog entry by calling MutableOplogEntry::makeInsertOperation. In MutableOplogEntry::makeInsertOperation, set the "tid" field on the ReplOperation constructed there using the tenantId on the NamespaceString passed in if featureFlagRequireTenantId is set. If the op is not part of a transaction, we construct the entry directly and can just set the tid field here (again only set it if featureFlagRequireTenantId is set). We can grab the tenantId from the NamespaceString object passed in.

Let's add a test case to the OpObserverImplTest and check that OpObserverImpl::onInserts() behaves as expected when called both in a multi-document transaction and not.



 Comments   
Comment by Githook User [ 25/May/22 ]

Author:

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

Message: SERVER-62764 Write tenantId fields to oplog entries on insert
Branch: master
https://github.com/mongodb/mongo/commit/81b335064ccd6da6d7d4e10559fd29e517baa483

Comment by Githook User [ 25/May/22 ]

Author:

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

Message: SERVER-62764 Write tenantId fields to oplog entries on insert
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/050e09d7f47dc23b072dd5cd18efdccf6200cd74

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