diff options
author | Keith Bostic <keith.bostic@mongodb.com> | 2016-01-20 19:13:51 -0500 |
---|---|---|
committer | Keith Bostic <keith.bostic@mongodb.com> | 2016-01-20 19:13:51 -0500 |
commit | 74ee4bf742f2996c993b8758a0fcaaeaccf95ebc (patch) | |
tree | d2bb15b37494e93c910ba9a528ca251bd2dfa88b | |
parent | fd7a3eb9ad1770235c490ec2f79554d64baf5f2e (diff) | |
parent | 18a22c53a93039dbb6a5f18df101b3893c535d18 (diff) | |
download | mongo-74ee4bf742f2996c993b8758a0fcaaeaccf95ebc.tar.gz |
Merge pull request #2448 from wiredtiger/WT-2339
WT-2339: format post-rebalance verify failure
-rw-r--r-- | src/btree/bt_rebalance.c | 35 | ||||
-rw-r--r-- | src/btree/bt_vrfy.c | 29 |
2 files changed, 38 insertions, 26 deletions
diff --git a/src/btree/bt_rebalance.c b/src/btree/bt_rebalance.c index 812bb15da17..f44a5ea361f 100644 --- a/src/btree/bt_rebalance.c +++ b/src/btree/bt_rebalance.c @@ -315,7 +315,7 @@ __rebalance_row_walk( case WT_CELL_KEY_OVFL: /* * Any overflow key that references an internal page is - * no longer of any use. + * of no further use, schedule its blocks to be freed. * * We could potentially use the same overflow key being * freed here for the internal page we're creating, but @@ -342,40 +342,41 @@ __rebalance_row_walk( first_cell = false; break; case WT_CELL_ADDR_INT: - /* An internal page: read it and recursively walk it. */ - WT_ERR(__wt_bt_read( - session, buf, unpack.data, unpack.size)); - WT_ERR(__rebalance_row_walk(session, buf->data, rs)); + /* An internal page, schedule its blocks to be freed. */ WT_ERR(__wt_verbose(session, WT_VERB_REBALANCE, "free-list append internal page: %s", __wt_addr_string( session, unpack.data, unpack.size, rs->tmp1))); WT_ERR(__rebalance_fl_append( session, unpack.data, unpack.size, rs)); + + /* Read and recursively walk the page. */ + WT_ERR(__wt_bt_read( + session, buf, unpack.data, unpack.size)); + WT_ERR(__rebalance_row_walk(session, buf->data, rs)); break; case WT_CELL_ADDR_LEAF: case WT_CELL_ADDR_LEAF_NO: /* * A leaf page. - * If the internal page key is an overflow, instantiate - * it and use it. - * Else, we can't trust the 0th key on an internal page - * (we generally try not to instantiate them during - * reconciliation because it saves space), so we have to - * get it from the underlying leaf page. + * We can't trust the 0th key on an internal page (we + * often don't store them in reconciliation because it + * saves space), get it from the underlying leaf page. + * Else, if the internal page key is an overflow key, + * instantiate it and use it. * Else, we can use the internal page's key as is, it's * sufficient for the page. */ - if (key.type == WT_CELL_KEY_OVFL) { - WT_ERR(__wt_dsk_cell_data_ref( - session, WT_PAGE_ROW_INT, &key, leafkey)); - p = leafkey->data; - len = leafkey->size; - } else if (first_cell) { + if (first_cell) { WT_ERR(__rebalance_row_leaf_key(session, unpack.data, unpack.size, leafkey, rs)); p = leafkey->data; len = leafkey->size; + } else if (key.type == WT_CELL_KEY_OVFL) { + WT_ERR(__wt_dsk_cell_data_ref( + session, WT_PAGE_ROW_INT, &key, leafkey)); + p = leafkey->data; + len = leafkey->size; } else { p = key.data; len = key.size; diff --git a/src/btree/bt_vrfy.c b/src/btree/bt_vrfy.c index 2a92eb33c49..ae2c20be1b6 100644 --- a/src/btree/bt_vrfy.c +++ b/src/btree/bt_vrfy.c @@ -30,8 +30,7 @@ typedef struct { u_int depth, depth_internal[100], depth_leaf[100]; - WT_ITEM *tmp1; /* Temporary buffer */ - WT_ITEM *tmp2; /* Temporary buffer */ + WT_ITEM *tmp1, *tmp2, *tmp3, *tmp4; /* Temporary buffers */ } WT_VSTUFF; static void __verify_checkpoint_reset(WT_VSTUFF *); @@ -170,6 +169,8 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]) WT_ERR(__wt_scr_alloc(session, 0, &vs->max_addr)); WT_ERR(__wt_scr_alloc(session, 0, &vs->tmp1)); WT_ERR(__wt_scr_alloc(session, 0, &vs->tmp2)); + WT_ERR(__wt_scr_alloc(session, 0, &vs->tmp3)); + WT_ERR(__wt_scr_alloc(session, 0, &vs->tmp4)); /* Check configuration strings. */ WT_ERR(__verify_config(session, cfg, vs)); @@ -251,6 +252,8 @@ err: /* Inform the underlying block manager we're done. */ __wt_scr_free(session, &vs->max_addr); __wt_scr_free(session, &vs->tmp1); __wt_scr_free(session, &vs->tmp2); + __wt_scr_free(session, &vs->tmp3); + __wt_scr_free(session, &vs->tmp4); return (ret); } @@ -570,10 +573,14 @@ __verify_row_int_key_order(WT_SESSION_IMPL *session, WT_RET_MSG(session, WT_ERROR, "the internal key in entry %" PRIu32 " on the page at %s " "sorts before the last key appearing on page %s, earlier " - "in the tree", + "in the tree: %s, %s", entry, __wt_page_addr_string(session, ref, vs->tmp1), - (char *)vs->max_addr->data); + (char *)vs->max_addr->data, + __wt_buf_set_printable(session, + item.data, item.size, vs->tmp2), + __wt_buf_set_printable(session, + vs->max_key->data, vs->max_key->size, vs->tmp3)); /* Update the largest key we've seen to the key just checked. */ WT_RET(__wt_buf_set(session, vs->max_key, item.data, item.size)); @@ -628,11 +635,15 @@ __verify_row_leaf_key_order( btree->collator, vs->tmp1, (WT_ITEM *)vs->max_key, &cmp)); if (cmp < 0) WT_RET_MSG(session, WT_ERROR, - "the first key on the page at %s sorts equal to or " - "less than a key appearing on the page at %s, " - "earlier in the tree", - __wt_page_addr_string(session, ref, vs->tmp1), - (char *)vs->max_addr->data); + "the first key on the page at %s sorts equal to " + "or less than the last key appearing on the page " + "at %s, earlier in the tree: %s, %s", + __wt_page_addr_string(session, ref, vs->tmp2), + (char *)vs->max_addr->data, + __wt_buf_set_printable(session, + vs->tmp1->data, vs->tmp1->size, vs->tmp3), + __wt_buf_set_printable(session, + vs->max_key->data, vs->max_key->size, vs->tmp4)); } /* Update the largest key we've seen to the last key on this page. */ |