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

Stop using stdx::variant internally in bulkWrite

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Replication

      Currently we have the bulkWrite operation take in an ops array of the form array<variant<InsertOp, UpdateOp, DeleteOp>>. Internally (i.e. within the server code, from the parsing step onwards), we represent this as a std::vector<stdx::variant<BulkWriteInsertOp, ...>>.

      But there isn't any need to do this internally. For example, internally we can maintain three different vectors - one for each type of operation - and during parsing we can append to the correct vector based on the type of operation and have some bookkeeping through indexes.

      Likewise, during parsing, we can add to a vector of common fields (like nsInfo index) so that for any operation at some index, we just need to access the vector of common fields and we don't have to call visit() on a variant.

      This should bring down overall bulkWrite execution time down by at least 1%.

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            vishnu.kaushik@mongodb.com Vishnu Kaushik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: