diff options
author | Keith Bostic <keith@wiredtiger.com> | 2014-02-05 15:45:54 -0500 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2014-02-05 15:45:54 -0500 |
commit | 4adabd868acdd540eb93b9bdafcd2394c73dc99e (patch) | |
tree | d36e65ffc598798eedf99b5657b545729e1185df /src/btree/bt_slvg.c | |
parent | 50d9147a965c0ece7786b53d55bbe1149940136c (diff) | |
download | mongo-4adabd868acdd540eb93b9bdafcd2394c73dc99e.tar.gz |
Add a new level of indirection on internal pages so there's a way to
split them by atomically replacing the WT_REF array with a new one.
Diffstat (limited to 'src/btree/bt_slvg.c')
-rw-r--r-- | src/btree/bt_slvg.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c index daa57d5e935..2d2add6ffff 100644 --- a/src/btree/bt_slvg.c +++ b/src/btree/bt_slvg.c @@ -534,8 +534,8 @@ __slvg_trk_leaf(WT_SESSION_IMPL *session, WT_ERR(__wt_page_inmem(session, NULL, NULL, dsk, 0, &page)); WT_ERR(__wt_row_leaf_key_copy(session, page, &page->u.row.d[0], &trk->row_start)); - WT_ERR(__wt_row_leaf_key_copy(session, - page, &page->u.row.d[page->entries - 1], &trk->row_stop)); + WT_ERR(__wt_row_leaf_key_copy(session, page, + &page->u.row.d[page->pu_row_entries - 1], &trk->row_stop)); if (WT_VERBOSE_ISSET(session, salvage)) { WT_ERR(__wt_buf_set_printable(session, ss->tmp1, @@ -1077,14 +1077,11 @@ __slvg_col_build_internal( addr = NULL; /* Allocate a column-store root (internal) page and fill it in. */ - WT_RET(__wt_page_alloc(session, WT_PAGE_COL_INT, leaf_cnt, &page)); + WT_RET(__wt_page_alloc(session, WT_PAGE_COL_INT, 1, leaf_cnt, &page)); page->parent = NULL; /* Root page */ - page->read_gen = WT_READ_GEN_NOTSET; - page->u.intl.recno = 1; - page->entries = leaf_cnt; WT_ERR(__slvg_modify_init(session, page)); - for (ref = page->u.intl.t, i = 0; i < ss->pages_next; ++i) { + for (ref = page->u.intl.__index, i = 0; i < ss->pages_next; ++i) { if ((trk = ss->pages[i]) == NULL) continue; @@ -1140,7 +1137,7 @@ __slvg_col_build_leaf( WT_PAGE *page; WT_SALVAGE_COOKIE *cookie, _cookie; uint64_t skip, take; - uint32_t save_entries; + uint32_t *entriesp, save_entries; cookie = &_cookie; WT_CLEAR(*cookie); @@ -1148,8 +1145,12 @@ __slvg_col_build_leaf( /* Get the original page, including the full in-memory setup. */ WT_RET(__wt_page_in(session, parent, ref)); page = ref->page; + + entriesp = page->type == WT_PAGE_COL_VAR ? + &page->pu_var_entries : &page->pu_fix_entries; + save_col_var = page->u.col_var.d; - save_entries = page->entries; + save_entries = *entriesp; /* * Calculate the number of K/V entries we are going to skip, and @@ -1210,7 +1211,7 @@ __slvg_col_build_leaf( /* Reset the page. */ page->u.col_var.d = save_col_var; - page->entries = save_entries; + *entriesp = save_entries; ret = __wt_page_release(session, page); if (ret == 0) @@ -1657,13 +1658,11 @@ __slvg_row_build_internal( addr = NULL; /* Allocate a row-store root (internal) page and fill it in. */ - WT_RET(__wt_page_alloc(session, WT_PAGE_ROW_INT, leaf_cnt, &page)); + WT_RET(__wt_page_alloc(session, WT_PAGE_ROW_INT, 0, leaf_cnt, &page)); page->parent = NULL; - page->read_gen = WT_READ_GEN_NOTSET; - page->entries = leaf_cnt; WT_ERR(__slvg_modify_init(session, page)); - for (ref = page->u.intl.t, i = 0; i < ss->pages_next; ++i) { + for (ref = page->u.intl.__index, i = 0; i < ss->pages_next; ++i) { if ((trk = ss->pages[i]) == NULL) continue; @@ -1808,7 +1807,7 @@ __slvg_row_build_leaf(WT_SESSION_IMPL *session, /* We should have selected some entries, but not the entire page. */ WT_ASSERT(session, skip_start + skip_stop > 0 && - skip_start + skip_stop < page->entries); + skip_start + skip_stop < page->pu_row_entries); /* * Take a copy of this page's first key to define the start of @@ -1825,8 +1824,8 @@ __slvg_row_build_leaf(WT_SESSION_IMPL *session, * reference overflow pages. */ WT_ERR(__slvg_row_merge_ovfl(session, trk, page, 0, skip_start)); - WT_ERR(__slvg_row_merge_ovfl( - session, trk, page, page->entries - skip_stop, page->entries)); + WT_ERR(__slvg_row_merge_ovfl(session, trk, page, + page->pu_row_entries - skip_stop, page->pu_row_entries)); /* * If we take all of the keys, we don't write the page and we clear the @@ -1843,7 +1842,7 @@ __slvg_row_build_leaf(WT_SESSION_IMPL *session, * is no need to copy anything on the page itself, the entries * value limits the number of page items. */ - page->entries -= skip_stop; + page->pu_row_entries -= skip_stop; cookie->skip = skip_start; /* @@ -1866,7 +1865,7 @@ __slvg_row_build_leaf(WT_SESSION_IMPL *session, session, page, cookie, WT_SKIP_UPDATE_ERR)); /* Reset the page. */ - page->entries += skip_stop; + page->pu_row_entries += skip_stop; } /* |