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

      Today, the oplog tailer uses tryExtractNoopRepair() to deserialize repairReplicatedMetadata oplog entries. The motivation for using this function instead of the IDL-generated RepairReplicatedMetadataO2::parse() is parsing in the oplog tailer is performance-sensitive. However, we only call tryExtractNoopRepair() after determining an entry is a no-op, has an o2 field, and that o2 field is a repair metadata command:

                  case 'n':
                      if (f.o2.type() == BSONType::object && isRepairReplicatedMetadataO2(f.o2.Obj())) {
                          return FastDecision::kNoopRepair;
      

      Thus the cost of IDL-parsing is only paid for valid or malformed repairReplicatedCommand entries.

      Additionally, we do not use the IDL-generated serialization API when writing the no-op entry:

                  BSON("msg" << "Repairing collection's replicated metadata with diffs"),
                  BSON("type" << "repairReplicatedMetadata" << "uuid" << collection.uuid() << "m"
                              << metadataObj),
      
      

      We can simplify this code by using the pre-existing IDL serialization/deserialization API. For example, in _writeNoopOplogEntry(), we can replace the hand-built o2 with 

      const auto o2 = RepairReplicatedMetadataO2{...};
      

      This change has the added benefit of unifying the parsing performed on the standby in SERVER-137710, thus preventing the primary and standby from accidentally parsing the same entries differently.

            Assignee:
            Unassigned
            Reporter:
            Cedric Sirianni
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: