-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Cache and Eviction
-
Storage - Ra 2021-03-22
-
3
The statistic "page written requiring history store records" could be misleading for update restore eviction. Update restore eviction has a saved updates list, so there is a call to __wt_hs_insert_updates, but if there is no ondisk update to be written, write to history store is skipped.
/* Enter each update in the boundary's list into the history store. */
for (i = 0, list = multi->supd; i < multi->supd_entries; ++i, ++list) {
/* If no onpage_upd is selected, we don't need to insert anything into the history store. */
if (list->onpage_upd == NULL)
continue;
For instance, the following resolves the issue.
diff --git a/src/third_party/wiredtiger/src/history/hs.c b/src/third_party/wiredtiger/src/history/hs.c
index cb93b42e56..139b7ede82 100644
--- a/src/third_party/wiredtiger/src/history/hs.c
+++ b/src/third_party/wiredtiger/src/history/hs.c
@@ -679,7 +679,7 @@ __hs_next_upd_full_value(WT_SESSION_IMPL *session, WT_MODIFY_VECTOR *modifies,
* Copy one set of saved updates into the database's history store table.
*/
int
-__wt_hs_insert_updates(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi)
+__wt_hs_insert_updates(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi, bool *cache_write_hs)
{
WT_BTREE *btree;
WT_CURSOR *cursor;
@@ -1035,6 +1035,9 @@ err:
if (ret == 0 && insert_cnt > 0)
__hs_insert_updates_verbose(session, btree);
+ if (insert_cnt > 0)
+ *cache_write_hs = true;
+
__wt_scr_free(session, &key);
/* modify_value is allocated in __wt_modify_pack. Free it if it is allocated. */
if (modify_value != NULL)
diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h
index 513013eab3..db02077789 100644
--- a/src/third_party/wiredtiger/src/include/extern.h
+++ b/src/third_party/wiredtiger/src/include/extern.h
@@ -775,7 +775,7 @@ extern int __wt_hs_find_upd(WT_SESSION_IMPL *session, WT_ITEM *key, const char *
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_hs_get_btree(WT_SESSION_IMPL *session, WT_BTREE **hs_btreep)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
-extern int __wt_hs_insert_updates(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi)
+extern int __wt_hs_insert_updates(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi, bool *cache_write_hs)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_hs_modify(WT_CURSOR_BTREE *hs_cbt, WT_UPDATE *hs_upd)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
diff --git a/src/third_party/wiredtiger/src/reconcile/rec_write.c b/src/third_party/wiredtiger/src/reconcile/rec_write.c
index 1b16ddd15f..9a0e4a27e9 100644
--- a/src/third_party/wiredtiger/src/reconcile/rec_write.c
+++ b/src/third_party/wiredtiger/src/reconcile/rec_write.c
@@ -2277,8 +2277,7 @@ __rec_hs_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r)
for (multi = r->multi, i = 0; i < r->multi_next; ++multi, ++i)
if (multi->supd != NULL) {
- WT_ERR(__wt_hs_insert_updates(session, r->page, multi));
- r->cache_write_hs = true;
+ WT_ERR(__wt_hs_insert_updates(session, r->page, multi, &r->cache_write_hs));
if (!multi->supd_restore) {
__wt_free(session, multi->supd);
multi->supd_entries = 0;
I noticed this issue while debugging WT-6509.