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

Rollback to stable should also clear WT_UPDATE_TO_DELETE_FROM_HS flag

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 6.1.0-rc0, WT11.1.0, 6.0.4, 5.0.15
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • 5
    • Storage Engines - 2022-07-25, Storage Engines - 2022-08-08
    • v6.0, v5.0, v4.4

      In a patch build, we hit an assert in the following code.

      #ifdef HAVE_DIAGNOSTIC
          __wt_hs_upd_time_window(hs_cursor, &hs_tw);
          WT_ASSERT(session, hs_tw->start_txn == WT_TXN_NONE || hs_tw->start_txn == delete_upd->txnid);
          WT_ASSERT(session, hs_tw->start_ts == WT_TS_NONE || hs_tw->start_ts == delete_upd->start_ts);
            hs_tw->durable_start_ts == WT_TS_NONE || hs_tw->durable_start_ts == delete_upd->durable_ts);
          if (delete_tombstone != NULL) {
              WT_ASSERT(session, hs_tw->stop_txn == delete_tombstone->txnid);
              WT_ASSERT(session, hs_tw->stop_ts == delete_tombstone->start_ts);
              WT_ASSERT(session, hs_tw->durable_stop_ts == delete_tombstone->durable_ts);
          } else
              WT_ASSERT(session, !WT_TIME_WINDOW_HAS_STOP(hs_tw));  (<-----------------We hit the assert here and crash)

      In the production build, we will continue and remove an update that should not be removed from the history store.

      It is caused by not clearing the WT_UPDATE_TO_DELETE_FROM_HS flag in the following code in rollback to stable.

                   * Clear the history store flag for the first stable update. Otherwise, it will not be
                   * moved to history store again.
                  if (stable_upd != NULL)
                      F_CLR(stable_upd, WT_UPDATE_HS);
                  if (tombstone != NULL)
                      F_CLR(tombstone, WT_UPDATE_HS);

            chenhao.qu@mongodb.com Chenhao Qu
            chenhao.qu@mongodb.com Chenhao Qu
            0 Vote for this issue
            5 Start watching this issue