diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-08-07 12:47:41 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-07 12:47:41 +1000 |
commit | d8ad71c56ac1796a95f0e51db9c70c355835deb6 (patch) | |
tree | 94487cb0656d1bcdcc65c7b1a482826d88594941 | |
parent | 6df966920223475db43115627f5c8fd4101c9838 (diff) | |
download | mongo-d8ad71c56ac1796a95f0e51db9c70c355835deb6.tar.gz |
WT-3486 Discard obsolete updates as part of re-instantiating updates based on the lookaside table. (#3561)
-rw-r--r-- | src/btree/bt_read.c | 29 | ||||
-rw-r--r-- | src/btree/row_modify.c | 6 |
2 files changed, 29 insertions, 6 deletions
diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index 004a6b6c943..49b12b2d4e9 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -81,12 +81,22 @@ err: /* */ static int __col_instantiate(WT_SESSION_IMPL *session, - uint64_t recno, WT_REF *ref, WT_CURSOR_BTREE *cbt, WT_UPDATE *upd) + uint64_t recno, WT_REF *ref, WT_CURSOR_BTREE *cbt, WT_UPDATE *updlist) { + WT_PAGE *page; + WT_UPDATE *upd; + + page = ref->page; + + /* Discard any of the updates we don't need. */ + if (updlist->next != NULL && + (upd = __wt_update_obsolete_check(session, page, updlist)) != NULL) + __wt_update_obsolete_free(session, page, upd); + /* Search the page and add updates. */ WT_RET(__wt_col_search(session, recno, ref, cbt)); WT_RET(__wt_col_modify( - session, cbt, recno, NULL, upd, upd->type, false)); + session, cbt, recno, NULL, updlist, updlist->type, false)); return (0); } @@ -96,11 +106,22 @@ __col_instantiate(WT_SESSION_IMPL *session, */ static int __row_instantiate(WT_SESSION_IMPL *session, - WT_ITEM *key, WT_REF *ref, WT_CURSOR_BTREE *cbt, WT_UPDATE *upd) + WT_ITEM *key, WT_REF *ref, WT_CURSOR_BTREE *cbt, WT_UPDATE *updlist) { + WT_PAGE *page; + WT_UPDATE *upd; + + page = ref->page; + + /* Discard any of the updates we don't need. */ + if (updlist->next != NULL && + (upd = __wt_update_obsolete_check(session, page, updlist)) != NULL) + __wt_update_obsolete_free(session, page, upd); + /* Search the page and add updates. */ WT_RET(__wt_row_search(session, key, ref, cbt, true)); - WT_RET(__wt_row_modify(session, cbt, key, NULL, upd, upd->type, false)); + WT_RET(__wt_row_modify( + session, cbt, key, NULL, updlist, updlist->type, false)); return (0); } diff --git a/src/btree/row_modify.c b/src/btree/row_modify.c index a57a9c17edb..6e610b86376 100644 --- a/src/btree/row_modify.c +++ b/src/btree/row_modify.c @@ -330,9 +330,11 @@ __wt_update_obsolete_check( /* * If the list is long, don't retry checks on this page until the - * transaction state has moved forwards. + * transaction state has moved forwards. This function is used to + * trim update lists independently of the page state, ensure there + * is a modify structure. */ - if (count > 20) + if (count > 20 && page->modify != NULL) page->modify->obsolete_check_txn = S2C(session)->txn_global.last_running; |