Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-13849

Fix read txn_global->pinned_timestamp multiple times in __wt_txn_pinned_timestamp

    • Storage Engines
    • StorEng - Defined Pipeline

      In __wt_txn_pinned_timestamp, we may read the global pinned_timestamp multiple times and causing the value to deviate.

          *pinned_tsp = pinned_ts = txn_global->pinned_timestamp;
      
          /*
           * The read of checkpoint timestamp needs to be carefully ordered: it needs to be after we have
           * read the pinned timestamp and the checkpoint generation, otherwise, we may read earlier
           * checkpoint timestamp before the checkpoint generation that is read resulting more data being
           * pinned. If a checkpoint is starting and we have to use the checkpoint timestamp, we take the
           * minimum of it with the oldest timestamp, which is what we want.
           */
          WT_ACQUIRE_BARRIER();
          checkpoint_ts = txn_global->checkpoint_timestamp;
      
          if (checkpoint_ts != WT_TS_NONE && checkpoint_ts < pinned_ts)
              *pinned_tsp = checkpoint_ts;
      

      *pinned_tsp and pinned_ts may store different values causing us to not set the *pinned_tsp to checkpoint_ts.

      This is potentially a data corruption issue.

            Assignee:
            chenhao.qu@mongodb.com Chenhao Qu
            Reporter:
            chenhao.qu@mongodb.com Chenhao Qu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: