[SERVER-62395] Use tid field to construct namespace when applying non-txn commands during oplog application Created: 06/Jan/22  Updated: 29/Oct/23  Resolved: 19/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-57867 Introduce sys-perf testing for PM-2334 Backlog
has to be done before SERVER-69115 Enable writing to the change collecti... Closed
Problem/Incident
Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2022-08-22, Server Serverless 2022-09-05, Server Serverless 2022-09-19, Server Serverless 2022-10-03, Server Serverless 2022-10-17, Server Serverless 2022-10-31
Participants:
Linked BF Score: 0

 Description   

Commands are applied in applyCommand_inlock (called here in OplogApplierUtils::applyOplogEntryOrGroupedInsertsCommon).

Each command defines its own apply function, and this is where the NamespaceString is constructed today (generally command oplog entries use <dbName>$cmd as the "ns" field, and put the collection name in the "o" field, see the "create" command as an example). In general, we should use the "ns" (to grab the db name), "o" (to grab the collection name), and "tid" fields in the oplog entry in order to construct the NamespaceString or DatabaseName (for commands applied on a db). Some commands' apply functions call into another function, if any of these functions take in a std::string dbName today, let's change the signature of those functions to take in DatabaseName (i.e. the create command).

This ticket is to change specifically all of the commands not related to transactions/applyOps listed in kOpsMap (so skip applyOps, commitTransaction, and abortTransaction). Feel free to break this ticket into multiple tickets if you prefer to make changes to individual commands (or smaller chunks at a time).
A few spacial cases:

  • startIndexBuild, commitIndexBuild, abortIndexBuild - these should use the UUID in the IndexBuildOplogEntry to grab the Collection object, so we shouldn't need to worry about changing the IndexBuildOplogEntry type
  • renameCollection - we should use the “tid” field along with the “to” and “from” fields rather than grabbing the "ns" and "o" fields (as it does today).
  • importCollection - we'll have to change applyImportCollection in the enterprise repo as well.

Add tests to OplogApplierImplTest (in oplog_applier_impl_test.cpp).



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

Author:

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

Message: SERVER-62395 Use tid field to create namespace on non-txn commands during oplog application
Branch: master
https://github.com/mongodb/mongo/commit/7b81482e9ca20b812d5642bf469af13cc8e18203

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

Ticket re-opened due to revert. run_unittests began a consistent failure of build/install/bin/db_repl_test

Comment by Githook User [ 15/Oct/22 ]

Author:

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

Message: Revert "SERVER-62395 Use tid field to create namespace on non-txn commands during oplog application"

This reverts commit 3e16f4386ed3772d9aa01c16057f43d4a90eb133.
Branch: master
https://github.com/mongodb/mongo/commit/e63e4961f27a9a6a4b9ae5b84c0d7e67e2f9d4db

Comment by Githook User [ 14/Oct/22 ]

Author:

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

Message: SERVER-62395 Use tid field to create namespace on non-txn commands during oplog application
Branch: master
https://github.com/mongodb/mongo/commit/3e16f4386ed3772d9aa01c16057f43d4a90eb133

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