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);
WT_ASSERT(session,
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)
#endif
WT_ERR(hs_cursor->remove(hs_cursor));
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);