diff options
Diffstat (limited to 'src/third_party/wiredtiger/src/btree')
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_curnext.c | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_curprev.c | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_cursor.c | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_debug.c | 13 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_rebalance.c | 51 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_slvg.c | 24 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_split.c | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_stat.c | 19 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_vrfy.c | 82 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c | 53 |
10 files changed, 124 insertions, 132 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_curnext.c b/src/third_party/wiredtiger/src/btree/bt_curnext.c index f504bdeddf4..6a85ccf6c17 100644 --- a/src/third_party/wiredtiger/src/btree/bt_curnext.c +++ b/src/third_party/wiredtiger/src/btree/bt_curnext.c @@ -244,8 +244,7 @@ restart_read: /* Find the matching WT_COL slot. */ * information. */ if (cbt->cip_saved != cip) { - if ((cell = WT_COL_PTR(page, cip)) == NULL) - continue; + cell = WT_COL_PTR(page, cip); __wt_cell_unpack(session, page, cell, &unpack); if (unpack.type == WT_CELL_DEL) { if ((rle = __wt_cell_rle(&unpack)) == 1) diff --git a/src/third_party/wiredtiger/src/btree/bt_curprev.c b/src/third_party/wiredtiger/src/btree/bt_curprev.c index 22effc47553..1b8df0008b9 100644 --- a/src/third_party/wiredtiger/src/btree/bt_curprev.c +++ b/src/third_party/wiredtiger/src/btree/bt_curprev.c @@ -390,8 +390,7 @@ restart_read: /* Find the matching WT_COL slot. */ * information. */ if (cbt->cip_saved != cip) { - if ((cell = WT_COL_PTR(page, cip)) == NULL) - continue; + cell = WT_COL_PTR(page, cip); __wt_cell_unpack(session, page, cell, &unpack); if (unpack.type == WT_CELL_DEL) { if (__wt_cell_rle(&unpack) == 1) diff --git a/src/third_party/wiredtiger/src/btree/bt_cursor.c b/src/third_party/wiredtiger/src/btree/bt_cursor.c index a6645608150..e75432f7836 100644 --- a/src/third_party/wiredtiger/src/btree/bt_cursor.c +++ b/src/third_party/wiredtiger/src/btree/bt_cursor.c @@ -328,8 +328,8 @@ __wt_cursor_valid(WT_CURSOR_BTREE *cbt, WT_UPDATE **updp, bool *valid) * when read. */ cip = &page->pg_var[cbt->slot]; - if ((cell = WT_COL_PTR(page, cip)) == NULL || - __wt_cell_type(cell) == WT_CELL_DEL) + cell = WT_COL_PTR(page, cip); + if (__wt_cell_type(cell) == WT_CELL_DEL) return (0); break; case BTREE_ROW: diff --git a/src/third_party/wiredtiger/src/btree/bt_debug.c b/src/third_party/wiredtiger/src/btree/bt_debug.c index 8d1ed01377c..86d00c18300 100644 --- a/src/third_party/wiredtiger/src/btree/bt_debug.c +++ b/src/third_party/wiredtiger/src/btree/bt_debug.c @@ -993,13 +993,9 @@ __debug_page_col_var(WT_DBG *ds, WT_REF *ref) recno = ref->ref_recno; WT_COL_FOREACH(page, cip, i) { - if ((cell = WT_COL_PTR(page, cip)) == NULL) { - unpack = NULL; - rle = 1; - } else { - __wt_cell_unpack(ds->session, page, cell, unpack); - rle = __wt_cell_rle(unpack); - } + cell = WT_COL_PTR(page, cip); + __wt_cell_unpack(ds->session, page, cell, unpack); + rle = __wt_cell_rle(unpack); WT_RET(__wt_snprintf( tag, sizeof(tag), "%" PRIu64 " %" PRIu64, recno, rle)); WT_RET( @@ -1339,7 +1335,8 @@ __debug_cell(WT_DBG *ds, const WT_PAGE_HEADER *dsk, WT_CELL_UNPACK *unpack) case WT_CELL_ADDR_LEAF: case WT_CELL_ADDR_LEAF_NO: __wt_timestamp_to_string(unpack->oldest_start_ts, ts_string[0]); - __wt_timestamp_to_string(unpack->newest_start_ts, ts_string[1]); + __wt_timestamp_to_string( + unpack->newest_durable_ts, ts_string[1]); __wt_timestamp_to_string(unpack->newest_stop_ts, ts_string[2]); WT_RET(ds->f(ds, ", ts %s,%s,%s", ts_string[0], ts_string[1], ts_string[2])); diff --git a/src/third_party/wiredtiger/src/btree/bt_rebalance.c b/src/third_party/wiredtiger/src/btree/bt_rebalance.c index 46dc96aedce..c04135ee82d 100644 --- a/src/third_party/wiredtiger/src/btree/bt_rebalance.c +++ b/src/third_party/wiredtiger/src/btree/bt_rebalance.c @@ -57,9 +57,9 @@ __rebalance_discard(WT_SESSION_IMPL *session, WT_REBALANCE_STUFF *rs) * Add a new entry to the list of leaf pages. */ static int -__rebalance_leaf_append(WT_SESSION_IMPL *session, - const uint8_t *key, size_t key_len, - WT_CELL_UNPACK *unpack, WT_REBALANCE_STUFF *rs) +__rebalance_leaf_append(WT_SESSION_IMPL *session, wt_timestamp_t durable_ts, + const uint8_t *key, size_t key_len, WT_CELL_UNPACK *unpack, + WT_REBALANCE_STUFF *rs) { WT_ADDR *copy_addr; WT_REF *copy; @@ -80,7 +80,7 @@ __rebalance_leaf_append(WT_SESSION_IMPL *session, WT_RET(__wt_calloc_one(session, ©_addr)); copy->addr = copy_addr; copy_addr->oldest_start_ts = unpack->oldest_start_ts; - copy_addr->newest_start_ts = unpack->newest_start_ts; + copy_addr->newest_durable_ts = durable_ts; copy_addr->newest_stop_ts = unpack->newest_stop_ts; WT_RET(__wt_memdup( session, unpack->data, unpack->size, ©_addr->addr)); @@ -194,8 +194,8 @@ __rebalance_free_original(WT_SESSION_IMPL *session, WT_REBALANCE_STUFF *rs) * Walk a column-store page and its descendants. */ static int -__rebalance_col_walk( - WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, WT_REBALANCE_STUFF *rs) +__rebalance_col_walk(WT_SESSION_IMPL *session, wt_timestamp_t durable_ts, + const WT_PAGE_HEADER *dsk, WT_REBALANCE_STUFF *rs) { WT_BTREE *btree; WT_CELL_UNPACK unpack; @@ -221,7 +221,8 @@ __rebalance_col_walk( /* An internal page: read it and recursively walk it. */ WT_ERR(__wt_bt_read( session, buf, unpack.data, unpack.size)); - WT_ERR(__rebalance_col_walk(session, buf->data, rs)); + WT_ERR(__rebalance_col_walk( + session, unpack.newest_durable_ts, buf->data, rs)); __wt_verbose(session, WT_VERB_REBALANCE, "free-list append internal page: %s", __wt_addr_string( @@ -232,7 +233,7 @@ __rebalance_col_walk( case WT_CELL_ADDR_LEAF: case WT_CELL_ADDR_LEAF_NO: WT_ERR(__rebalance_leaf_append( - session, NULL, 0, &unpack, rs)); + session, durable_ts, NULL, 0, &unpack, rs)); break; WT_ILLEGAL_VALUE_ERR(session, unpack.type); } @@ -273,8 +274,8 @@ __rebalance_row_leaf_key(WT_SESSION_IMPL *session, * Walk a row-store page and its descendants. */ static int -__rebalance_row_walk( - WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, WT_REBALANCE_STUFF *rs) +__rebalance_row_walk(WT_SESSION_IMPL *session, wt_timestamp_t durable_ts, + const WT_PAGE_HEADER *dsk, WT_REBALANCE_STUFF *rs) { WT_BTREE *btree; WT_CELL_UNPACK key, unpack; @@ -347,7 +348,8 @@ __rebalance_row_walk( /* 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)); + WT_ERR(__rebalance_row_walk( + session, unpack.newest_durable_ts, buf->data, rs)); break; case WT_CELL_ADDR_LEAF: case WT_CELL_ADDR_LEAF_NO: @@ -376,7 +378,7 @@ __rebalance_row_walk( len = key.size; } WT_ERR(__rebalance_leaf_append( - session, p, len, &unpack, rs)); + session, durable_ts, p, len, &unpack, rs)); first_cell = false; break; @@ -399,17 +401,19 @@ __wt_bt_rebalance(WT_SESSION_IMPL *session, const char *cfg[]) WT_BTREE *btree; WT_DECL_RET; WT_REBALANCE_STUFF *rs, _rstuff; + WT_REF *ref; WT_UNUSED(cfg); btree = S2BT(session); + ref = &btree->root; /* * If the tree has never been written to disk, we're done, rebalance * walks disk images, not in-memory pages. For the same reason, the * tree has to be clean. */ - if (btree->root.page->dsk == NULL) + if (ref->page->dsk == NULL) return (0); if (btree->modified) WT_RET_MSG(session, EINVAL, @@ -422,17 +426,22 @@ __wt_bt_rebalance(WT_SESSION_IMPL *session, const char *cfg[]) WT_ERR(__wt_scr_alloc(session, 0, &rs->tmp2)); /* Set the internal page tree type. */ - rs->type = btree->root.page->type; + rs->type = ref->page->type; - /* Recursively walk the tree. */ + /* + * Recursively walk the tree. We start with a durable timestamp, but + * it should never be used (we'll accumulate durable timestamps from + * all the internal pages in our final write), so set it to something + * impossible. + */ switch (rs->type) { case WT_PAGE_ROW_INT: - WT_ERR( - __rebalance_row_walk(session, btree->root.page->dsk, rs)); + WT_ERR(__rebalance_row_walk( + session, WT_TS_MAX, ref->page->dsk, rs)); break; case WT_PAGE_COL_INT: - WT_ERR( - __rebalance_col_walk(session, btree->root.page->dsk, rs)); + WT_ERR(__rebalance_col_walk( + session, WT_TS_MAX, ref->page->dsk, rs)); break; WT_ILLEGAL_VALUE_ERR(session, rs->type); } @@ -450,8 +459,8 @@ __wt_bt_rebalance(WT_SESSION_IMPL *session, const char *cfg[]) * Swap the old root page for our newly built root page, writing the new * root page as part of a checkpoint will finish the rebalance. */ - __wt_page_out(session, &btree->root.page); - btree->root.page = rs->root; + __wt_page_out(session, &ref->page); + ref->page = rs->root; rs->root = NULL; err: /* Discard any leftover root page we created. */ diff --git a/src/third_party/wiredtiger/src/btree/bt_slvg.c b/src/third_party/wiredtiger/src/btree/bt_slvg.c index a03cfb6405d..08f7c424d6c 100644 --- a/src/third_party/wiredtiger/src/btree/bt_slvg.c +++ b/src/third_party/wiredtiger/src/btree/bt_slvg.c @@ -75,7 +75,6 @@ struct __wt_track { #define trk_addr shared->addr.addr #define trk_addr_size shared->addr.size #define trk_oldest_start_ts shared->addr.oldest_start_ts -#define trk_newest_start_ts shared->addr.newest_start_ts #define trk_newest_stop_ts shared->addr.newest_stop_ts #define trk_gen shared->gen #define trk_ovfl_addr shared->ovfl_addr @@ -505,10 +504,9 @@ __slvg_trk_init(WT_SESSION_IMPL *session, trk->trk_addr_size = (uint8_t)addr_size; trk->trk_size = dsk->mem_size; trk->trk_oldest_start_ts = WT_TS_MAX; - trk->trk_newest_start_ts = trk->trk_newest_stop_ts = WT_TS_NONE; + trk->trk_newest_stop_ts = WT_TS_NONE; if (!__wt_process.page_version_ts || dsk->type == WT_PAGE_COL_FIX) { - trk->trk_oldest_start_ts = - trk->trk_newest_start_ts = WT_TS_NONE; + trk->trk_oldest_start_ts = WT_TS_NONE; trk->trk_newest_stop_ts = WT_TS_MAX; } trk->trk_gen = dsk->write_gen; @@ -665,8 +663,6 @@ __slvg_trk_leaf_ts(WT_TRACK *trk, WT_CELL_UNPACK *unpack) { trk->trk_oldest_start_ts = WT_MIN(unpack->start_ts, trk->trk_oldest_start_ts); - trk->trk_newest_start_ts = - WT_MAX(unpack->start_ts, trk->trk_newest_start_ts); trk->trk_newest_stop_ts = WT_MAX(unpack->stop_ts, trk->trk_newest_stop_ts); } @@ -1070,8 +1066,6 @@ merge: */ a_trk->trk_oldest_start_ts = b_trk->trk_oldest_start_ts = WT_MIN(a_trk->trk_oldest_start_ts, b_trk->trk_oldest_start_ts); - a_trk->trk_newest_start_ts = b_trk->trk_newest_start_ts = - WT_MAX(a_trk->trk_newest_start_ts, b_trk->trk_newest_start_ts); a_trk->trk_newest_stop_ts = b_trk->trk_newest_stop_ts = WT_MAX(a_trk->trk_newest_stop_ts, b_trk->trk_newest_stop_ts); __wt_verbose(session, WT_VERB_SALVAGE, @@ -1203,9 +1197,13 @@ __slvg_col_build_internal( ref->home = page; ref->page = NULL; + /* + * Salvage doesn't read tree internal pages, so all pages are + * immediately durable, regardless of the leaf page timestamps. + */ WT_ERR(__wt_calloc_one(session, &addr)); addr->oldest_start_ts = trk->trk_oldest_start_ts; - addr->newest_start_ts = trk->trk_newest_start_ts; + addr->newest_durable_ts = WT_TS_NONE; addr->newest_stop_ts = trk->trk_newest_stop_ts; WT_ERR(__wt_memdup( session, trk->trk_addr, trk->trk_addr_size, &addr->addr)); @@ -1726,8 +1724,6 @@ merge: */ a_trk->trk_oldest_start_ts = b_trk->trk_oldest_start_ts = WT_MIN(a_trk->trk_oldest_start_ts, b_trk->trk_oldest_start_ts); - a_trk->trk_newest_start_ts = b_trk->trk_newest_start_ts = - WT_MAX(a_trk->trk_newest_start_ts, b_trk->trk_newest_start_ts); a_trk->trk_newest_stop_ts = b_trk->trk_newest_stop_ts = WT_MAX(a_trk->trk_newest_stop_ts, b_trk->trk_newest_stop_ts); __wt_verbose(session, WT_VERB_SALVAGE, @@ -1875,9 +1871,13 @@ __slvg_row_build_internal( ref->home = page; ref->page = NULL; + /* + * Salvage doesn't read tree internal pages, so all pages are + * immediately durable, regardless of the leaf page timestamps. + */ WT_ERR(__wt_calloc_one(session, &addr)); addr->oldest_start_ts = trk->trk_oldest_start_ts; - addr->newest_start_ts = trk->trk_newest_start_ts; + addr->newest_durable_ts = WT_TS_NONE; addr->newest_stop_ts = trk->trk_newest_stop_ts; WT_ERR(__wt_memdup( session, trk->trk_addr, trk->trk_addr_size, &addr->addr)); diff --git a/src/third_party/wiredtiger/src/btree/bt_split.c b/src/third_party/wiredtiger/src/btree/bt_split.c index f0407ce71b1..127c307b9ab 100644 --- a/src/third_party/wiredtiger/src/btree/bt_split.c +++ b/src/third_party/wiredtiger/src/btree/bt_split.c @@ -264,7 +264,7 @@ __split_ref_move(WT_SESSION_IMPL *session, WT_PAGE *from_home, session, from_home, (WT_CELL *)ref_addr, &unpack); WT_RET(__wt_calloc_one(session, &addr)); addr->oldest_start_ts = unpack.oldest_start_ts; - addr->newest_start_ts = unpack.newest_start_ts; + addr->newest_durable_ts = unpack.newest_durable_ts; addr->newest_stop_ts = unpack.newest_stop_ts; WT_ERR(__wt_memdup( session, unpack.data, unpack.size, &addr->addr)); @@ -1675,7 +1675,7 @@ __wt_multi_to_ref(WT_SESSION_IMPL *session, WT_RET(__wt_calloc_one(session, &addr)); ref->addr = addr; addr->oldest_start_ts = multi->addr.oldest_start_ts; - addr->newest_start_ts = multi->addr.newest_start_ts; + addr->newest_durable_ts = multi->addr.newest_durable_ts; addr->newest_stop_ts = multi->addr.newest_stop_ts; WT_RET(__wt_memdup(session, multi->addr.addr, multi->addr.size, &addr->addr)); diff --git a/src/third_party/wiredtiger/src/btree/bt_stat.c b/src/third_party/wiredtiger/src/btree/bt_stat.c index c201d9af73a..976a771a233 100644 --- a/src/third_party/wiredtiger/src/btree/bt_stat.c +++ b/src/third_party/wiredtiger/src/btree/bt_stat.c @@ -160,21 +160,18 @@ __stat_page_col_var( * we see. */ WT_COL_FOREACH(page, cip, i) { - if ((cell = WT_COL_PTR(page, cip)) == NULL) { + cell = WT_COL_PTR(page, cip); + __wt_cell_unpack(session, page, cell, unpack); + if (unpack->type == WT_CELL_DEL) { orig_deleted = true; - ++deleted_cnt; + deleted_cnt += __wt_cell_rle(unpack); } else { orig_deleted = false; - __wt_cell_unpack(session, page, cell, unpack); - if (unpack->type == WT_CELL_DEL) - orig_deleted = true; - else { - entry_cnt += __wt_cell_rle(unpack); - rle_cnt += __wt_cell_rle(unpack) - 1; - } - if (unpack->ovfl) - ++ovfl_cnt; + entry_cnt += __wt_cell_rle(unpack); } + rle_cnt += __wt_cell_rle(unpack) - 1; + if (unpack->ovfl) + ++ovfl_cnt; /* * Walk the insert list, checking for changes. For each insert diff --git a/src/third_party/wiredtiger/src/btree/bt_vrfy.c b/src/third_party/wiredtiger/src/btree/bt_vrfy.c index 1a412ace8f9..f85389bbe81 100644 --- a/src/third_party/wiredtiger/src/btree/bt_vrfy.c +++ b/src/third_party/wiredtiger/src/btree/bt_vrfy.c @@ -237,7 +237,7 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]) */ memset(&addr_unpack, 0, sizeof(addr_unpack)); addr_unpack.oldest_start_ts = ckpt->oldest_start_ts; - addr_unpack.newest_start_ts = ckpt->newest_start_ts; + addr_unpack.newest_durable_ts = ckpt->newest_durable_ts; addr_unpack.newest_stop_ts = ckpt->newest_stop_ts; addr_unpack.raw = WT_CELL_ADDR_INT; @@ -331,14 +331,9 @@ __verify_addr_ts(WT_SESSION_IMPL *session, "internal page reference at %s has a newest stop " "timestamp of 0", __wt_page_addr_string(session, ref, vs->tmp1)); - if (unpack->oldest_start_ts > unpack->newest_start_ts) + if (unpack->oldest_start_ts > unpack->newest_stop_ts) WT_RET_MSG(session, WT_ERROR, "internal page reference at %s has an oldest start " - "timestamp newer than its newest start timestamp", - __wt_page_addr_string(session, ref, vs->tmp1)); - if (unpack->newest_start_ts > unpack->newest_stop_ts) - WT_RET_MSG(session, WT_ERROR, - "internal page reference at %s has a newest start " "timestamp newer than its newest stop timestamp", __wt_page_addr_string(session, ref, vs->tmp1)); return (0); @@ -448,13 +443,11 @@ recno_chk: if (recno != vs->record_total + 1) break; case WT_PAGE_COL_VAR: recno = 0; - WT_COL_FOREACH(page, cip, i) - if ((cell = WT_COL_PTR(page, cip)) == NULL) - ++recno; - else { - __wt_cell_unpack(session, page, cell, unpack); - recno += __wt_cell_rle(unpack); - } + WT_COL_FOREACH(page, cip, i) { + cell = WT_COL_PTR(page, cip); + __wt_cell_unpack(session, page, cell, unpack); + recno += __wt_cell_rle(unpack); + } vs->record_total += recno; break; } @@ -745,7 +738,7 @@ __verify_ts_addr_cmp(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t cell_num, bool gt, WT_VSTUFF *vs) { const char *ts1_bp, *ts2_bp; - char ts1_buf[32], ts2_buf[32]; + char ts_string[2][WT_TS_INT_STRING_SIZE]; if (gt && ts1 >= ts2) return (0); @@ -760,9 +753,8 @@ __verify_ts_addr_cmp(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t cell_num, ts1_bp = "WT_TS_NONE"; break; default: - WT_RET( - __wt_snprintf(ts1_buf, sizeof(ts1_buf), "%" PRIu64, ts1)); - ts1_bp = ts1_buf; + __wt_timestamp_to_string(ts1, ts_string[0]); + ts1_bp = ts_string[0]; break; } switch (ts2) { @@ -773,14 +765,13 @@ __verify_ts_addr_cmp(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t cell_num, ts2_bp = "WT_TS_NONE"; break; default: - WT_RET( - __wt_snprintf(ts2_buf, sizeof(ts2_buf), "%" PRIu64, ts2)); - ts2_bp = ts2_buf; + __wt_timestamp_to_string(ts2, ts_string[1]); + ts2_bp = ts_string[1]; break; } WT_RET_MSG(session, WT_ERROR, "cell %" PRIu32 " on page at %s failed verification with %s " - "time of %s, %s the parent's %s time of %s", + "timestamp of %s, %s the parent's %s timestamp of %s", cell_num, __wt_page_addr_string(session, ref, vs->tmp1), ts1_name, ts1_bp, @@ -801,6 +792,7 @@ __verify_page_cell(WT_SESSION_IMPL *session, WT_DECL_RET; const WT_PAGE_HEADER *dsk; uint32_t cell_num; + char ts_string[2][WT_TS_INT_STRING_SIZE]; bool found_ovfl; /* @@ -851,30 +843,27 @@ __verify_page_cell(WT_SESSION_IMPL *session, cell_num - 1, __wt_page_addr_string( session, ref, vs->tmp1)); - if (unpack.oldest_start_ts > unpack.newest_start_ts) + if (unpack.oldest_start_ts > unpack.newest_stop_ts) { + __wt_timestamp_to_string( + unpack.oldest_start_ts, ts_string[0]); + __wt_timestamp_to_string( + unpack.newest_stop_ts, ts_string[1]); WT_RET_MSG(session, WT_ERROR, "cell %" PRIu32 " on page at %s has an " - "oldest start timestamp newer than its " - "newest start timestamp", - cell_num - 1, - __wt_page_addr_string( - session, ref, vs->tmp1)); - if (unpack.newest_start_ts > unpack.newest_stop_ts) - WT_RET_MSG(session, WT_ERROR, - "cell %" PRIu32 " on page at %s has a " - "newest start timestamp newer than its " - "newest stop timestamp", + "oldest start timestamp %s newer than " + "its newest stop timestamp %s", cell_num - 1, - __wt_page_addr_string( - session, ref, vs->tmp1)); + __wt_page_addr_string(session, + ref, vs->tmp1), ts_string[0], ts_string[1]); + } WT_RET(__verify_ts_addr_cmp(session, ref, cell_num - 1, "oldest start", unpack.oldest_start_ts, "oldest start", addr_unpack->oldest_start_ts, true, vs)); WT_RET(__verify_ts_addr_cmp(session, ref, cell_num - 1, - "newest start", unpack.newest_start_ts, - "newest start", addr_unpack->newest_start_ts, + "newest durable", unpack.newest_durable_ts, + "newest durable", addr_unpack->newest_durable_ts, false, vs)); WT_RET(__verify_ts_addr_cmp(session, ref, cell_num - 1, "newest stop", unpack.newest_stop_ts, @@ -893,24 +882,25 @@ __verify_page_cell(WT_SESSION_IMPL *session, cell_num - 1, __wt_page_addr_string( session, ref, vs->tmp1)); - if (unpack.start_ts > unpack.stop_ts) + if (unpack.start_ts > unpack.stop_ts) { + __wt_timestamp_to_string( + unpack.start_ts, ts_string[0]); + __wt_timestamp_to_string( + unpack.stop_ts, ts_string[1]); WT_RET_MSG(session, WT_ERROR, "cell %" PRIu32 " on page at %s has a " - "start timestamp newer than its stop " - "timestamp ", + "start timestamp %s newer than its stop " + "timestamp %s", cell_num - 1, - __wt_page_addr_string( - session, ref, vs->tmp1)); + __wt_page_addr_string(session, + ref, vs->tmp1), ts_string[0], ts_string[1]); + } WT_RET(__verify_ts_addr_cmp(session, ref, cell_num - 1, "start", unpack.start_ts, "oldest start", addr_unpack->oldest_start_ts, true, vs)); WT_RET(__verify_ts_addr_cmp(session, ref, cell_num - 1, - "start", unpack.start_ts, - "newest start", addr_unpack->newest_start_ts, - false, vs)); - WT_RET(__verify_ts_addr_cmp(session, ref, cell_num - 1, "stop", unpack.stop_ts, "newest stop", addr_unpack->newest_stop_ts, false, vs)); diff --git a/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c b/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c index ee6cd904aec..24d6d22f1ef 100644 --- a/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c +++ b/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c @@ -222,7 +222,7 @@ __verify_dsk_ts_addr_cmp(WT_SESSION_IMPL *session, uint32_t cell_num, bool gt, const char *tag) { const char *ts1_bp, *ts2_bp; - char ts1_buf[32], ts2_buf[32]; + char ts_string[2][WT_TS_INT_STRING_SIZE]; if (gt && ts1 >= ts2) return (0); @@ -237,9 +237,8 @@ __verify_dsk_ts_addr_cmp(WT_SESSION_IMPL *session, uint32_t cell_num, ts1_bp = "WT_TS_NONE"; break; default: - WT_RET( - __wt_snprintf(ts1_buf, sizeof(ts1_buf), "%" PRIu64, ts1)); - ts1_bp = ts1_buf; + __wt_timestamp_to_string(ts1, ts_string[0]); + ts1_bp = ts_string[0]; break; } switch (ts2) { @@ -250,14 +249,13 @@ __verify_dsk_ts_addr_cmp(WT_SESSION_IMPL *session, uint32_t cell_num, ts2_bp = "WT_TS_NONE"; break; default: - WT_RET( - __wt_snprintf(ts2_buf, sizeof(ts2_buf), "%" PRIu64, ts2)); - ts2_bp = ts2_buf; + __wt_timestamp_to_string(ts2, ts_string[1]); + ts2_bp = ts_string[1]; break; } WT_RET_MSG(session, WT_ERROR, "cell %" PRIu32 " on page at %s failed verification with %s " - "time of %s, %s the parent's %s time of %s", + "timestamp of %s, %s the parent's %s timestamp of %s", cell_num, tag, ts1_name, ts1_bp, gt ? "less than" : "greater than", @@ -272,6 +270,8 @@ static int __verify_dsk_ts(WT_SESSION_IMPL *session, WT_CELL_UNPACK *unpack, uint32_t cell_num, WT_ADDR *addr, const char *tag) { + char ts_string[2][WT_TS_INT_STRING_SIZE]; + /* * Check timestamp order, and optionally, against a parent address. * Timestamps in the parent address aren't necessarily an exact match, @@ -291,17 +291,17 @@ __verify_dsk_ts(WT_SESSION_IMPL *session, "cell %" PRIu32 " on page at %s has a newest stop " "timestamp of 0", cell_num - 1, tag); - if (unpack->oldest_start_ts > unpack->newest_start_ts) + if (unpack->oldest_start_ts > unpack->newest_stop_ts) { + __wt_timestamp_to_string( + unpack->oldest_start_ts, ts_string[0]); + __wt_timestamp_to_string( + unpack->newest_stop_ts, ts_string[1]); WT_RET_VRFY(session, "cell %" PRIu32 " on page at %s has an oldest " - "start timestamp newer than its newest start " - "timestamp", - cell_num - 1, tag); - if (unpack->newest_start_ts > unpack->newest_stop_ts) - WT_RET_VRFY(session, - "cell %" PRIu32 " on page at %s has a newest start " - "timestamp newer than its newest stop timestamp", - cell_num - 1, tag); + "start timestamp %s newer than its newest stop " + "timestamp %s", + cell_num - 1, tag, ts_string[0], ts_string[1]); + } if (addr == NULL) break; @@ -310,8 +310,8 @@ __verify_dsk_ts(WT_SESSION_IMPL *session, "oldest start", addr->oldest_start_ts, true, tag)); WT_RET(__verify_dsk_ts_addr_cmp(session, cell_num - 1, - "newest start", unpack->newest_start_ts, - "newest start", addr->newest_start_ts, + "newest durable", unpack->newest_durable_ts, + "newest durable", addr->newest_durable_ts, false, tag)); WT_RET(__verify_dsk_ts_addr_cmp(session, cell_num - 1, "newest stop", unpack->newest_stop_ts, @@ -329,11 +329,16 @@ __verify_dsk_ts(WT_SESSION_IMPL *session, "cell %" PRIu32 " on page at %s has a stop " "timestamp of 0", cell_num - 1, tag); - if (unpack->start_ts > unpack->stop_ts) + if (unpack->start_ts > unpack->stop_ts) { + __wt_timestamp_to_string( + unpack->start_ts, ts_string[0]); + __wt_timestamp_to_string( + unpack->stop_ts, ts_string[0]); WT_RET_VRFY(session, "cell %" PRIu32 " on page at %s has a start " - "timestamp newer than its stop timestamp ", - cell_num - 1, tag); + "timestamp %s newer than its stop timestamp %s", + cell_num - 1, tag, ts_string[0], ts_string[1]); + } if (addr == NULL) break; @@ -342,10 +347,6 @@ __verify_dsk_ts(WT_SESSION_IMPL *session, "oldest start", addr->oldest_start_ts, true, tag)); WT_RET(__verify_dsk_ts_addr_cmp(session, cell_num - 1, - "start", unpack->start_ts, - "newest start", addr->newest_start_ts, - false, tag)); - WT_RET(__verify_dsk_ts_addr_cmp(session, cell_num - 1, "stop", unpack->stop_ts, "newest stop", addr->newest_stop_ts, false, tag)); |