summaryrefslogtreecommitdiff
path: root/src/btree/bt_handle.c
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2012-07-27 10:33:25 +0000
committerKeith Bostic <keith@wiredtiger.com>2012-07-27 10:33:25 +0000
commit568c71b9afc75d5fca6c806f6f95109150ced51f (patch)
tree50343ba5bad1b97f1684137adc90f07a0eac1875 /src/btree/bt_handle.c
parent23ee33b83873d11af6a7bcaa3df420b026456ef9 (diff)
downloadmongo-568c71b9afc75d5fca6c806f6f95109150ced51f.tar.gz
Instead of flagging the empty tree's leaf page empty as part of creating
an empty tree in memory, set the page as modified (to force reconciliation); if the leaf page is still empty at that time, then we'll figure it out during that reconciliation. This fixes a memory leak where the leaf page of a empty tree wasn't being freed.
Diffstat (limited to 'src/btree/bt_handle.c')
-rw-r--r--src/btree/bt_handle.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c
index 9228b481868..f804ac1399d 100644
--- a/src/btree/bt_handle.c
+++ b/src/btree/bt_handle.c
@@ -252,6 +252,10 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session)
root = leaf = NULL;
/*
+ * A note about empty trees: the initial tree is a root page and a leaf
+ * page, the leaf of which is marked dirty. If evicted without being
+ * modified, that's OK, nothing will ever be written.
+ *
* Create a leaf page -- this can be reconciled while the root stays
* pinned.
*/
@@ -272,10 +276,6 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session)
leaf->entries = 0;
/*
- * A note about empty trees: the initial tree is a root page and a leaf
- * page, neither of which are marked dirty. If evicted without being
- * modified, that's OK, nothing will ever be written.
- *
* Create the empty root page.
*
* !!!
@@ -317,12 +317,11 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session)
btree->root_page = root;
/*
- * Mark the child page empty so that if it is evicted, the tree ends up
- * sane. The page should not be dirty, else we would write empty trees
- * on close, including empty checkpoints.
+ * Mark the leaf page dirty; if it's evicted, it will be reconciled,
+ * but if it's still empty, nothing will be written.
*/
WT_ERR(__wt_page_modify_init(session, leaf));
- F_SET(leaf->modify, WT_PM_REC_EMPTY);
+ __wt_page_modify_set(leaf);
return (0);