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

Committing or aborting a prepared transaction may not un-pin stable timestamp due to oplog hole

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      This can be reproduced by making this diff on bbe09aa5e0966ada5232ffbcb098efdd78b4f24e:

      diff --git a/src/mongo/db/transaction_participant.cpp b/src/mongo/db/transaction_participant.cpp
      index 2dfe999..a600f88 100644
      --- a/src/mongo/db/transaction_participant.cpp
      +++ b/src/mongo/db/transaction_participant.cpp
      @@ -1113,6 +1113,7 @@ void TransactionParticipant::commitPreparedTransaction(OperationContext* opCtx,
               _finishOpTime = repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp();
       
               _finishCommitTransaction(lk, opCtx);
      +        sleepmillis(5000);
           } catch (...) {
               // It is illegal for committing a prepared transaction to fail for any reason, other than an
               // invalid command, so we crash instead.
      

      And running:

      -> % buildscripts/resmoke.py --suites=core_txns jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js 
      

      Show
      This can be reproduced by making this diff on bbe09aa5e0966ada5232ffbcb098efdd78b4f24e: diff --git a/src/mongo/db/transaction_participant.cpp b/src/mongo/db/transaction_participant.cpp index 2dfe999..a600f88 100644 --- a/src/mongo/db/transaction_participant.cpp +++ b/src/mongo/db/transaction_participant.cpp @@ -1113,6 +1113,7 @@ void TransactionParticipant::commitPreparedTransaction(OperationContext* opCtx, _finishOpTime = repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp(); _finishCommitTransaction(lk, opCtx); + sleepmillis(5000); } catch (...) { // It is illegal for committing a prepared transaction to fail for any reason, other than an // invalid command, so we crash instead. And running: -> % buildscripts/resmoke.py --suites=core_txns jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js
    • Sprint:
      Repl 2019-02-11
    • Linked BF Score:
      7

      Description

      If we recalculate the stable timestamp after we commit the transaction, write the commit oplog entry, and update the metrics, but before we close the oplog hole, then we may never recalculate it after the oplog hole actually closes.

      This does not go away when we stop pinning the stable timestamp back. This is due to the OplogSlotReserver holding open an oplog hole past where we recalculate the stable timestamp.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              judah.schvimer Judah Schvimer
              Reporter:
              judah.schvimer Judah Schvimer
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: