summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2017-08-03 22:04:42 -0400
committerAlex Gorrod <alexander.gorrod@mongodb.com>2017-08-04 12:04:42 +1000
commit8a16e5ab88a6de0332d4766b09326d5a32295ec6 (patch)
tree01d2840fc168ae1fee36c730f2e4f4246342a04e
parentda4f12b0f972821735bd74c6b0ff5fdb37b889bf (diff)
downloadmongo-8a16e5ab88a6de0332d4766b09326d5a32295ec6.tar.gz
WT-3486 Discard obsolete updates as part of re-instantiating updates based on the lookaside table. (#3557)
-rw-r--r--src/btree/bt_read.c29
1 files changed, 25 insertions, 4 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);
}