summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/btree/bt_page.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/btree/bt_page.c')
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_page.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_page.c b/src/third_party/wiredtiger/src/btree/bt_page.c
index d4de7ab603d..e6ca2a8cb4a 100644
--- a/src/third_party/wiredtiger/src/btree/bt_page.c
+++ b/src/third_party/wiredtiger/src/btree/bt_page.c
@@ -638,6 +638,10 @@ static int
__inmem_col_int_init_ref(WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE *home, uint32_t hint,
void *addr, uint64_t recno, bool internal, bool deleted, WT_PAGE_DELETED *page_del)
{
+ WT_BTREE *btree;
+
+ btree = S2BT(session);
+
ref->home = home;
ref->pindex_hint = hint;
ref->addr = addr;
@@ -657,6 +661,16 @@ __inmem_col_int_init_ref(WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE *home, u
*ref->page_del = *page_del;
}
WT_REF_SET_STATE(ref, WT_REF_DELETED);
+
+ /*
+ * If the tree is already dirty and so will be written, mark the page dirty. (We want to
+ * free the deleted pages, but if the handle is read-only or if the application never
+ * modifies the tree, we're not able to do so.)
+ */
+ if (btree->modified) {
+ WT_RET(__wt_page_modify_init(session, home));
+ __wt_page_only_modify_set(session, home);
+ }
}
return (0);
@@ -811,6 +825,7 @@ __inmem_col_var(
static int
__inmem_row_int(WT_SESSION_IMPL *session, WT_PAGE *page, size_t *sizep)
{
+ WT_BTREE *btree;
WT_CELL_UNPACK_ADDR unpack;
WT_DECL_ITEM(current);
WT_DECL_RET;
@@ -819,6 +834,8 @@ __inmem_row_int(WT_SESSION_IMPL *session, WT_PAGE *page, size_t *sizep)
uint32_t hint;
bool overflow_keys;
+ btree = S2BT(session);
+
WT_RET(__wt_scr_alloc(session, 0, &current));
/*
@@ -880,6 +897,16 @@ __inmem_row_int(WT_SESSION_IMPL *session, WT_PAGE *page, size_t *sizep)
}
WT_REF_SET_STATE(ref, WT_REF_DELETED);
+ /*
+ * If the tree is already dirty and so will be written, mark the page dirty. (We want to
+ * free the deleted pages, but if the handle is read-only or if the application never
+ * modifies the tree, we're not able to do so.)
+ */
+ if (btree->modified) {
+ WT_ERR(__wt_page_modify_init(session, page));
+ __wt_page_only_modify_set(session, page);
+ }
+
ref->addr = unpack.cell;
++refp;
break;