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

    • Fully Compatible
    • ALL
    • 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
    • Repl 2019-02-11
    • 7

      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.

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

              Created:
              Updated:
              Resolved: