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

Create interface to run delete and insert in transaction

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.9
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • Sharding 2019-03-11

      In order to update a document's shard key value, we need to delete the old document and insert the new document. This should be done in an already running transaction.

      Implementation details:

      1. Build delete and insert command objects. Use the original query from the update as the query for the delete and the post-image created by the update stage as the documents field for the insert (attached to WouldChangeOwningShard exception). Use the lsid, txnNumber, and stmtId from the original write.
      2. Get fixedExecutor and for both the delete and insert commands and schedule the following work:
        1. Create a new opCtx
        2. Create OpMsgRequest
        3. Pass the OpMsgRequest to serviceEntryPoint->handleRequest()

      This should be able to be used in both batch_write_exec.cpp and cluster_find_and_modify.cpp. We should also create unit tests for this logic as a part of this ticket.

            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: