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

Allow prepared transaction statements to persist in-memory until commit

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.8
    • Affects Version/s: 4.1.6
    • Component/s: Replication
    • None
    • Fully Compatible
    • Sharding 2019-01-28, Sharding 2019-02-11

      Problem Summary

      We would like to be able to observe all statements on transaction commit. This is so that migrations may take these statements on commit and add them to any current transferMods queue.

      Currently, for prepared transactions, we discard statements on prepare, and don't persist these statements until commit time.

      Proposed Approach

      We will have to make changes to the transaction participant in order to persist these statements.

      • A new method retrieveOperations() will simply retrieve and return a reference to _transactionOperations. This method will require that the session is checked out, and that it is only called after the transaction has been prepared.
      • A new method endTransactionAndClearOperationsInMemory() will clear the _transactionOperations variable and set _transactionOperationBytes to zero.
      • The current usage of the method endTransactionAndRetrieveOperations() will be replaced with retrieveOperations() when we want the operations, combined with endTransactionAndClearOperationsInMemory() when we want to clear the transaction memory on commit.
      • Prepared transactions will no longer call endTransactionAndRetrieveOperations() on prepare. They will call both retrieveOperations() and endTransactionAndClearOperationsInMemory() on commit.
      • Non-prepared transactions will continue to persist the previous behavior of the previous method, calling both retrieveOperationsFor() and endTransactionAndClearOperationsInMemory() on commit.

      NOTE: We have renamed retrieveOperationsForMigrate() to retrieveOperations(), because we have identified usage of said operations outside of migrate, including here.

            Assignee:
            blake.oler@mongodb.com Blake Oler
            Reporter:
            blake.oler@mongodb.com Blake Oler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: