diff options
Diffstat (limited to 'src/btree')
-rw-r--r-- | src/btree/bt_handle.c | 11 | ||||
-rw-r--r-- | src/btree/bt_slvg.c | 36 | ||||
-rw-r--r-- | src/btree/bt_sync.c | 4 | ||||
-rw-r--r-- | src/btree/rec_write.c | 22 |
4 files changed, 47 insertions, 26 deletions
diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index 5459a7f005c..598eba0c1ba 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -340,14 +340,13 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session) * simply has no records, for whatever reason, and trust reconciliation * to figure out it's empty and not write any blocks. * We do not set the tree's modified flag because the checkpoint code - * skips unmodified files in default checkpoints (checkpoints that don't - * require a write unless the file is actually dirty). There's no - * reason to reconcile this file unless the application requires it as - * part of a forced checkpoint or if the application actually modifies - * it. + * skips unmodified files in closing checkpoints (checkpoints that don't + * require a write unless the file is actually dirty). There's no need + * to reconcile this file unless the application does a real checkpoint + * or it's actually modified. */ WT_ERR(__wt_page_modify_init(session, leaf)); - ++leaf->modify->write_gen; + __wt_page_modify_set(leaf); return (0); diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c index 6735895f16a..b3b56a51f2d 100644 --- a/src/btree/bt_slvg.c +++ b/src/btree/bt_slvg.c @@ -1030,6 +1030,30 @@ __slvg_col_range_missing(WT_SESSION_IMPL *session, WT_STUFF *ss) } /* + * __slvg_modify_init -- + * Initialize a salvage page's modification information. + */ +static int +__slvg_modify_init(WT_SESSION_IMPL *session, WT_PAGE *page) +{ + WT_BTREE *btree; + + btree = session->btree; + + WT_RET(__wt_page_modify_init(session, page)); + + /* + * The page and tree are both dirty -- setting the tree's modification + * flag is probably not necessary (it won't be part of any checkpoints, + * at least in this incarnation), but it's the right thing to do. + */ + __wt_tree_modify_set(btree); + __wt_page_modify_set(page); + + return (0); +} + +/* * __slvg_col_build_internal -- * Build a column-store in-memory page that references all of the leaf * pages we've found. @@ -1056,8 +1080,7 @@ __slvg_col_build_internal( page->u.intl.recno = 1; page->entries = leaf_cnt; page->type = WT_PAGE_COL_INT; - WT_ERR(__wt_page_modify_init(session, page)); - __wt_page_modify_set(session, page); + WT_ERR(__slvg_modify_init(session, page)); for (ref = page->u.intl.t, i = 0; i < ss->pages_next; ++i) { if ((trk = ss->pages[i]) == NULL) @@ -1174,8 +1197,7 @@ __slvg_col_build_leaf( ref->addr = NULL; /* Write the new version of the leaf page to disk. */ - WT_ERR(__wt_page_modify_init(session, page)); - __wt_page_modify_set(session, page); + WT_ERR(__slvg_modify_init(session, page)); WT_ERR(__wt_rec_write(session, page, cookie)); /* Reset the page. */ @@ -1630,8 +1652,7 @@ __slvg_row_build_internal( page->read_gen = 0; page->entries = leaf_cnt; page->type = WT_PAGE_ROW_INT; - WT_ERR(__wt_page_modify_init(session, page)); - __wt_page_modify_set(session, page); + WT_ERR(__slvg_modify_init(session, page)); for (ref = page->u.intl.t, i = 0; i < ss->pages_next; ++i) { if ((trk = ss->pages[i]) == NULL) @@ -1827,8 +1848,7 @@ __slvg_row_build_leaf(WT_SESSION_IMPL *session, ref->addr = NULL; /* Write the new version of the leaf page to disk. */ - WT_ERR(__wt_page_modify_init(session, page)); - __wt_page_modify_set(session, page); + WT_ERR(__slvg_modify_init(session, page)); WT_ERR(__wt_rec_write(session, page, cookie)); /* Reset the page. */ diff --git a/src/btree/bt_sync.c b/src/btree/bt_sync.c index 327e6729030..321d05608d2 100644 --- a/src/btree/bt_sync.c +++ b/src/btree/bt_sync.c @@ -20,9 +20,9 @@ __wt_bt_cache_force_write(WT_SESSION_IMPL *session) btree = session->btree; page = btree->root_page; - /* If forcing a checkpoint, dirty the root page to ensure a write. */ + /* Dirty the root page to ensure a write. */ WT_RET(__wt_page_modify_init(session, page)); - __wt_page_modify_set(session, page); + __wt_page_modify_set(page); return (0); } diff --git a/src/btree/rec_write.c b/src/btree/rec_write.c index 30281e93b22..8c4926386ca 100644 --- a/src/btree/rec_write.c +++ b/src/btree/rec_write.c @@ -296,7 +296,7 @@ __wt_rec_write( break; } WT_RET(__wt_page_modify_init(session, page)); - __wt_page_modify_set(session, page); + __wt_page_modify_set(page); return (0); } @@ -344,7 +344,7 @@ __wt_rec_write( WT_VERBOSE_RET(session, reconcile, "root page split %p -> %p", page, page->modify->u.split); page = page->modify->u.split; - __wt_page_modify_set(session, page); + __wt_page_modify_set(page); F_CLR(page->modify, WT_PM_REC_SPLIT_MERGE); WT_RET(__wt_rec_write(session, page, NULL)); @@ -1167,7 +1167,7 @@ __wt_rec_bulk_wrapup(WT_CURSOR_BULK *cbulk) /* Mark the page's parent dirty. */ WT_RET(__wt_page_modify_init(session, page->parent)); - __wt_page_modify_set(session, page->parent); + __wt_page_modify_set(page->parent); return (0); } @@ -3062,15 +3062,17 @@ err: __wt_scr_free(&tkey); } /* - * Success: if modifications were skipped, the tree cannot be clean. As - * the checkpoint initiation code might have cleared the tree's modified - * flag, explicitly dirty the page, which includes setting the tree's - * modified flag. If modifications were not skipped, the page might be - * clean, update the disk generation to the write generation as of when - * reconciliation started. + * Success. + * If modifications were skipped, the tree isn't clean. The checkpoint + * call cleared the tree's modified value before it called the eviction + * thread, so we must explicitly reset the tree's modified flag. + * + * If modifications were not skipped, the page might be clean; update + * the disk generation to the write generation as of when reconciliation + * started. */ if (r->upd_skipped) - __wt_page_modify_set(session, page); + __wt_tree_modify_set(btree); else mod->disk_gen = r->orig_write_gen; |