Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-62395

Use tid field to construct namespace when applying non-txn commands during oplog application

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • 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
    • 0

      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).

            Assignee:
            janna.golden@mongodb.com Janna Golden
            Reporter:
            janna.golden@mongodb.com Janna Golden
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: