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

OpObserverImpl::on<Update/Delete> have redundant branches

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Storage Execution

      OpObserverImpl::onUpdate() has 3 branches, that repeat setting the same fields the same way in each branch. ** 

      • if (inBatchedWrite)
      • else if (inMultiDocumentTransaction)
      • else 

      The work done in makeUpdateOperation(), even though the final branch doesn't utilize the helper, is repeated for each branch (tid, nss, uuid and  opType, Object, Object2 ).

      All branches independently use the same conditions from the args.updateArgs to 'setDestinedRecipient()' (1, 2, 3) and 'setFromMigrateIfTrue()' as well.

      In SERVER-78346, to keep changes isolated to the patch, the MutableOplogEntry's 'recordId' field is also set the same in all 3 branches. 

      This OpObserverImpl::onDelete() also repeats a similar pattern with its usage of the OplogDeleteEntryArgs and MutableOplogEntry::makeDeleteOperation. 

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            haley.connelly@mongodb.com Haley Connelly
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: