summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2021-01-13 14:53:48 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-01-13 04:09:09 +0000
commit0c18127f7ff5a0959052188df6e4d7b9d24b9814 (patch)
tree6ccb0907a43fb845c3d0652e38cd8e0353a2206b
parent171ce3e29cc1c663ba098cdedb792b6c6e37a051 (diff)
downloadmongo-0c18127f7ff5a0959052188df6e4d7b9d24b9814.tar.gz
Import wiredtiger: 72a5bd8d541bb422d293d313ebad45f135971eaa from branch mongodb-4.4
ref: 357d565eee..72a5bd8d54 for: 4.4.4 WT-5111 Fix wt2909_checkpoint_integrity and wt3120_filesys so it is natural to run standalone WT-6863 Reduce code duplication by improving statistics macros WT-6991 Make WT_IS_HS and WT_IS_METADATA consistent - both operating on dhandle WT-7025 Coverity: Unused value "op_ts" WT-7054 Change the order of key out-of-order prints to avoid race WT-7066 Point README doc link to develop/index.html
-rw-r--r--src/third_party/wiredtiger/README2
-rw-r--r--src/third_party/wiredtiger/dist/s_define.list1
-rw-r--r--src/third_party/wiredtiger/dist/s_string.ok2
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_curnext.c30
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_curprev.c17
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_cursor.c38
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_debug.c10
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_delete.c12
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_handle.c4
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_io.c12
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_ovfl.c3
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_random.c3
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_read.c6
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_split.c15
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_sync.c16
-rw-r--r--src/third_party/wiredtiger/src/btree/row_modify.c4
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_bulk.c15
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_ds.c33
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_file.c3
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_hs.c9
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_log.c6
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_std.c9
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_file.c2
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_lru.c10
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_page.c29
-rw-r--r--src/third_party/wiredtiger/src/history/hs_conn.c4
-rw-r--r--src/third_party/wiredtiger/src/history/hs_cursor.c24
-rw-r--r--src/third_party/wiredtiger/src/history/hs_rec.c64
-rw-r--r--src/third_party/wiredtiger/src/include/btree.h15
-rw-r--r--src/third_party/wiredtiger/src/include/btree_inline.h9
-rw-r--r--src/third_party/wiredtiger/src/include/cache.h2
-rw-r--r--src/third_party/wiredtiger/src/include/dhandle.h19
-rw-r--r--src/third_party/wiredtiger/src/include/reconcile_inline.h109
-rw-r--r--src/third_party/wiredtiger/src/include/stat.h18
-rw-r--r--src/third_party/wiredtiger/src/include/txn_inline.h20
-rw-r--r--src/third_party/wiredtiger/src/reconcile/rec_row.c5
-rw-r--r--src/third_party/wiredtiger/src/reconcile/rec_visibility.c2
-rw-r--r--src/third_party/wiredtiger/src/reconcile/rec_write.c33
-rw-r--r--src/third_party/wiredtiger/src/support/modify.c9
-rw-r--r--src/third_party/wiredtiger/src/txn/txn.c14
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_ckpt.c2
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c47
-rw-r--r--src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c13
-rw-r--r--src/third_party/wiredtiger/test/csuite/wt3120_filesys/main.c14
-rw-r--r--src/third_party/wiredtiger/test/utility/misc.c34
-rw-r--r--src/third_party/wiredtiger/test/utility/test_util.h1
47 files changed, 317 insertions, 434 deletions
diff --git a/src/third_party/wiredtiger/README b/src/third_party/wiredtiger/README
index b70dd32fcf4..6ddef162bd4 100644
--- a/src/third_party/wiredtiger/README
+++ b/src/third_party/wiredtiger/README
@@ -8,7 +8,7 @@ WiredTiger release packages and documentation can be found at:
The documentation for this specific release can be found at:
- https://source.wiredtiger.com/10.0.0/index.html
+ https://source.wiredtiger.com/develop/index.html
The WiredTiger source code can be found at:
diff --git a/src/third_party/wiredtiger/dist/s_define.list b/src/third_party/wiredtiger/dist/s_define.list
index ec82139199f..3e0f6af6581 100644
--- a/src/third_party/wiredtiger/dist/s_define.list
+++ b/src/third_party/wiredtiger/dist/s_define.list
@@ -72,6 +72,7 @@ WT_SINGLE_THREAD_CHECK_STOP
WT_SIZE_CHECK
WT_STATS_FIELD_TO_OFFSET
WT_STATS_SLOT_ID
+WT_STAT_CONN_DATA_DECRV
WT_STAT_CONN_DECRV
WT_STAT_DATA_DECRV
WT_STAT_DECR
diff --git a/src/third_party/wiredtiger/dist/s_string.ok b/src/third_party/wiredtiger/dist/s_string.ok
index 70e3738e022..78594d8bd45 100644
--- a/src/third_party/wiredtiger/dist/s_string.ok
+++ b/src/third_party/wiredtiger/dist/s_string.ok
@@ -769,6 +769,7 @@ fflush
ffs
fgetc
fgetln
+fgets
fh
fhandle
filefrag
@@ -1327,6 +1328,7 @@ tokname
tokstart
toktype
tolower
+toplevel
totalsec
toupper
transactional
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 4e65115a615..da89f70f170 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-4.4",
- "commit": "357d565eee34b54c7725a0c6f7fb65c1dffa26d1"
+ "commit": "72a5bd8d541bb422d293d313ebad45f135971eaa"
}
diff --git a/src/third_party/wiredtiger/src/btree/bt_curnext.c b/src/third_party/wiredtiger/src/btree/bt_curnext.c
index 1801394cf27..05394d0ae98 100644
--- a/src/third_party/wiredtiger/src/btree/bt_curnext.c
+++ b/src/third_party/wiredtiger/src/btree/bt_curnext.c
@@ -478,14 +478,15 @@ __cursor_key_order_check_row(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, boo
WT_ERR(__wt_scr_alloc(session, 512, &a));
WT_ERR(__wt_scr_alloc(session, 512, &b));
+ WT_ERR(
+ __wt_msg(session, "WT_CURSOR.%s out-of-order returns: returned key %.1024s then key %.1024s",
+ next ? "next" : "prev",
+ __wt_buf_set_printable_format(
+ session, cbt->lastkey->data, cbt->lastkey->size, btree->key_format, a),
+ __wt_buf_set_printable_format(session, key->data, key->size, btree->key_format, b)));
WT_ERR(__wt_msg(session, "dumping the cursor page"));
WT_ERR(__wt_debug_cursor_page(&cbt->iface, NULL));
- WT_ERR_PANIC(session, EINVAL,
- "WT_CURSOR.%s out-of-order returns: returned key %.1024s then key %.1024s",
- next ? "next" : "prev",
- __wt_buf_set_printable_format(
- session, cbt->lastkey->data, cbt->lastkey->size, btree->key_format, a),
- __wt_buf_set_printable_format(session, key->data, key->size, btree->key_format, b));
+ WT_ERR_PANIC(session, EINVAL, "found key out-of-order returns");
err:
__wt_scr_free(session, &a);
@@ -639,8 +640,7 @@ __wt_btcur_next(WT_CURSOR_BTREE *cbt, bool truncating)
session = CUR2S(cbt);
total_skipped = 0;
- WT_STAT_CONN_INCR(session, cursor_next);
- WT_STAT_DATA_INCR(session, cursor_next);
+ WT_STAT_CONN_DATA_INCR(session, cursor_next);
flags = WT_READ_NO_SPLIT | WT_READ_SKIP_INTL; /* tree walk flags */
if (truncating)
@@ -737,16 +737,12 @@ __wt_btcur_next(WT_CURSOR_BTREE *cbt, bool truncating)
}
err:
- if (total_skipped < 100) {
- WT_STAT_CONN_INCR(session, cursor_next_skip_lt_100);
- WT_STAT_DATA_INCR(session, cursor_next_skip_lt_100);
- } else {
- WT_STAT_CONN_INCR(session, cursor_next_skip_ge_100);
- WT_STAT_DATA_INCR(session, cursor_next_skip_ge_100);
- }
+ if (total_skipped < 100)
+ WT_STAT_CONN_DATA_INCR(session, cursor_next_skip_lt_100);
+ else
+ WT_STAT_CONN_DATA_INCR(session, cursor_next_skip_ge_100);
- WT_STAT_CONN_INCRV(session, cursor_next_skip_total, total_skipped);
- WT_STAT_DATA_INCRV(session, cursor_next_skip_total, total_skipped);
+ WT_STAT_CONN_DATA_INCRV(session, cursor_next_skip_total, total_skipped);
switch (ret) {
case 0:
diff --git a/src/third_party/wiredtiger/src/btree/bt_curprev.c b/src/third_party/wiredtiger/src/btree/bt_curprev.c
index c71fa5d25e8..bb2c3a9e05c 100644
--- a/src/third_party/wiredtiger/src/btree/bt_curprev.c
+++ b/src/third_party/wiredtiger/src/btree/bt_curprev.c
@@ -590,8 +590,7 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, bool truncating)
session = CUR2S(cbt);
total_skipped = 0;
- WT_STAT_CONN_INCR(session, cursor_prev);
- WT_STAT_DATA_INCR(session, cursor_prev);
+ WT_STAT_CONN_DATA_INCR(session, cursor_prev);
flags = /* tree walk flags */
WT_READ_NO_SPLIT | WT_READ_PREV | WT_READ_SKIP_INTL;
@@ -690,16 +689,12 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, bool truncating)
}
err:
- if (total_skipped < 100) {
- WT_STAT_CONN_INCR(session, cursor_prev_skip_lt_100);
- WT_STAT_DATA_INCR(session, cursor_prev_skip_lt_100);
- } else {
- WT_STAT_CONN_INCR(session, cursor_prev_skip_ge_100);
- WT_STAT_DATA_INCR(session, cursor_prev_skip_ge_100);
- }
+ if (total_skipped < 100)
+ WT_STAT_CONN_DATA_INCR(session, cursor_prev_skip_lt_100);
+ else
+ WT_STAT_CONN_DATA_INCR(session, cursor_prev_skip_ge_100);
- WT_STAT_CONN_INCRV(session, cursor_prev_skip_total, total_skipped);
- WT_STAT_DATA_INCRV(session, cursor_prev_skip_total, total_skipped);
+ WT_STAT_CONN_DATA_INCRV(session, cursor_prev_skip_total, total_skipped);
switch (ret) {
case 0:
diff --git a/src/third_party/wiredtiger/src/btree/bt_cursor.c b/src/third_party/wiredtiger/src/btree/bt_cursor.c
index 23a9c4f8078..fc7e542a12e 100644
--- a/src/third_party/wiredtiger/src/btree/bt_cursor.c
+++ b/src/third_party/wiredtiger/src/btree/bt_cursor.c
@@ -397,9 +397,7 @@ static void
__cursor_restart(WT_SESSION_IMPL *session, uint64_t *yield_count, uint64_t *sleep_usecs)
{
__wt_spin_backoff(yield_count, sleep_usecs);
-
- WT_STAT_CONN_INCR(session, cursor_restart);
- WT_STAT_DATA_INCR(session, cursor_restart);
+ WT_STAT_CONN_DATA_INCR(session, cursor_restart);
}
/*
@@ -415,8 +413,7 @@ __wt_btcur_reset(WT_CURSOR_BTREE *cbt)
cursor = &cbt->iface;
session = CUR2S(cbt);
- WT_STAT_CONN_INCR(session, cursor_reset);
- WT_STAT_DATA_INCR(session, cursor_reset);
+ WT_STAT_CONN_DATA_INCR(session, cursor_reset);
F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET);
@@ -506,8 +503,7 @@ __wt_btcur_search(WT_CURSOR_BTREE *cbt)
cursor = &cbt->iface;
session = CUR2S(cbt);
- WT_STAT_CONN_INCR(session, cursor_search);
- WT_STAT_DATA_INCR(session, cursor_search);
+ WT_STAT_CONN_DATA_INCR(session, cursor_search);
WT_RET(__wt_txn_search_check(session));
__cursor_state_save(cursor, &state);
@@ -603,8 +599,7 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp)
session = CUR2S(cbt);
exact = 0;
- WT_STAT_CONN_INCR(session, cursor_search_near);
- WT_STAT_DATA_INCR(session, cursor_search_near);
+ WT_STAT_CONN_DATA_INCR(session, cursor_search_near);
WT_RET(__wt_txn_search_check(session));
__cursor_state_save(cursor, &state);
@@ -758,10 +753,8 @@ __wt_btcur_insert(WT_CURSOR_BTREE *cbt)
session = CUR2S(cbt);
yield_count = sleep_usecs = 0;
- WT_STAT_CONN_INCR(session, cursor_insert);
- WT_STAT_DATA_INCR(session, cursor_insert);
- WT_STAT_CONN_INCRV(session, cursor_insert_bytes, insert_bytes);
- WT_STAT_DATA_INCRV(session, cursor_insert_bytes, insert_bytes);
+ WT_STAT_CONN_DATA_INCR(session, cursor_insert);
+ WT_STAT_CONN_DATA_INCRV(session, cursor_insert_bytes, insert_bytes);
if (btree->type == BTREE_ROW)
WT_RET(__cursor_size_chk(session, &cursor->key));
@@ -995,10 +988,8 @@ __wt_btcur_remove(WT_CURSOR_BTREE *cbt, bool positioned)
iterating = F_ISSET(cbt, WT_CBT_ITERATE_NEXT | WT_CBT_ITERATE_PREV);
searched = false;
- WT_STAT_CONN_INCR(session, cursor_remove);
- WT_STAT_DATA_INCR(session, cursor_remove);
- WT_STAT_CONN_INCRV(session, cursor_remove_bytes, cursor->key.size);
- WT_STAT_DATA_INCRV(session, cursor_remove_bytes, cursor->key.size);
+ WT_STAT_CONN_DATA_INCR(session, cursor_remove);
+ WT_STAT_CONN_DATA_INCRV(session, cursor_remove_bytes, cursor->key.size);
/* Save the cursor state. */
__cursor_state_save(cursor, &state);
@@ -1448,8 +1439,8 @@ __wt_btcur_modify(WT_CURSOR_BTREE *cbt, WT_MODIFY *entries, int nentries)
new = cursor->value.size;
WT_ERR(__cursor_size_chk(session, &cursor->value));
- WT_STAT_CONN_INCRV(session, cursor_update_bytes_changed, new > orig ? new - orig : orig - new);
- WT_STAT_DATA_INCRV(session, cursor_update_bytes_changed, new > orig ? new - orig : orig - new);
+ WT_STAT_CONN_DATA_INCRV(
+ session, cursor_update_bytes_changed, new > orig ? new - orig : orig - new);
/*
* WT_CURSOR.modify is update-without-overwrite.
@@ -1496,8 +1487,7 @@ __wt_btcur_reserve(WT_CURSOR_BTREE *cbt)
cursor = &cbt->iface;
session = CUR2S(cbt);
- WT_STAT_CONN_INCR(session, cursor_reserve);
- WT_STAT_DATA_INCR(session, cursor_reserve);
+ WT_STAT_CONN_DATA_INCR(session, cursor_reserve);
/* WT_CURSOR.reserve is update-without-overwrite and a special value. */
overwrite = F_ISSET(cursor, WT_CURSTD_OVERWRITE);
@@ -1523,10 +1513,8 @@ __wt_btcur_update(WT_CURSOR_BTREE *cbt)
cursor = &cbt->iface;
session = CUR2S(cbt);
- WT_STAT_CONN_INCR(session, cursor_update);
- WT_STAT_DATA_INCR(session, cursor_update);
- WT_STAT_CONN_INCRV(session, cursor_update_bytes, cursor->key.size + cursor->value.size);
- WT_STAT_DATA_INCRV(session, cursor_update_bytes, cursor->key.size + cursor->value.size);
+ WT_STAT_CONN_DATA_INCR(session, cursor_update);
+ WT_STAT_CONN_DATA_INCRV(session, cursor_update_bytes, cursor->key.size + cursor->value.size);
if (btree->type == BTREE_ROW)
WT_RET(__cursor_size_chk(session, &cursor->key));
diff --git a/src/third_party/wiredtiger/src/btree/bt_debug.c b/src/third_party/wiredtiger/src/btree/bt_debug.c
index 631c6b4644d..fc68db0e1bb 100644
--- a/src/third_party/wiredtiger/src/btree/bt_debug.c
+++ b/src/third_party/wiredtiger/src/btree/bt_debug.c
@@ -1025,7 +1025,7 @@ __debug_page(WT_DBG *ds, WT_REF *ref, uint32_t flags)
* Set up history store support, opening a history store cursor on demand. Ignore errors if that
* doesn't work, we may be running in-memory.
*/
- if (!WT_IS_HS(S2BT(session))) {
+ if (!WT_IS_HS(session->dhandle)) {
if (session->hs_cursor != NULL || __wt_hs_cursor_open(session) == 0) {
WT_RET(__wt_scr_alloc(session, 0, &ds->hs_key));
WT_RET(__wt_scr_alloc(session, 0, &ds->hs_value));
@@ -1277,7 +1277,7 @@ __debug_page_col_var(WT_DBG *ds, WT_REF *ref)
WT_RET(__wt_snprintf(tag, sizeof(tag), "%" PRIu64 " %" PRIu64, recno, rle));
WT_RET(__debug_cell_kv(ds, page, WT_PAGE_COL_VAR, tag, unpack));
- if (!WT_IS_HS(S2BT(session))) {
+ if (!WT_IS_HS(session->dhandle)) {
p = ds->key->mem;
WT_RET(__wt_vpack_uint(&p, 0, recno));
ds->key->size = WT_PTRDIFF(p, ds->key->mem);
@@ -1364,7 +1364,7 @@ __debug_page_row_leaf(WT_DBG *ds, WT_PAGE *page)
if ((upd = WT_ROW_UPDATE(page, rip)) != NULL)
WT_RET(__debug_update(ds, upd, false));
- if (!WT_IS_HS(S2BT(session)) && session->hs_cursor != NULL)
+ if (!WT_IS_HS(session->dhandle) && session->hs_cursor != NULL)
WT_RET(__debug_hs_key(ds));
if ((insert = WT_ROW_INSERT(page, rip)) != NULL)
@@ -1390,7 +1390,7 @@ __debug_col_skip(WT_DBG *ds, WT_INSERT_HEAD *head, const char *tag, bool hexbyte
WT_RET(ds->f(ds, "\t%s %" PRIu64 "\n", tag, WT_INSERT_RECNO(ins)));
WT_RET(__debug_update(ds, ins->upd, hexbyte));
- if (!WT_IS_HS(S2BT(session)) && session->hs_cursor != NULL) {
+ if (!WT_IS_HS(session->dhandle) && session->hs_cursor != NULL) {
p = ds->key->mem;
WT_RET(__wt_vpack_uint(&p, 0, WT_INSERT_RECNO(ins)));
ds->key->size = WT_PTRDIFF(p, ds->key->mem);
@@ -1416,7 +1416,7 @@ __debug_row_skip(WT_DBG *ds, WT_INSERT_HEAD *head)
WT_RET(__debug_item_key(ds, "insert", WT_INSERT_KEY(ins), WT_INSERT_KEY_SIZE(ins)));
WT_RET(__debug_update(ds, ins->upd, false));
- if (!WT_IS_HS(S2BT(session)) && session->hs_cursor != NULL) {
+ if (!WT_IS_HS(session->dhandle) && session->hs_cursor != NULL) {
WT_RET(__wt_buf_set(session, ds->key, WT_INSERT_KEY(ins), WT_INSERT_KEY_SIZE(ins)));
WT_RET(__debug_hs_key(ds));
}
diff --git a/src/third_party/wiredtiger/src/btree/bt_delete.c b/src/third_party/wiredtiger/src/btree/bt_delete.c
index 233d8ce6889..bdf8618edc7 100644
--- a/src/third_party/wiredtiger/src/btree/bt_delete.c
+++ b/src/third_party/wiredtiger/src/btree/bt_delete.c
@@ -132,8 +132,7 @@ __wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp)
WT_ERR(__wt_txn_modify_page_delete(session, ref));
*skipp = true;
- WT_STAT_CONN_INCR(session, rec_page_delete_fast);
- WT_STAT_DATA_INCR(session, rec_page_delete_fast);
+ WT_STAT_CONN_DATA_INCR(session, rec_page_delete_fast);
/* Publish the page to its new state, ensuring visibility. */
WT_REF_SET_STATE(ref, WT_REF_DELETED);
@@ -302,8 +301,7 @@ __wt_delete_page_instantiate(WT_SESSION_IMPL *session, WT_REF *ref)
btree = S2BT(session);
page = ref->page;
- WT_STAT_CONN_INCR(session, cache_read_deleted);
- WT_STAT_DATA_INCR(session, cache_read_deleted);
+ WT_STAT_CONN_DATA_INCR(session, cache_read_deleted);
/*
* Give the page a modify structure.
@@ -315,10 +313,8 @@ __wt_delete_page_instantiate(WT_SESSION_IMPL *session, WT_REF *ref)
if (!F_ISSET(btree, WT_BTREE_READONLY))
__wt_page_modify_set(session, page);
- if (ref->page_del != NULL && ref->page_del->prepare_state != WT_PREPARE_INIT) {
- WT_STAT_CONN_INCR(session, cache_read_deleted_prepared);
- WT_STAT_DATA_INCR(session, cache_read_deleted_prepared);
- }
+ if (ref->page_del != NULL && ref->page_del->prepare_state != WT_PREPARE_INIT)
+ WT_STAT_CONN_DATA_INCR(session, cache_read_deleted_prepared);
/*
* An operation is accessing a "deleted" page, and we're building an in-memory version of the
diff --git a/src/third_party/wiredtiger/src/btree/bt_handle.c b/src/third_party/wiredtiger/src/btree/bt_handle.c
index c745a8078ea..c23b2e05240 100644
--- a/src/third_party/wiredtiger/src/btree/bt_handle.c
+++ b/src/third_party/wiredtiger/src/btree/bt_handle.c
@@ -217,7 +217,7 @@ __wt_btree_close(WT_SESSION_IMPL *session)
*/
WT_ASSERT(session,
!F_ISSET(S2C(session), WT_CONN_HS_OPEN) || !btree->hs_entries ||
- (!WT_IS_METADATA(btree->dhandle) && !WT_IS_HS(btree)));
+ (!WT_IS_METADATA(btree->dhandle) && !WT_IS_HS(btree->dhandle)));
/*
* If we turned eviction off and never turned it back on, do that now, otherwise the counter
@@ -477,7 +477,7 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt)
/* Set special flags for the history store table. */
if (strcmp(session->dhandle->name, WT_HS_URI) == 0) {
- F_SET(btree, WT_BTREE_HS);
+ F_SET(btree->dhandle, WT_DHANDLE_HS);
F_SET(btree, WT_BTREE_NO_LOGGING);
}
diff --git a/src/third_party/wiredtiger/src/btree/bt_io.c b/src/third_party/wiredtiger/src/btree/bt_io.c
index 6e76441d527..95e299fce7c 100644
--- a/src/third_party/wiredtiger/src/btree/bt_io.c
+++ b/src/third_party/wiredtiger/src/btree/bt_io.c
@@ -120,12 +120,10 @@ __wt_bt_read(WT_SESSION_IMPL *session, WT_ITEM *buf, const uint8_t *addr, size_t
WT_ERR(__wt_verify_dsk(session, tmp->data, buf));
}
- WT_STAT_CONN_INCR(session, cache_read);
- WT_STAT_DATA_INCR(session, cache_read);
+ WT_STAT_CONN_DATA_INCR(session, cache_read);
if (F_ISSET(dsk, WT_PAGE_COMPRESSED))
WT_STAT_DATA_INCR(session, compress_read);
- WT_STAT_CONN_INCRV(session, cache_bytes_read, dsk->mem_size);
- WT_STAT_DATA_INCRV(session, cache_bytes_read, dsk->mem_size);
+ WT_STAT_CONN_DATA_INCRV(session, cache_bytes_read, dsk->mem_size);
WT_STAT_SESSION_INCRV(session, bytes_read, dsk->mem_size);
(void)__wt_atomic_add64(&S2C(session)->cache->bytes_read, dsk->mem_size);
@@ -352,10 +350,8 @@ __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf, uint8_t *addr, size_t *add
WT_STAT_SESSION_INCRV(session, write_time, time_diff);
}
- WT_STAT_CONN_INCR(session, cache_write);
- WT_STAT_DATA_INCR(session, cache_write);
- WT_STAT_CONN_INCRV(session, cache_bytes_write, dsk->mem_size);
- WT_STAT_DATA_INCRV(session, cache_bytes_write, dsk->mem_size);
+ WT_STAT_CONN_DATA_INCR(session, cache_write);
+ WT_STAT_CONN_DATA_INCRV(session, cache_bytes_write, dsk->mem_size);
WT_STAT_SESSION_INCRV(session, bytes_write, dsk->mem_size);
(void)__wt_atomic_add64(&S2C(session)->cache->bytes_written, dsk->mem_size);
diff --git a/src/third_party/wiredtiger/src/btree/bt_ovfl.c b/src/third_party/wiredtiger/src/btree/bt_ovfl.c
index 855272ce1d9..138ce4d657d 100644
--- a/src/third_party/wiredtiger/src/btree/bt_ovfl.c
+++ b/src/third_party/wiredtiger/src/btree/bt_ovfl.c
@@ -32,8 +32,7 @@ __ovfl_read(WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size, WT_
store->data = WT_PAGE_HEADER_BYTE(btree, dsk);
store->size = dsk->u.datalen;
- WT_STAT_CONN_INCR(session, cache_read_overflow);
- WT_STAT_DATA_INCR(session, cache_read_overflow);
+ WT_STAT_CONN_DATA_INCR(session, cache_read_overflow);
return (0);
}
diff --git a/src/third_party/wiredtiger/src/btree/bt_random.c b/src/third_party/wiredtiger/src/btree/bt_random.c
index 4e4eaedaa85..a9c89c91491 100644
--- a/src/third_party/wiredtiger/src/btree/bt_random.c
+++ b/src/third_party/wiredtiger/src/btree/bt_random.c
@@ -489,8 +489,7 @@ __wt_btcur_next_random(WT_CURSOR_BTREE *cbt)
if (btree->type != BTREE_ROW)
WT_RET_MSG(session, ENOTSUP, "WT_CURSOR.next_random only supported by row-store tables");
- WT_STAT_CONN_INCR(session, cursor_next);
- WT_STAT_DATA_INCR(session, cursor_next);
+ WT_STAT_CONN_DATA_INCR(session, cursor_next);
F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET);
diff --git a/src/third_party/wiredtiger/src/btree/bt_read.c b/src/third_party/wiredtiger/src/btree/bt_read.c
index 9684094c27e..f44bc11cbb2 100644
--- a/src/third_party/wiredtiger/src/btree/bt_read.c
+++ b/src/third_party/wiredtiger/src/btree/bt_read.c
@@ -230,10 +230,8 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags
* Ignore reads of pages already known to be in cache, otherwise the eviction server can
* dominate these statistics.
*/
- if (!LF_ISSET(WT_READ_CACHE)) {
- WT_STAT_CONN_INCR(session, cache_pages_requested);
- WT_STAT_DATA_INCR(session, cache_pages_requested);
- }
+ if (!LF_ISSET(WT_READ_CACHE))
+ WT_STAT_CONN_DATA_INCR(session, cache_pages_requested);
for (evict_skip = stalled = wont_need = false, force_attempts = 0, sleep_usecs = yield_cnt = 0;
;) {
diff --git a/src/third_party/wiredtiger/src/btree/bt_split.c b/src/third_party/wiredtiger/src/btree/bt_split.c
index a3d22efbd7b..09eb1f49b41 100644
--- a/src/third_party/wiredtiger/src/btree/bt_split.c
+++ b/src/third_party/wiredtiger/src/btree/bt_split.c
@@ -396,10 +396,8 @@ __split_root(WT_SESSION_IMPL *session, WT_PAGE *root)
uint32_t slots;
void *p;
- WT_STAT_CONN_INCR(session, cache_eviction_deepen);
- WT_STAT_DATA_INCR(session, cache_eviction_deepen);
- WT_STAT_CONN_INCR(session, cache_eviction_split_internal);
- WT_STAT_DATA_INCR(session, cache_eviction_split_internal);
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_deepen);
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_split_internal);
btree = S2BT(session);
alloc_index = NULL;
@@ -905,8 +903,7 @@ __split_internal(WT_SESSION_IMPL *session, WT_PAGE *parent, WT_PAGE *page)
uint32_t slots;
void *p;
- WT_STAT_CONN_INCR(session, cache_eviction_split_internal);
- WT_STAT_DATA_INCR(session, cache_eviction_split_internal);
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_split_internal);
/* Mark the page dirty. */
WT_RET(__wt_page_modify_init(session, page));
@@ -1730,8 +1727,7 @@ __split_insert(WT_SESSION_IMPL *session, WT_REF *ref)
uint8_t type;
int i;
- WT_STAT_CONN_INCR(session, cache_inmem_split);
- WT_STAT_DATA_INCR(session, cache_inmem_split);
+ WT_STAT_CONN_DATA_INCR(session, cache_inmem_split);
page = ref->page;
right = NULL;
@@ -2092,8 +2088,7 @@ __split_multi(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
size_t parent_incr;
uint32_t i, new_entries;
- WT_STAT_CONN_INCR(session, cache_eviction_split_leaf);
- WT_STAT_DATA_INCR(session, cache_eviction_split_leaf);
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_split_leaf);
page = ref->page;
mod = page->modify;
diff --git a/src/third_party/wiredtiger/src/btree/bt_sync.c b/src/third_party/wiredtiger/src/btree/bt_sync.c
index 461acf4ec90..fe737b902c4 100644
--- a/src/third_party/wiredtiger/src/btree/bt_sync.c
+++ b/src/third_party/wiredtiger/src/btree/bt_sync.c
@@ -47,7 +47,7 @@ __sync_checkpoint_can_skip(WT_SESSION_IMPL *session, WT_REF *ref)
* skip them,
* 5. there's already an address for every disk block involved.
*/
- if (WT_IS_HS(S2BT(session)))
+ if (WT_IS_HS(session->dhandle))
return (false);
if (F_ISSET(ref, WT_REF_FLAG_INTERNAL))
return (false);
@@ -162,8 +162,7 @@ __sync_ref_list_pop(WT_SESSION_IMPL *session, WT_REF_LIST *rlp, uint32_t flags)
/* Accumulate errors but continue till all the refs are processed. */
WT_TRET(__wt_page_release(session, rlp->list[i], flags));
- WT_STAT_CONN_INCR(session, cc_pages_evict);
- WT_STAT_DATA_INCR(session, cc_pages_evict);
+ WT_STAT_CONN_DATA_INCR(session, cc_pages_evict);
__wt_verbose(session, WT_VERB_CHECKPOINT_CLEANUP,
"%p: is an in-memory obsolete page, added to urgent eviction queue.",
(void *)rlp->list[i]);
@@ -247,8 +246,7 @@ __sync_ref_obsolete_check(WT_SESSION_IMPL *session, WT_REF *ref, WT_REF_LIST *rl
if (obsolete) {
WT_REF_UNLOCK(ref, WT_REF_DELETED);
- WT_STAT_CONN_INCR(session, cc_pages_removed);
- WT_STAT_DATA_INCR(session, cc_pages_removed);
+ WT_STAT_CONN_DATA_INCR(session, cc_pages_removed);
WT_RET(__wt_page_parent_modify_set(session, ref, true));
} else
@@ -365,8 +363,7 @@ __sync_ref_int_obsolete_cleanup(WT_SESSION_IMPL *session, WT_REF *parent, WT_REF
WT_RET(__sync_ref_obsolete_check(session, ref, rlp));
}
- WT_STAT_CONN_INCRV(session, cc_pages_visited, pindex->entries);
- WT_STAT_DATA_INCRV(session, cc_pages_visited, pindex->entries);
+ WT_STAT_CONN_DATA_INCRV(session, cc_pages_visited, pindex->entries);
return (0);
}
@@ -407,8 +404,7 @@ __sync_page_skip(WT_SESSION_IMPL *session, WT_REF *ref, void *context, bool *ski
*/
if (addr.type == WT_ADDR_LEAF_NO || addr.ta.newest_stop_durable_ts == WT_TS_NONE) {
__wt_verbose(session, WT_VERB_CHECKPOINT_CLEANUP, "%p: page walk skipped", (void *)ref);
- WT_STAT_CONN_INCR(session, cc_pages_walk_skipped);
- WT_STAT_DATA_INCR(session, cc_pages_walk_skipped);
+ WT_STAT_CONN_DATA_INCR(session, cc_pages_walk_skipped);
*skipp = true;
}
return (0);
@@ -542,7 +538,7 @@ __wt_sync_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
btree->syncing = WT_BTREE_SYNC_WAIT;
__wt_gen_next_drain(session, WT_GEN_EVICT);
btree->syncing = WT_BTREE_SYNC_RUNNING;
- is_hs = WT_IS_HS(btree);
+ is_hs = WT_IS_HS(btree->dhandle);
/* Add in history store reconciliation for standard files. */
rec_flags = WT_REC_CHECKPOINT;
diff --git a/src/third_party/wiredtiger/src/btree/row_modify.c b/src/third_party/wiredtiger/src/btree/row_modify.c
index ef600f7d88c..2383abdfe9d 100644
--- a/src/third_party/wiredtiger/src/btree/row_modify.c
+++ b/src/third_party/wiredtiger/src/btree/row_modify.c
@@ -125,7 +125,7 @@ __wt_row_modify(WT_CURSOR_BTREE *cbt, const WT_ITEM *key, const WT_ITEM *value,
* store is committed.
*/
WT_ASSERT(session,
- !WT_IS_HS(S2BT(session)) ||
+ !WT_IS_HS(S2BT(session)->dhandle) ||
(upd_arg->type == WT_UPDATE_TOMBSTONE && upd_arg->start_ts == WT_TS_NONE &&
upd_arg->next == NULL) ||
(upd_arg->type == WT_UPDATE_TOMBSTONE && upd_arg->next != NULL &&
@@ -199,7 +199,7 @@ __wt_row_modify(WT_CURSOR_BTREE *cbt, const WT_ITEM *key, const WT_ITEM *value,
* history store if we write a prepared update to the data store.
*/
WT_ASSERT(session,
- !WT_IS_HS(S2BT(session)) ||
+ !WT_IS_HS(S2BT(session)->dhandle) ||
(upd_arg->type == WT_UPDATE_TOMBSTONE && upd_arg->next != NULL &&
upd_arg->next->type == WT_UPDATE_STANDARD && upd_arg->next->next == NULL) ||
(upd_arg->type == WT_UPDATE_STANDARD && upd_arg->next == NULL));
diff --git a/src/third_party/wiredtiger/src/cursor/cur_bulk.c b/src/third_party/wiredtiger/src/cursor/cur_bulk.c
index f10ff01d1b0..c4122219d84 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_bulk.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_bulk.c
@@ -48,8 +48,7 @@ __curbulk_insert_fix(WT_CURSOR *cursor)
* single-threaded and not visible until the bulk cursor is closed.
*/
CURSOR_API_CALL(cursor, session, insert, btree);
- WT_STAT_CONN_INCR(session, cursor_insert_bulk);
- WT_STAT_DATA_INCR(session, cursor_insert_bulk);
+ WT_STAT_CONN_DATA_INCR(session, cursor_insert_bulk);
/*
* If the "append" flag was configured, the application doesn't have to supply a key, else
@@ -98,8 +97,7 @@ __curbulk_insert_fix_bitmap(WT_CURSOR *cursor)
* single-threaded and not visible until the bulk cursor is closed.
*/
CURSOR_API_CALL(cursor, session, insert, btree);
- WT_STAT_CONN_INCR(session, cursor_insert_bulk);
- WT_STAT_DATA_INCR(session, cursor_insert_bulk);
+ WT_STAT_CONN_DATA_INCR(session, cursor_insert_bulk);
WT_ERR(__cursor_checkvalue(cursor));
@@ -131,8 +129,7 @@ __curbulk_insert_var(WT_CURSOR *cursor)
* single-threaded and not visible until the bulk cursor is closed.
*/
CURSOR_API_CALL(cursor, session, insert, btree);
- WT_STAT_CONN_INCR(session, cursor_insert_bulk);
- WT_STAT_DATA_INCR(session, cursor_insert_bulk);
+ WT_STAT_CONN_DATA_INCR(session, cursor_insert_bulk);
/*
* If the "append" flag was configured, the application doesn't have to supply a key, else
@@ -235,8 +232,7 @@ __curbulk_insert_row(WT_CURSOR *cursor)
* single-threaded and not visible until the bulk cursor is closed.
*/
CURSOR_API_CALL(cursor, session, insert, btree);
- WT_STAT_CONN_INCR(session, cursor_insert_bulk);
- WT_STAT_DATA_INCR(session, cursor_insert_bulk);
+ WT_STAT_CONN_DATA_INCR(session, cursor_insert_bulk);
WT_ERR(__cursor_checkkey(cursor));
WT_ERR(__cursor_checkvalue(cursor));
@@ -281,8 +277,7 @@ __curbulk_insert_row_skip_check(WT_CURSOR *cursor)
* single-threaded and not visible until the bulk cursor is closed.
*/
CURSOR_API_CALL(cursor, session, insert, btree);
- WT_STAT_CONN_INCR(session, cursor_insert_bulk);
- WT_STAT_DATA_INCR(session, cursor_insert_bulk);
+ WT_STAT_CONN_DATA_INCR(session, cursor_insert_bulk);
WT_ERR(__cursor_checkkey(cursor));
WT_ERR(__cursor_checkvalue(cursor));
diff --git a/src/third_party/wiredtiger/src/cursor/cur_ds.c b/src/third_party/wiredtiger/src/cursor/cur_ds.c
index 6bb3b3e1e73..9d5852abf76 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_ds.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_ds.c
@@ -152,8 +152,7 @@ __curds_next(WT_CURSOR *cursor)
CURSOR_API_CALL(cursor, session, next, NULL);
- WT_STAT_CONN_INCR(session, cursor_next);
- WT_STAT_DATA_INCR(session, cursor_next);
+ WT_STAT_CONN_DATA_INCR(session, cursor_next);
F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET);
ret = __curds_cursor_resolve(cursor, source->next(source));
@@ -177,8 +176,7 @@ __curds_prev(WT_CURSOR *cursor)
CURSOR_API_CALL(cursor, session, prev, NULL);
- WT_STAT_CONN_INCR(session, cursor_prev);
- WT_STAT_DATA_INCR(session, cursor_prev);
+ WT_STAT_CONN_DATA_INCR(session, cursor_prev);
F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET);
ret = __curds_cursor_resolve(cursor, source->prev(source));
@@ -202,8 +200,7 @@ __curds_reset(WT_CURSOR *cursor)
CURSOR_API_CALL_PREPARE_ALLOWED(cursor, session, reset, NULL);
- WT_STAT_CONN_INCR(session, cursor_reset);
- WT_STAT_DATA_INCR(session, cursor_reset);
+ WT_STAT_CONN_DATA_INCR(session, cursor_reset);
WT_ERR(source->reset(source));
@@ -228,8 +225,7 @@ __curds_search(WT_CURSOR *cursor)
CURSOR_API_CALL(cursor, session, search, NULL);
- WT_STAT_CONN_INCR(session, cursor_search);
- WT_STAT_DATA_INCR(session, cursor_search);
+ WT_STAT_CONN_DATA_INCR(session, cursor_search);
WT_ERR(__curds_key_set(cursor));
ret = __curds_cursor_resolve(cursor, source->search(source));
@@ -253,8 +249,7 @@ __curds_search_near(WT_CURSOR *cursor, int *exact)
CURSOR_API_CALL(cursor, session, search_near, NULL);
- WT_STAT_CONN_INCR(session, cursor_search_near);
- WT_STAT_DATA_INCR(session, cursor_search_near);
+ WT_STAT_CONN_DATA_INCR(session, cursor_search_near);
WT_ERR(__curds_key_set(cursor));
ret = __curds_cursor_resolve(cursor, source->search_near(source, exact));
@@ -278,8 +273,7 @@ __curds_insert(WT_CURSOR *cursor)
CURSOR_UPDATE_API_CALL(cursor, session, insert);
- WT_STAT_CONN_INCR(session, cursor_insert);
- WT_STAT_DATA_INCR(session, cursor_insert);
+ WT_STAT_CONN_DATA_INCR(session, cursor_insert);
WT_STAT_DATA_INCRV(session, cursor_insert_bytes, cursor->key.size + cursor->value.size);
if (!F_ISSET(cursor, WT_CURSTD_APPEND))
@@ -307,10 +301,8 @@ __curds_update(WT_CURSOR *cursor)
CURSOR_UPDATE_API_CALL(cursor, session, update);
- WT_STAT_CONN_INCR(session, cursor_update);
- WT_STAT_DATA_INCR(session, cursor_update);
- WT_STAT_CONN_INCRV(session, cursor_update_bytes, cursor->value.size);
- WT_STAT_DATA_INCRV(session, cursor_update_bytes, cursor->value.size);
+ WT_STAT_CONN_DATA_INCR(session, cursor_update);
+ WT_STAT_CONN_DATA_INCRV(session, cursor_update_bytes, cursor->value.size);
WT_ERR(__curds_key_set(cursor));
WT_ERR(__curds_value_set(cursor));
@@ -336,10 +328,8 @@ __curds_remove(WT_CURSOR *cursor)
CURSOR_REMOVE_API_CALL(cursor, session, NULL);
- WT_STAT_CONN_INCR(session, cursor_remove);
- WT_STAT_DATA_INCR(session, cursor_remove);
- WT_STAT_CONN_INCRV(session, cursor_remove_bytes, cursor->key.size);
- WT_STAT_DATA_INCRV(session, cursor_remove_bytes, cursor->key.size);
+ WT_STAT_CONN_DATA_INCR(session, cursor_remove);
+ WT_STAT_CONN_DATA_INCRV(session, cursor_remove_bytes, cursor->key.size);
WT_ERR(__curds_key_set(cursor));
ret = __curds_cursor_resolve(cursor, source->remove(source));
@@ -364,8 +354,7 @@ __curds_reserve(WT_CURSOR *cursor)
CURSOR_UPDATE_API_CALL(cursor, session, reserve);
- WT_STAT_CONN_INCR(session, cursor_reserve);
- WT_STAT_DATA_INCR(session, cursor_reserve);
+ WT_STAT_CONN_DATA_INCR(session, cursor_reserve);
WT_ERR(__curds_key_set(cursor));
ret = __curds_cursor_resolve(cursor, source->reserve(source));
diff --git a/src/third_party/wiredtiger/src/cursor/cur_file.c b/src/third_party/wiredtiger/src/cursor/cur_file.c
index b1b39c604fe..bb8c8cd6505 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_file.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_file.c
@@ -721,8 +721,7 @@ __curfile_create(WT_SESSION_IMPL *session, WT_CURSOR *owner, const char *cfg[],
WT_ERR(__wt_cursor_init(cursor, cursor->internal_uri, owner, cfg, cursorp));
- WT_STAT_CONN_INCR(session, cursor_create);
- WT_STAT_DATA_INCR(session, cursor_create);
+ WT_STAT_CONN_DATA_INCR(session, cursor_create);
if (0) {
err:
diff --git a/src/third_party/wiredtiger/src/cursor/cur_hs.c b/src/third_party/wiredtiger/src/cursor/cur_hs.c
index 56d37633a38..01d46849862 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_hs.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_hs.c
@@ -369,8 +369,7 @@ __curhs_prev_visible(WT_SESSION_IMPL *session, WT_CURSOR_HS *hs_cursor)
* we can skip it.
*/
if (__wt_txn_tw_stop_visible_all(session, &cbt->upd_value->tw)) {
- WT_STAT_CONN_INCR(session, cursor_prev_hs_tombstone);
- WT_STAT_DATA_INCR(session, cursor_prev_hs_tombstone);
+ WT_STAT_CONN_DATA_INCR(session, cursor_prev_hs_tombstone);
continue;
}
@@ -453,8 +452,7 @@ __curhs_next_visible(WT_SESSION_IMPL *session, WT_CURSOR_HS *hs_cursor)
* we can skip it.
*/
if (__wt_txn_tw_stop_visible_all(session, &cbt->upd_value->tw)) {
- WT_STAT_CONN_INCR(session, cursor_next_hs_tombstone);
- WT_STAT_DATA_INCR(session, cursor_next_hs_tombstone);
+ WT_STAT_CONN_DATA_INCR(session, cursor_next_hs_tombstone);
continue;
}
@@ -562,8 +560,7 @@ __curhs_search_near(WT_CURSOR *cursor, int *exactp)
* iterating backwards until we land on our key.
*/
while ((ret = __wt_hs_cursor_prev(session, file_cursor)) == 0) {
- WT_STAT_CONN_INCR(session, cursor_skip_hs_cur_position);
- WT_STAT_DATA_INCR(session, cursor_skip_hs_cur_position);
+ WT_STAT_CONN_DATA_INCR(session, cursor_skip_hs_cur_position);
WT_ERR(__wt_compare(session, NULL, &file_cursor->key, srch_key, &cmp));
if (cmp <= 0)
diff --git a/src/third_party/wiredtiger/src/cursor/cur_log.c b/src/third_party/wiredtiger/src/cursor/cur_log.c
index 01564f3fb34..84c7e15c30c 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_log.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_log.c
@@ -215,8 +215,7 @@ __curlog_next(WT_CURSOR *cursor)
}
WT_ASSERT(session, cl->logrec->data != NULL);
WT_ERR(__curlog_kv(session, cursor));
- WT_STAT_CONN_INCR(session, cursor_next);
- WT_STAT_DATA_INCR(session, cursor_next);
+ WT_STAT_CONN_DATA_INCR(session, cursor_next);
err:
API_END_RET(session, ret);
@@ -252,8 +251,7 @@ __curlog_search(WT_CURSOR *cursor)
ret = WT_NOTFOUND;
WT_ERR(ret);
WT_ERR(__curlog_kv(session, cursor));
- WT_STAT_CONN_INCR(session, cursor_search);
- WT_STAT_DATA_INCR(session, cursor_search);
+ WT_STAT_CONN_DATA_INCR(session, cursor_search);
err:
F_SET(cursor, raw);
diff --git a/src/third_party/wiredtiger/src/cursor/cur_std.c b/src/third_party/wiredtiger/src/cursor/cur_std.c
index c34d736b594..30878ed2441 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_std.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_std.c
@@ -736,8 +736,7 @@ __wt_cursor_cache_release(WT_SESSION_IMPL *session, WT_CURSOR *cursor, bool *rel
* caching fails, we'll decrement the statistics after reopening the cursor (and getting the
* data handle back).
*/
- WT_STAT_CONN_INCR(session, cursor_cache);
- WT_STAT_DATA_INCR(session, cursor_cache);
+ WT_STAT_CONN_DATA_INCR(session, cursor_cache);
WT_ERR(cursor->cache(cursor));
WT_ASSERT(session, F_ISSET(cursor, WT_CURSTD_CACHED));
*released = true;
@@ -751,8 +750,7 @@ __wt_cursor_cache_release(WT_SESSION_IMPL *session, WT_CURSOR *cursor, bool *rel
err:
WT_TRET(cursor->reopen(cursor, false));
WT_ASSERT(session, !F_ISSET(cursor, WT_CURSTD_CACHED));
- WT_STAT_CONN_DECR(session, cursor_cache);
- WT_STAT_DATA_DECR(session, cursor_cache);
+ WT_STAT_CONN_DATA_DECR(session, cursor_cache);
}
return (ret);
@@ -887,8 +885,7 @@ __wt_cursor_cache_get(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *to_d
}
}
- WT_STAT_CONN_INCR(session, cursor_reopen);
- WT_STAT_DATA_INCR(session, cursor_reopen);
+ WT_STAT_CONN_DATA_INCR(session, cursor_reopen);
*cursorp = cursor;
return (0);
diff --git a/src/third_party/wiredtiger/src/evict/evict_file.c b/src/third_party/wiredtiger/src/evict/evict_file.c
index 9bb730c4f22..b66f8d3b1b0 100644
--- a/src/third_party/wiredtiger/src/evict/evict_file.c
+++ b/src/third_party/wiredtiger/src/evict/evict_file.c
@@ -69,7 +69,7 @@ __wt_evict_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
* history.
*/
rec_flags = WT_REC_EVICT | WT_REC_CLEAN_AFTER_REC | WT_REC_VISIBLE_ALL;
- if (!WT_IS_HS(btree) && !WT_IS_METADATA(dhandle))
+ if (!WT_IS_HS(btree->dhandle) && !WT_IS_METADATA(dhandle))
rec_flags |= WT_REC_HS;
WT_ERR(__wt_reconcile(session, ref, NULL, rec_flags));
}
diff --git a/src/third_party/wiredtiger/src/evict/evict_lru.c b/src/third_party/wiredtiger/src/evict/evict_lru.c
index bccd79c8674..99a560fbe19 100644
--- a/src/third_party/wiredtiger/src/evict/evict_lru.c
+++ b/src/third_party/wiredtiger/src/evict/evict_lru.c
@@ -1838,7 +1838,8 @@ __evict_walk_tree(WT_SESSION_IMPL *session, WT_EVICT_QUEUE *queue, u_int max_ent
* create "deserts" in trees where no good eviction candidates can be found. Abandon the
* walk if we get into that situation.
*/
- give_up = !__wt_cache_aggressive(session) && !WT_IS_HS(btree) && pages_seen > min_pages &&
+ give_up = !__wt_cache_aggressive(session) && !WT_IS_HS(btree->dhandle) &&
+ pages_seen > min_pages &&
(pages_queued == 0 || (pages_seen / pages_queued) > (min_pages / target_pages));
if (give_up) {
/*
@@ -2045,16 +2046,13 @@ fast:
}
WT_STAT_CONN_INCRV(session, cache_eviction_walk, refs_walked);
- WT_STAT_CONN_INCRV(session, cache_eviction_pages_seen, pages_seen);
- WT_STAT_DATA_INCRV(session, cache_eviction_pages_seen, pages_seen);
+ WT_STAT_CONN_DATA_INCRV(session, cache_eviction_pages_seen, pages_seen);
WT_STAT_CONN_INCRV(session, cache_eviction_pages_already_queued, pages_already_queued);
WT_STAT_CONN_INCRV(session, cache_eviction_internal_pages_seen, internal_pages_seen);
WT_STAT_CONN_INCRV(
session, cache_eviction_internal_pages_already_queued, internal_pages_already_queued);
WT_STAT_CONN_INCRV(session, cache_eviction_internal_pages_queued, internal_pages_queued);
- WT_STAT_CONN_INCRV(session, cache_eviction_walk_passes, 1);
- WT_STAT_DATA_INCRV(session, cache_eviction_walk_passes, 1);
-
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_walk_passes);
return (0);
}
diff --git a/src/third_party/wiredtiger/src/evict/evict_page.c b/src/third_party/wiredtiger/src/evict/evict_page.c
index 49a33870db0..e28c3cfb7ec 100644
--- a/src/third_party/wiredtiger/src/evict/evict_page.c
+++ b/src/third_party/wiredtiger/src/evict/evict_page.c
@@ -40,8 +40,7 @@ __evict_exclusive(WT_SESSION_IMPL *session, WT_REF *ref)
if (__wt_hazard_check(session, ref, NULL) == NULL)
return (0);
- WT_STAT_DATA_INCR(session, cache_eviction_hazard);
- WT_STAT_CONN_INCR(session, cache_eviction_hazard);
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_hazard);
return (__wt_set_return(session, EBUSY));
}
@@ -132,7 +131,7 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, uint8_t previous_state, uint32
/*
* Track history store pages being force evicted while holding a history store cursor open.
*/
- if (session->hs_cursor != NULL && WT_IS_HS(S2BT(session))) {
+ if (session->hs_cursor != NULL && WT_IS_HS(session->dhandle)) {
force_evict_hs = true;
WT_STAT_CONN_INCR(session, cache_eviction_force_hs);
}
@@ -171,10 +170,8 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, uint8_t previous_state, uint32
WT_ASSERT(session, !__wt_gen_active(session, WT_GEN_SPLIT, page->pg_intl_split_gen));
/* Count evictions of internal pages during normal operation. */
- if (!closing && F_ISSET(ref, WT_REF_FLAG_INTERNAL)) {
- WT_STAT_CONN_INCR(session, cache_eviction_internal);
- WT_STAT_DATA_INCR(session, cache_eviction_internal);
- }
+ if (!closing && F_ISSET(ref, WT_REF_FLAG_INTERNAL))
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_internal);
/*
* Track the largest page size seen at eviction, it tells us something about our ability to
@@ -221,13 +218,10 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, uint8_t previous_state, uint32
session, cache_eviction_force_dirty_time, WT_CLOCKDIFF_US(time_stop, time_start));
}
}
- if (clean_page) {
- WT_STAT_CONN_INCR(session, cache_eviction_clean);
- WT_STAT_DATA_INCR(session, cache_eviction_clean);
- } else {
- WT_STAT_CONN_INCR(session, cache_eviction_dirty);
- WT_STAT_DATA_INCR(session, cache_eviction_dirty);
- }
+ if (clean_page)
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_clean);
+ else
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_dirty);
/* Count page evictions in parallel with checkpoint. */
if (conn->txn_global.checkpoint_running)
@@ -247,8 +241,7 @@ err:
session, cache_eviction_force_fail_time, WT_CLOCKDIFF_US(time_stop, time_start));
}
- WT_STAT_CONN_INCR(session, cache_eviction_fail);
- WT_STAT_DATA_INCR(session, cache_eviction_fail);
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_fail);
}
done:
@@ -627,7 +620,7 @@ __evict_review(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t evict_flags, bool
if (closing)
LF_SET(WT_REC_VISIBILITY_ERR);
- else if (F_ISSET(ref, WT_REF_FLAG_INTERNAL) || WT_IS_HS(btree))
+ else if (F_ISSET(ref, WT_REF_FLAG_INTERNAL) || WT_IS_HS(btree->dhandle))
;
else if (WT_SESSION_BTREE_SYNC(session) && !WT_IS_METADATA(btree->dhandle))
LF_SET(WT_REC_HS);
@@ -667,7 +660,7 @@ __evict_review(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t evict_flags, bool
/* Make sure that both conditions above are not true at the same time. */
WT_ASSERT(session, !use_snapshot_for_app_thread || !is_eviction_thread);
- if (!conn->txn_global.checkpoint_running && !WT_IS_HS(btree) &&
+ if (!conn->txn_global.checkpoint_running && !WT_IS_HS(btree->dhandle) &&
(use_snapshot_for_app_thread || is_eviction_thread)) {
if (is_eviction_thread) {
/*
diff --git a/src/third_party/wiredtiger/src/history/hs_conn.c b/src/third_party/wiredtiger/src/history/hs_conn.c
index 2917aec815c..554e504754c 100644
--- a/src/third_party/wiredtiger/src/history/hs_conn.c
+++ b/src/third_party/wiredtiger/src/history/hs_conn.c
@@ -117,8 +117,8 @@ __wt_hs_config(WT_SESSION_IMPL *session, const char **cfg)
* Test flags before setting them so updates can't race in subsequent opens (the first update is
* safe because it's single-threaded from wiredtiger_open).
*/
- if (!F_ISSET(btree, WT_BTREE_HS))
- F_SET(btree, WT_BTREE_HS);
+ if (!F_ISSET(btree->dhandle, WT_DHANDLE_HS))
+ F_SET(btree->dhandle, WT_DHANDLE_HS);
if (!F_ISSET(btree, WT_BTREE_NO_LOGGING))
F_SET(btree, WT_BTREE_NO_LOGGING);
diff --git a/src/third_party/wiredtiger/src/history/hs_cursor.c b/src/third_party/wiredtiger/src/history/hs_cursor.c
index 96ac7ca8fad..333ec0e25bb 100644
--- a/src/third_party/wiredtiger/src/history/hs_cursor.c
+++ b/src/third_party/wiredtiger/src/history/hs_cursor.c
@@ -100,7 +100,7 @@ __hs_cursor_position_int(WT_SESSION_IMPL *session, WT_CURSOR *cursor, uint32_t b
int cmp, exact;
/* The session should be pointing at the history store btree. */
- WT_ASSERT(session, WT_IS_HS(S2BT(session)));
+ WT_ASSERT(session, WT_IS_HS((S2BT(session))->dhandle));
if (user_srch_key == NULL)
WT_RET(__wt_scr_alloc(session, 0, &srch_key));
@@ -130,8 +130,7 @@ __hs_cursor_position_int(WT_SESSION_IMPL *session, WT_CURSOR *cursor, uint32_t b
* backwards until we land on our key.
*/
while ((ret = cursor->prev(cursor)) == 0) {
- WT_STAT_CONN_INCR(session, cursor_skip_hs_cur_position);
- WT_STAT_DATA_INCR(session, cursor_skip_hs_cur_position);
+ WT_STAT_CONN_DATA_INCR(session, cursor_skip_hs_cur_position);
WT_ERR(__wt_compare(session, NULL, &cursor->key, srch_key, &cmp));
if (cmp <= 0)
@@ -210,8 +209,7 @@ __hs_find_upd_int(WT_SESSION_IMPL *session, uint32_t btree_id, WT_ITEM *key,
txn_shared = WT_SESSION_TXN_SHARED(session);
upd_found = false;
- WT_STAT_CONN_INCR(session, cursor_search_hs);
- WT_STAT_DATA_INCR(session, cursor_search_hs);
+ WT_STAT_CONN_DATA_INCR(session, cursor_search_hs);
hs_cursor = session->hs_cursor;
hs_cbt = (WT_CURSOR_BTREE *)hs_cursor;
@@ -278,8 +276,7 @@ __hs_find_upd_int(WT_SESSION_IMPL *session, uint32_t btree_id, WT_ITEM *key,
* we can skip it.
*/
if (__wt_txn_tw_stop_visible_all(session, &hs_cbt->upd_value->tw)) {
- WT_STAT_CONN_INCR(session, cursor_prev_hs_tombstone);
- WT_STAT_DATA_INCR(session, cursor_prev_hs_tombstone);
+ WT_STAT_CONN_DATA_INCR(session, cursor_prev_hs_tombstone);
continue;
}
/*
@@ -401,8 +398,7 @@ __hs_find_upd_int(WT_SESSION_IMPL *session, uint32_t btree_id, WT_ITEM *key,
WT_ERR(__wt_modify_apply_item(session, value_format, hs_value, mod_upd->data));
__wt_free_update_list(session, &mod_upd);
}
- WT_STAT_CONN_INCR(session, cache_hs_read_squash);
- WT_STAT_DATA_INCR(session, cache_hs_read_squash);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_read_squash);
}
/*
@@ -432,13 +428,11 @@ err:
__wt_modify_vector_free(&modifies);
if (ret == 0) {
- if (upd_found) {
- WT_STAT_CONN_INCR(session, cache_hs_read);
- WT_STAT_DATA_INCR(session, cache_hs_read);
- } else {
+ if (upd_found)
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_read);
+ else {
upd_value->type = WT_UPDATE_INVALID;
- WT_STAT_CONN_INCR(session, cache_hs_read_miss);
- WT_STAT_DATA_INCR(session, cache_hs_read_miss);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_read_miss);
}
}
diff --git a/src/third_party/wiredtiger/src/history/hs_rec.c b/src/third_party/wiredtiger/src/history/hs_rec.c
index b0ea9dbd669..e8a7c737d3f 100644
--- a/src/third_party/wiredtiger/src/history/hs_rec.c
+++ b/src/third_party/wiredtiger/src/history/hs_rec.c
@@ -78,7 +78,7 @@ __hs_insert_record_with_btree_int(WT_SESSION_IMPL *session, WT_CURSOR *cursor, u
hs_upd = upd_local = NULL;
/* The session should be pointing at the history store btree. */
- WT_ASSERT(session, WT_IS_HS(S2BT(session)));
+ WT_ASSERT(session, WT_IS_HS((S2BT(session))->dhandle));
/*
* Use WT_CURSOR.set_key and WT_CURSOR.set_value to create key and value items, then use them to
@@ -123,8 +123,7 @@ __hs_insert_record_with_btree_int(WT_SESSION_IMPL *session, WT_CURSOR *cursor, u
* Since the two updates (tombstone and the standard) will reconcile into a single entry, we are
* incrementing the history store insert statistic by one.
*/
- WT_STAT_CONN_INCR(session, cache_hs_insert);
- WT_STAT_DATA_INCR(session, cache_hs_insert);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_insert);
err:
if (ret != 0) {
@@ -188,8 +187,8 @@ __hs_insert_record_with_btree(WT_SESSION_IMPL *session, WT_CURSOR *cursor, WT_BT
* history store content is associated with (this is where the btree id part of the history
* store key comes from).
*/
- WT_ASSERT(session, WT_IS_HS(S2BT(session)));
- WT_ASSERT(session, !WT_IS_HS(btree));
+ WT_ASSERT(session, WT_IS_HS((S2BT(session))->dhandle));
+ WT_ASSERT(session, !WT_IS_HS(btree->dhandle));
/*
* Disable bulk loads into history store. This would normally occur when updating a record with
@@ -266,10 +265,8 @@ __hs_insert_record_with_btree(WT_SESSION_IMPL *session, WT_CURSOR *cursor, WT_BT
#endif
/* The tree structure can change while we try to insert the mod list, retry if that happens. */
while ((ret = __hs_insert_record_with_btree_int(
- session, cursor, btree->id, key, type, hs_value, tw, counter)) == WT_RESTART) {
- WT_STAT_CONN_INCR(session, cache_hs_insert_restart);
- WT_STAT_DATA_INCR(session, cache_hs_insert_restart);
- }
+ session, cursor, btree->id, key, type, hs_value, tw, counter)) == WT_RESTART)
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_insert_restart);
err:
#ifdef HAVE_DIAGNOSTIC
__wt_scr_free(session, &existing_val);
@@ -474,8 +471,7 @@ __wt_hs_insert_updates(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi)
*/
if (upd->start_ts != upd->durable_ts) {
WT_ASSERT(session, min_insert_ts < upd->durable_ts);
- WT_STAT_CONN_INCR(session, cache_hs_order_lose_durable_timestamp);
- WT_STAT_DATA_INCR(session, cache_hs_order_lose_durable_timestamp);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_order_lose_durable_timestamp);
}
__wt_verbose(session, WT_VERB_TIMESTAMP,
"fixing out-of-order updates during insertion; start_ts=%s, durable_start_ts=%s, "
@@ -484,8 +480,7 @@ __wt_hs_insert_updates(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi)
__wt_timestamp_to_string(upd->durable_ts, ts_string[1]),
__wt_timestamp_to_string(min_insert_ts, ts_string[2]));
upd->start_ts = upd->durable_ts = min_insert_ts;
- WT_STAT_CONN_INCR(session, cache_hs_order_fixup_insert);
- WT_STAT_DATA_INCR(session, cache_hs_order_fixup_insert);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_order_fixup_insert);
} else if (upd->start_ts != WT_TS_NONE)
/*
* Don't reset to WT_TS_NONE as we don't want to clear the timestamps for updates
@@ -559,14 +554,12 @@ __wt_hs_insert_updates(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi)
!F_ISSET(first_non_ts_upd, WT_UPDATE_CLEARED_HS)) {
/* We can only delete history store entries that have timestamps. */
WT_ERR(__wt_hs_delete_key_from_ts(session, btree->id, key, 1, true));
- WT_STAT_CONN_INCR(session, cache_hs_key_truncate_non_ts);
- WT_STAT_DATA_INCR(session, cache_hs_key_truncate_non_ts);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_key_truncate_non_ts);
F_SET(first_non_ts_upd, WT_UPDATE_CLEARED_HS);
} else if (first_non_ts_upd != NULL && !F_ISSET(first_non_ts_upd, WT_UPDATE_CLEARED_HS) &&
(list->ins == NULL || ts_updates_in_hs)) {
WT_ERR(__wt_hs_delete_key_from_ts(session, btree->id, key, 1, true));
- WT_STAT_CONN_INCR(session, cache_hs_key_truncate_non_ts);
- WT_STAT_DATA_INCR(session, cache_hs_key_truncate_non_ts);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_key_truncate_non_ts);
F_SET(first_non_ts_upd, WT_UPDATE_CLEARED_HS);
}
@@ -711,16 +704,13 @@ __wt_hs_insert_updates(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi)
hs_inserted = true;
++insert_cnt;
if (squashed) {
- WT_STAT_CONN_INCR(session, cache_hs_write_squash);
- WT_STAT_DATA_INCR(session, cache_hs_write_squash);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_write_squash);
squashed = false;
}
}
- if (modifies.size > 0) {
- WT_STAT_CONN_INCR(session, cache_hs_write_squash);
- WT_STAT_DATA_INCR(session, cache_hs_write_squash);
- }
+ if (modifies.size > 0)
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_write_squash);
}
WT_ERR(__wt_block_manager_named_size(session, WT_HS_FILE, &hs_size));
@@ -763,7 +753,7 @@ __hs_delete_key_from_ts_int(
int cmp, exact;
/* The session should be pointing at the history store btree. */
- WT_ASSERT(session, WT_IS_HS(S2BT(session)));
+ WT_ASSERT(session, WT_IS_HS((S2BT(session))->dhandle));
hs_cursor = session->hs_cursor;
WT_RET(__wt_scr_alloc(session, 0, &srch_key));
@@ -827,10 +817,8 @@ __wt_hs_delete_key_from_ts(
do {
WT_WITH_BTREE(session, CUR2BT(session->hs_cursor),
(ret = __hs_delete_key_from_ts_int(session, btree_id, key, ts, reinsert)));
- if (ret == WT_RESTART) {
- WT_STAT_CONN_INCR(session, cache_hs_insert_restart);
- WT_STAT_DATA_INCR(session, cache_hs_insert_restart);
- }
+ if (ret == WT_RESTART)
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_insert_restart);
} while (ret == WT_RESTART);
return (ret);
@@ -867,7 +855,7 @@ __hs_fixup_out_of_order_from_pos(WT_SESSION_IMPL *session, WT_CURSOR *hs_cursor,
tombstone = NULL;
/* The session should be pointing at the history store btree. */
- WT_ASSERT(session, WT_IS_HS(S2BT(session)));
+ WT_ASSERT(session, WT_IS_HS((S2BT(session))->dhandle));
/*
* Position ourselves at the beginning of the key range that we may have to fixup. Prior to
@@ -931,8 +919,7 @@ __hs_fixup_out_of_order_from_pos(WT_SESSION_IMPL *session, WT_CURSOR *hs_cursor,
* we can skip it.
*/
if (__wt_txn_tw_stop_visible_all(session, &hs_cbt->upd_value->tw)) {
- WT_STAT_CONN_INCR(session, cursor_next_hs_tombstone);
- WT_STAT_DATA_INCR(session, cursor_next_hs_tombstone);
+ WT_STAT_CONN_DATA_INCR(session, cursor_next_hs_tombstone);
continue;
}
/*
@@ -959,10 +946,8 @@ __hs_fixup_out_of_order_from_pos(WT_SESSION_IMPL *session, WT_CURSOR *hs_cursor,
* will be clobbered by our fix-up process. Keep track of how often this is happening.
*/
if (hs_cbt->upd_value->tw.start_ts != hs_cbt->upd_value->tw.durable_start_ts ||
- hs_cbt->upd_value->tw.stop_ts != hs_cbt->upd_value->tw.durable_stop_ts) {
- WT_STAT_CONN_INCR(session, cache_hs_order_lose_durable_timestamp);
- WT_STAT_DATA_INCR(session, cache_hs_order_lose_durable_timestamp);
- }
+ hs_cbt->upd_value->tw.stop_ts != hs_cbt->upd_value->tw.durable_stop_ts)
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_order_lose_durable_timestamp);
__wt_verbose(session, WT_VERB_TIMESTAMP,
"fixing existing out-of-order updates by moving them; start_ts=%s, durable_start_ts=%s, "
@@ -1006,8 +991,7 @@ __hs_fixup_out_of_order_from_pos(WT_SESSION_IMPL *session, WT_CURSOR *hs_cursor,
}
WT_ERR(ret);
tombstone = NULL;
- WT_STAT_CONN_INCR(session, cache_hs_order_fixup_move);
- WT_STAT_DATA_INCR(session, cache_hs_order_fixup_move);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_order_fixup_move);
}
if (ret == WT_NOTFOUND)
ret = 0;
@@ -1096,8 +1080,7 @@ __hs_delete_key_from_pos(WT_SESSION_IMPL *session, WT_CURSOR *hs_cursor, uint32_
* we can skip it.
*/
if (__wt_txn_tw_stop_visible_all(session, &hs_cbt->upd_value->tw)) {
- WT_STAT_CONN_INCR(session, cursor_next_hs_tombstone);
- WT_STAT_DATA_INCR(session, cursor_next_hs_tombstone);
+ WT_STAT_CONN_DATA_INCR(session, cursor_next_hs_tombstone);
continue;
}
@@ -1150,8 +1133,7 @@ __hs_delete_key_from_pos(WT_SESSION_IMPL *session, WT_CURSOR *hs_cursor, uint32_
WT_ERR(ret);
}
upd = NULL;
- WT_STAT_CONN_INCR(session, cache_hs_key_truncate);
- WT_STAT_DATA_INCR(session, cache_hs_key_truncate);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_key_truncate);
}
if (ret == WT_NOTFOUND)
ret = 0;
diff --git a/src/third_party/wiredtiger/src/include/btree.h b/src/third_party/wiredtiger/src/include/btree.h
index 85ddcff102d..fb7167663c6 100644
--- a/src/third_party/wiredtiger/src/include/btree.h
+++ b/src/third_party/wiredtiger/src/include/btree.h
@@ -249,14 +249,13 @@ struct __wt_btree {
#define WT_BTREE_CLOSED 0x000400u /* Handle closed */
#define WT_BTREE_IGNORE_CACHE 0x000800u /* Cache-resident object */
#define WT_BTREE_IN_MEMORY 0x001000u /* Cache-resident object */
-#define WT_BTREE_HS 0x002000u /* History store table */
-#define WT_BTREE_NO_CHECKPOINT 0x004000u /* Disable checkpoints */
-#define WT_BTREE_NO_LOGGING 0x008000u /* Disable logging */
-#define WT_BTREE_READONLY 0x010000u /* Handle is readonly */
-#define WT_BTREE_SALVAGE 0x020000u /* Handle is for salvage */
-#define WT_BTREE_SKIP_CKPT 0x040000u /* Handle skipped checkpoint */
-#define WT_BTREE_UPGRADE 0x080000u /* Handle is for upgrade */
-#define WT_BTREE_VERIFY 0x100000u /* Handle is for verify */
+#define WT_BTREE_NO_CHECKPOINT 0x002000u /* Disable checkpoints */
+#define WT_BTREE_NO_LOGGING 0x004000u /* Disable logging */
+#define WT_BTREE_READONLY 0x008000u /* Handle is readonly */
+#define WT_BTREE_SALVAGE 0x010000u /* Handle is for salvage */
+#define WT_BTREE_SKIP_CKPT 0x020000u /* Handle skipped checkpoint */
+#define WT_BTREE_UPGRADE 0x040000u /* Handle is for upgrade */
+#define WT_BTREE_VERIFY 0x080000u /* Handle is for verify */
uint32_t flags;
};
diff --git a/src/third_party/wiredtiger/src/include/btree_inline.h b/src/third_party/wiredtiger/src/include/btree_inline.h
index dfa6adf21af..f3563d6fe41 100644
--- a/src/third_party/wiredtiger/src/include/btree_inline.h
+++ b/src/third_party/wiredtiger/src/include/btree_inline.h
@@ -1362,8 +1362,7 @@ __wt_leaf_page_can_split(WT_SESSION_IMPL *session, WT_PAGE *page)
if (++count < WT_MAX_SPLIT_COUNT)
continue;
- WT_STAT_CONN_INCR(session, cache_inmem_splittable);
- WT_STAT_DATA_INCR(session, cache_inmem_splittable);
+ WT_STAT_CONN_DATA_INCR(session, cache_inmem_splittable);
return (true);
}
@@ -1384,8 +1383,7 @@ __wt_leaf_page_can_split(WT_SESSION_IMPL *session, WT_PAGE *page)
count += WT_MIN_SPLIT_MULTIPLIER;
size += WT_MIN_SPLIT_MULTIPLIER * (WT_INSERT_KEY_SIZE(ins) + WT_UPDATE_MEMSIZE(ins->upd));
if (count > WT_MIN_SPLIT_COUNT && size > (size_t)btree->maxleafpage) {
- WT_STAT_CONN_INCR(session, cache_inmem_splittable);
- WT_STAT_DATA_INCR(session, cache_inmem_splittable);
+ WT_STAT_CONN_DATA_INCR(session, cache_inmem_splittable);
return (true);
}
}
@@ -1491,8 +1489,7 @@ __wt_page_can_evict(WT_SESSION_IMPL *session, WT_REF *ref, bool *inmem_splitp)
* internal page already written in the checkpoint, leaving the checkpoint inconsistent.
*/
if (modified && !__wt_btree_can_evict_dirty(session)) {
- WT_STAT_CONN_INCR(session, cache_eviction_checkpoint);
- WT_STAT_DATA_INCR(session, cache_eviction_checkpoint);
+ WT_STAT_CONN_DATA_INCR(session, cache_eviction_checkpoint);
return (false);
}
diff --git a/src/third_party/wiredtiger/src/include/cache.h b/src/third_party/wiredtiger/src/include/cache.h
index 976293fb083..16bad36997b 100644
--- a/src/third_party/wiredtiger/src/include/cache.h
+++ b/src/third_party/wiredtiger/src/include/cache.h
@@ -272,7 +272,7 @@ struct __wt_cache_pool {
* Optimize comparisons against the history store URI, flag handles that reference the history store
* file.
*/
-#define WT_IS_HS(btree) F_ISSET(btree, WT_BTREE_HS)
+#define WT_IS_HS(dh) F_ISSET(dh, WT_DHANDLE_HS)
/* Flags used with __wt_evict */
/* AUTOMATIC FLAG VALUE GENERATION START */
diff --git a/src/third_party/wiredtiger/src/include/dhandle.h b/src/third_party/wiredtiger/src/include/dhandle.h
index 2ee23b71701..9f98cf87e3f 100644
--- a/src/third_party/wiredtiger/src/include/dhandle.h
+++ b/src/third_party/wiredtiger/src/include/dhandle.h
@@ -102,15 +102,16 @@ struct __wt_data_handle {
/* Flags values over 0xff are reserved for WT_BTREE_* */
/* AUTOMATIC FLAG VALUE GENERATION START */
-#define WT_DHANDLE_DEAD 0x01u /* Dead, awaiting discard */
-#define WT_DHANDLE_DISCARD 0x02u /* Close on release */
-#define WT_DHANDLE_DISCARD_KILL 0x04u /* Mark dead on release */
-#define WT_DHANDLE_DROPPED 0x08u /* Handle is dropped */
-#define WT_DHANDLE_EXCLUSIVE 0x10u /* Exclusive access */
-#define WT_DHANDLE_IS_METADATA 0x20u /* Metadata handle */
-#define WT_DHANDLE_LOCK_ONLY 0x40u /* Handle only used as a lock */
-#define WT_DHANDLE_OPEN 0x80u /* Handle is open */
- /* AUTOMATIC FLAG VALUE GENERATION STOP */
+#define WT_DHANDLE_DEAD 0x001u /* Dead, awaiting discard */
+#define WT_DHANDLE_DISCARD 0x002u /* Close on release */
+#define WT_DHANDLE_DISCARD_KILL 0x004u /* Mark dead on release */
+#define WT_DHANDLE_DROPPED 0x008u /* Handle is dropped */
+#define WT_DHANDLE_EXCLUSIVE 0x010u /* Exclusive access */
+#define WT_DHANDLE_HS 0x020u /* History store table */
+#define WT_DHANDLE_IS_METADATA 0x040u /* Metadata handle */
+#define WT_DHANDLE_LOCK_ONLY 0x080u /* Handle only used as a lock */
+#define WT_DHANDLE_OPEN 0x100u /* Handle is open */
+ /* AUTOMATIC FLAG VALUE GENERATION STOP */
uint32_t flags;
/* AUTOMATIC FLAG VALUE GENERATION START */
diff --git a/src/third_party/wiredtiger/src/include/reconcile_inline.h b/src/third_party/wiredtiger/src/include/reconcile_inline.h
index 2e55904d61e..2c2e346da80 100644
--- a/src/third_party/wiredtiger/src/include/reconcile_inline.h
+++ b/src/third_party/wiredtiger/src/include/reconcile_inline.h
@@ -92,109 +92,70 @@ __rec_page_time_stats(WT_SESSION_IMPL *session, WT_RECONCILE *r)
{
/* Time window statistics */
if (r->count_durable_start_ts != 0) {
- WT_STAT_CONN_INCRV(
+ WT_STAT_CONN_DATA_INCR(session, rec_time_window_pages_durable_start_ts);
+ WT_STAT_CONN_DATA_INCRV(
session, rec_time_window_bytes_ts, r->count_durable_start_ts * sizeof(wt_timestamp_t));
- WT_STAT_DATA_INCRV(
- session, rec_time_window_bytes_ts, r->count_durable_start_ts * sizeof(wt_timestamp_t));
- WT_STAT_CONN_INCRV(session, rec_time_window_durable_start_ts, r->count_durable_start_ts);
- WT_STAT_DATA_INCRV(session, rec_time_window_durable_start_ts, r->count_durable_start_ts);
- WT_STAT_CONN_INCR(session, rec_time_window_pages_durable_start_ts);
- WT_STAT_DATA_INCR(session, rec_time_window_pages_durable_start_ts);
+ WT_STAT_CONN_DATA_INCRV(
+ session, rec_time_window_durable_start_ts, r->count_durable_start_ts);
r->rec_page_cell_with_ts = true;
}
if (r->count_start_ts != 0) {
- WT_STAT_CONN_INCRV(
- session, rec_time_window_bytes_ts, r->count_start_ts * sizeof(wt_timestamp_t));
- WT_STAT_DATA_INCRV(
+ WT_STAT_CONN_DATA_INCRV(
session, rec_time_window_bytes_ts, r->count_start_ts * sizeof(wt_timestamp_t));
- WT_STAT_CONN_INCRV(session, rec_time_window_start_ts, r->count_start_ts);
- WT_STAT_DATA_INCRV(session, rec_time_window_start_ts, r->count_start_ts);
- WT_STAT_CONN_INCR(session, rec_time_window_pages_start_ts);
- WT_STAT_DATA_INCR(session, rec_time_window_pages_start_ts);
+ WT_STAT_CONN_DATA_INCRV(session, rec_time_window_start_ts, r->count_start_ts);
+ WT_STAT_CONN_DATA_INCR(session, rec_time_window_pages_start_ts);
r->rec_page_cell_with_ts = true;
}
if (r->count_start_txn != 0) {
- WT_STAT_CONN_INCRV(
+ WT_STAT_CONN_DATA_INCRV(
session, rec_time_window_bytes_txn, r->count_start_txn * sizeof(uint64_t));
- WT_STAT_DATA_INCRV(
- session, rec_time_window_bytes_txn, r->count_start_txn * sizeof(uint64_t));
- WT_STAT_CONN_INCRV(session, rec_time_window_start_txn, r->count_start_txn);
- WT_STAT_DATA_INCRV(session, rec_time_window_start_txn, r->count_start_txn);
- WT_STAT_CONN_INCR(session, rec_time_window_pages_start_txn);
- WT_STAT_DATA_INCR(session, rec_time_window_pages_start_txn);
+ WT_STAT_CONN_DATA_INCRV(session, rec_time_window_start_txn, r->count_start_txn);
+ WT_STAT_CONN_DATA_INCR(session, rec_time_window_pages_start_txn);
r->rec_page_cell_with_txn_id = true;
}
if (r->count_durable_stop_ts != 0) {
- WT_STAT_CONN_INCRV(
- session, rec_time_window_bytes_ts, r->count_durable_stop_ts * sizeof(wt_timestamp_t));
- WT_STAT_DATA_INCRV(
+ WT_STAT_CONN_DATA_INCRV(
session, rec_time_window_bytes_ts, r->count_durable_stop_ts * sizeof(wt_timestamp_t));
- WT_STAT_CONN_INCRV(session, rec_time_window_durable_stop_ts, r->count_durable_stop_ts);
- WT_STAT_DATA_INCRV(session, rec_time_window_durable_stop_ts, r->count_durable_stop_ts);
- WT_STAT_CONN_INCR(session, rec_time_window_pages_durable_stop_ts);
- WT_STAT_DATA_INCR(session, rec_time_window_pages_durable_stop_ts);
+ WT_STAT_CONN_DATA_INCRV(session, rec_time_window_durable_stop_ts, r->count_durable_stop_ts);
+ WT_STAT_CONN_DATA_INCR(session, rec_time_window_pages_durable_stop_ts);
r->rec_page_cell_with_ts = true;
}
if (r->count_stop_ts != 0) {
- WT_STAT_CONN_INCRV(
+ WT_STAT_CONN_DATA_INCRV(
session, rec_time_window_bytes_ts, r->count_stop_ts * sizeof(wt_timestamp_t));
- WT_STAT_DATA_INCRV(
- session, rec_time_window_bytes_ts, r->count_stop_ts * sizeof(wt_timestamp_t));
- WT_STAT_CONN_INCRV(session, rec_time_window_stop_ts, r->count_stop_ts);
- WT_STAT_DATA_INCRV(session, rec_time_window_stop_ts, r->count_stop_ts);
- WT_STAT_CONN_INCR(session, rec_time_window_pages_stop_ts);
- WT_STAT_DATA_INCR(session, rec_time_window_pages_stop_ts);
+ WT_STAT_CONN_DATA_INCRV(session, rec_time_window_stop_ts, r->count_stop_ts);
+ WT_STAT_CONN_DATA_INCR(session, rec_time_window_pages_stop_ts);
r->rec_page_cell_with_ts = true;
}
if (r->count_stop_txn != 0) {
- WT_STAT_CONN_INCRV(
- session, rec_time_window_bytes_txn, r->count_stop_txn * sizeof(uint64_t));
- WT_STAT_DATA_INCRV(
+ WT_STAT_CONN_DATA_INCRV(
session, rec_time_window_bytes_txn, r->count_stop_txn * sizeof(uint64_t));
- WT_STAT_CONN_INCRV(session, rec_time_window_stop_txn, r->count_stop_txn);
- WT_STAT_DATA_INCRV(session, rec_time_window_stop_txn, r->count_stop_txn);
- WT_STAT_CONN_INCR(session, rec_time_window_pages_stop_txn);
- WT_STAT_DATA_INCR(session, rec_time_window_pages_stop_txn);
+ WT_STAT_CONN_DATA_INCRV(session, rec_time_window_stop_txn, r->count_stop_txn);
+ WT_STAT_CONN_DATA_INCR(session, rec_time_window_pages_stop_txn);
r->rec_page_cell_with_txn_id = true;
}
if (r->count_prepare != 0) {
- WT_STAT_CONN_INCRV(session, rec_time_window_prepared, r->count_prepare);
- WT_STAT_DATA_INCRV(session, rec_time_window_prepared, r->count_prepare);
- WT_STAT_CONN_INCR(session, rec_time_window_pages_prepared);
- WT_STAT_DATA_INCR(session, rec_time_window_pages_prepared);
+ WT_STAT_CONN_DATA_INCRV(session, rec_time_window_prepared, r->count_prepare);
+ WT_STAT_CONN_DATA_INCR(session, rec_time_window_pages_prepared);
r->rec_page_cell_with_prepared_txn = true;
}
/* Time aggregate statistics */
- if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_NEWEST_START_DURABLE_TS)) {
- WT_STAT_CONN_INCR(session, rec_time_aggr_newest_start_durable_ts);
- WT_STAT_DATA_INCR(session, rec_time_aggr_newest_start_durable_ts);
- }
- if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_NEWEST_STOP_DURABLE_TS)) {
- WT_STAT_CONN_INCR(session, rec_time_aggr_newest_stop_durable_ts);
- WT_STAT_DATA_INCR(session, rec_time_aggr_newest_stop_durable_ts);
- }
- if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_OLDEST_START_TS)) {
- WT_STAT_CONN_INCR(session, rec_time_aggr_oldest_start_ts);
- WT_STAT_DATA_INCR(session, rec_time_aggr_oldest_start_ts);
- }
- if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_NEWEST_TXN)) {
- WT_STAT_CONN_INCR(session, rec_time_aggr_newest_txn);
- WT_STAT_DATA_INCR(session, rec_time_aggr_newest_txn);
- }
- if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_NEWEST_STOP_TS)) {
- WT_STAT_CONN_INCR(session, rec_time_aggr_newest_stop_ts);
- WT_STAT_DATA_INCR(session, rec_time_aggr_newest_stop_ts);
- }
- if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_NEWEST_STOP_TXN)) {
- WT_STAT_CONN_INCR(session, rec_time_aggr_newest_stop_txn);
- WT_STAT_DATA_INCR(session, rec_time_aggr_newest_stop_txn);
- }
- if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_PREPARE)) {
- WT_STAT_CONN_INCR(session, rec_time_aggr_prepared);
- WT_STAT_DATA_INCR(session, rec_time_aggr_prepared);
- }
+ if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_NEWEST_START_DURABLE_TS))
+ WT_STAT_CONN_DATA_INCR(session, rec_time_aggr_newest_start_durable_ts);
+ if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_NEWEST_STOP_DURABLE_TS))
+ WT_STAT_CONN_DATA_INCR(session, rec_time_aggr_newest_stop_durable_ts);
+ if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_OLDEST_START_TS))
+ WT_STAT_CONN_DATA_INCR(session, rec_time_aggr_oldest_start_ts);
+ if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_NEWEST_TXN))
+ WT_STAT_CONN_DATA_INCR(session, rec_time_aggr_newest_txn);
+ if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_NEWEST_STOP_TS))
+ WT_STAT_CONN_DATA_INCR(session, rec_time_aggr_newest_stop_ts);
+ if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_NEWEST_STOP_TXN))
+ WT_STAT_CONN_DATA_INCR(session, rec_time_aggr_newest_stop_txn);
+ if (FLD_ISSET(r->ts_usage_flags, WT_REC_TIME_PREPARE))
+ WT_STAT_CONN_DATA_INCR(session, rec_time_aggr_prepared);
}
/*
diff --git a/src/third_party/wiredtiger/src/include/stat.h b/src/third_party/wiredtiger/src/include/stat.h
index 200d63759a1..386fcd3bbc8 100644
--- a/src/third_party/wiredtiger/src/include/stat.h
+++ b/src/third_party/wiredtiger/src/include/stat.h
@@ -238,6 +238,24 @@ __wt_stats_clear(void *stats_arg, int slot)
} while (0)
/*
+ * Update connection and data handle statistics if statistics gathering is enabled. Updates both
+ * statistics concurrently and is useful to avoid the duplicated calls that happen in a lot of
+ * places.
+ */
+#define WT_STAT_CONN_DATA_DECRV(session, fld, value) \
+ do { \
+ WT_STAT_CONN_DECRV(session, fld, value); \
+ WT_STAT_DATA_DECRV(session, fld, value); \
+ } while (0)
+#define WT_STAT_CONN_DATA_DECR(session, fld) WT_STAT_CONN_DATA_DECRV(session, fld, 1)
+
+#define WT_STAT_CONN_DATA_INCRV(session, fld, value) \
+ do { \
+ WT_STAT_CONN_INCRV(session, fld, value); \
+ WT_STAT_DATA_INCRV(session, fld, value); \
+ } while (0)
+#define WT_STAT_CONN_DATA_INCR(session, fld) WT_STAT_CONN_DATA_INCRV(session, fld, 1)
+/*
* Update per session statistics.
*/
#define WT_STAT_SESSION_INCRV(session, fld, value) \
diff --git a/src/third_party/wiredtiger/src/include/txn_inline.h b/src/third_party/wiredtiger/src/include/txn_inline.h
index c35183e0ef9..5a4b28914b8 100644
--- a/src/third_party/wiredtiger/src/include/txn_inline.h
+++ b/src/third_party/wiredtiger/src/include/txn_inline.h
@@ -114,7 +114,7 @@ __wt_txn_op_set_recno(WT_SESSION_IMPL *session, uint64_t recno)
WT_ASSERT(session, txn->mod_count > 0 && recno != WT_RECNO_OOB);
op = txn->mod + txn->mod_count - 1;
- if (WT_SESSION_IS_CHECKPOINT(session) || WT_IS_HS(op->btree) ||
+ if (WT_SESSION_IS_CHECKPOINT(session) || WT_IS_HS(op->btree->dhandle) ||
WT_IS_METADATA(op->btree->dhandle))
return;
@@ -146,7 +146,7 @@ __wt_txn_op_set_key(WT_SESSION_IMPL *session, const WT_ITEM *key)
op = txn->mod + txn->mod_count - 1;
- if (WT_SESSION_IS_CHECKPOINT(session) || WT_IS_HS(op->btree) ||
+ if (WT_SESSION_IS_CHECKPOINT(session) || WT_IS_HS(op->btree->dhandle) ||
WT_IS_METADATA(op->btree->dhandle))
return (0);
@@ -398,7 +398,7 @@ __wt_txn_modify(WT_SESSION_IMPL *session, WT_UPDATE *upd)
op->u.op_upd = upd;
/* History store bypasses transactions, transaction modify should never be called on it. */
- WT_ASSERT(session, !WT_IS_HS(S2BT(session)));
+ WT_ASSERT(session, !WT_IS_HS((S2BT(session))->dhandle));
upd->txnid = session->txn->id;
__wt_txn_op_set_timestamp(session, op);
@@ -742,7 +742,7 @@ __wt_txn_upd_visible_type(WT_SESSION_IMPL *session, WT_UPDATE *upd)
if (prepare_state == WT_PREPARE_LOCKED)
continue;
- if (WT_IS_HS(S2BT(session)) && upd->txnid != WT_TXN_ABORTED &&
+ if (WT_IS_HS(session->dhandle) && upd->txnid != WT_TXN_ABORTED &&
upd->type == WT_UPDATE_STANDARD)
/* Entries in the history store are always visible. */
return (WT_VISIBLE_TRUE);
@@ -981,7 +981,7 @@ retry:
}
/* Store the stop time pair of the history store record that is returning. */
- if (!have_stop_tw && WT_TIME_WINDOW_HAS_STOP(&tw) && WT_IS_HS(S2BT(session))) {
+ if (!have_stop_tw && WT_TIME_WINDOW_HAS_STOP(&tw) && WT_IS_HS(session->dhandle)) {
cbt->upd_value->tw.durable_stop_ts = tw.durable_stop_ts;
cbt->upd_value->tw.stop_ts = tw.stop_ts;
cbt->upd_value->tw.stop_txn = tw.stop_txn;
@@ -989,7 +989,7 @@ retry:
}
/* If the start time point is visible then we need to return the ondisk value. */
- if (WT_IS_HS(S2BT(session)) || __wt_txn_tw_start_visible(session, &tw)) {
+ if (WT_IS_HS(session->dhandle) || __wt_txn_tw_start_visible(session, &tw)) {
if (cbt->upd_value->skip_buf) {
cbt->upd_value->buf.data = NULL;
cbt->upd_value->buf.size = 0;
@@ -1003,7 +1003,7 @@ retry:
}
/* If there's no visible update in the update chain or ondisk, check the history store file. */
- if (F_ISSET(S2C(session), WT_CONN_HS_OPEN) && !F_ISSET(S2BT(session), WT_BTREE_HS)) {
+ if (F_ISSET(S2C(session), WT_CONN_HS_OPEN) && !F_ISSET(session->dhandle, WT_DHANDLE_HS)) {
__wt_timing_stress(session, WT_TIMING_STRESS_HS_SEARCH);
WT_RET(__wt_hs_find_upd(session, key, cbt->iface.value_format, recno, cbt->upd_value, false,
&cbt->upd_value->buf, &tw));
@@ -1025,8 +1025,7 @@ retry:
retry = false;
/* Clean out any stale value before performing the retry. */
__wt_upd_value_clear(cbt->upd_value);
- WT_STAT_CONN_INCR(session, txn_read_race_prepare_update);
- WT_STAT_DATA_INCR(session, txn_read_race_prepare_update);
+ WT_STAT_CONN_DATA_INCR(session, txn_read_race_prepare_update);
/*
* When a prepared update/insert is rollback or committed, retrying it again should fix
@@ -1305,8 +1304,7 @@ __wt_txn_update_check(
}
if (rollback) {
- WT_STAT_CONN_INCR(session, txn_update_conflict);
- WT_STAT_DATA_INCR(session, txn_update_conflict);
+ WT_STAT_CONN_DATA_INCR(session, txn_update_conflict);
ret = __wt_txn_rollback_required(session, "conflict between concurrent operations");
}
diff --git a/src/third_party/wiredtiger/src/reconcile/rec_row.c b/src/third_party/wiredtiger/src/reconcile/rec_row.c
index b53955b8c14..3ab39e65f0a 100644
--- a/src/third_party/wiredtiger/src/reconcile/rec_row.c
+++ b/src/third_party/wiredtiger/src/reconcile/rec_row.c
@@ -904,7 +904,7 @@ __wt_rec_row_leaf(
* metadata, as metadata doesn't have any history.
*/
if (tw.durable_stop_ts == WT_TS_NONE && F_ISSET(S2C(session), WT_CONN_HS_OPEN) &&
- !WT_IS_HS(btree) && !WT_IS_METADATA(btree->dhandle)) {
+ !WT_IS_HS(btree->dhandle) && !WT_IS_METADATA(btree->dhandle)) {
WT_ERR(__wt_row_leaf_key(session, page, rip, tmpkey, true));
/*
* Start from WT_TS_NONE to delete all the history store content of the key.
@@ -918,8 +918,7 @@ __wt_rec_row_leaf(
WT_ERR(__wt_hs_delete_key_from_ts(
session, btree->id, tmpkey, WT_TS_NONE, false));
WT_ERR(__wt_hs_cursor_close(session));
- WT_STAT_CONN_INCR(session, cache_hs_key_truncate_onpage_removal);
- WT_STAT_DATA_INCR(session, cache_hs_key_truncate_onpage_removal);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_key_truncate_onpage_removal);
}
}
diff --git a/src/third_party/wiredtiger/src/reconcile/rec_visibility.c b/src/third_party/wiredtiger/src/reconcile/rec_visibility.c
index 9d87dc2d428..cf68c7783b1 100644
--- a/src/third_party/wiredtiger/src/reconcile/rec_visibility.c
+++ b/src/third_party/wiredtiger/src/reconcile/rec_visibility.c
@@ -254,7 +254,7 @@ __wt_rec_upd_select(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins, v
max_ts = WT_TS_NONE;
max_txn = WT_TXN_NONE;
has_newer_updates = upd_saved = false;
- is_hs_page = F_ISSET(S2BT(session), WT_BTREE_HS);
+ is_hs_page = F_ISSET(session->dhandle, WT_DHANDLE_HS);
session_txnid = WT_SESSION_TXN_SHARED(session)->id;
/*
diff --git a/src/third_party/wiredtiger/src/reconcile/rec_write.c b/src/third_party/wiredtiger/src/reconcile/rec_write.c
index cc42a66be3b..f7fcc07ddf5 100644
--- a/src/third_party/wiredtiger/src/reconcile/rec_write.c
+++ b/src/third_party/wiredtiger/src/reconcile/rec_write.c
@@ -56,8 +56,8 @@ __wt_reconcile(WT_SESSION_IMPL *session, WT_REF *ref, WT_SALVAGE_COOKIE *salvage
F_ISSET(session->txn, WT_TXN_HAS_SNAPSHOT));
/* Can't do history store eviction for history store itself or for metadata. */
- WT_ASSERT(
- session, !LF_ISSET(WT_REC_HS) || (!WT_IS_HS(btree) && !WT_IS_METADATA(btree->dhandle)));
+ WT_ASSERT(session,
+ !LF_ISSET(WT_REC_HS) || (!WT_IS_HS(btree->dhandle) && !WT_IS_METADATA(btree->dhandle)));
/* Flag as unused for non diagnostic builds. */
WT_UNUSED(btree);
@@ -200,7 +200,7 @@ __reconcile(WT_SESSION_IMPL *session, WT_REF *ref, WT_SALVAGE_COOKIE *salvage, u
* Update the global history store score. Only use observations during eviction, not checkpoints
* and don't count eviction of the history store table itself.
*/
- if (F_ISSET(r, WT_REC_EVICT) && !WT_IS_HS(btree))
+ if (F_ISSET(r, WT_REC_EVICT) && !WT_IS_HS(btree->dhandle))
__wt_cache_update_hs_score(session, r->updates_seen, r->updates_unstable);
/*
@@ -229,19 +229,13 @@ __reconcile(WT_SESSION_IMPL *session, WT_REF *ref, WT_SALVAGE_COOKIE *salvage, u
/* Update statistics. */
WT_STAT_CONN_INCR(session, rec_pages);
WT_STAT_DATA_INCR(session, rec_pages);
- if (LF_ISSET(WT_REC_EVICT)) {
- WT_STAT_CONN_INCR(session, rec_pages_eviction);
- WT_STAT_DATA_INCR(session, rec_pages_eviction);
- }
- if (r->cache_write_hs) {
- WT_STAT_CONN_INCR(session, cache_write_hs);
- WT_STAT_DATA_INCR(session, cache_write_hs);
- }
- if (r->cache_write_restore) {
- WT_STAT_CONN_INCR(session, cache_write_restore);
- WT_STAT_DATA_INCR(session, cache_write_restore);
- }
- if (!WT_IS_HS(btree)) {
+ if (LF_ISSET(WT_REC_EVICT))
+ WT_STAT_CONN_DATA_INCR(session, rec_pages_eviction);
+ if (r->cache_write_hs)
+ WT_STAT_CONN_DATA_INCR(session, cache_write_hs);
+ if (r->cache_write_restore)
+ WT_STAT_CONN_DATA_INCR(session, cache_write_restore);
+ if (!WT_IS_HS(btree->dhandle)) {
if (r->rec_page_cell_with_txn_id)
WT_STAT_CONN_INCR(session, rec_pages_with_txn);
if (r->rec_page_cell_with_ts)
@@ -545,7 +539,7 @@ __rec_init(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags, WT_SALVAGE_COO
r->last_running = ckpt_txn;
}
/* When operating on the history store table, we should never try history store eviction. */
- WT_ASSERT(session, !F_ISSET(btree, WT_BTREE_HS) || !LF_ISSET(WT_REC_HS));
+ WT_ASSERT(session, !F_ISSET(btree->dhandle, WT_DHANDLE_HS) || !LF_ISSET(WT_REC_HS));
/*
* History store table eviction is configured when eviction gets aggressive, adjust the flags
@@ -2139,8 +2133,7 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
switch (r->multi_next) {
case 0: /* Page delete */
- WT_STAT_CONN_INCR(session, rec_page_delete);
- WT_STAT_DATA_INCR(session, rec_page_delete);
+ WT_STAT_CONN_DATA_INCR(session, rec_page_delete);
/*
* If this is the root page, we need to create a sync point. For a page to be empty, it has
@@ -2286,7 +2279,7 @@ __rec_hs_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r)
* Sanity check: Can't insert updates into history store from the history store itself or from
* the metadata file.
*/
- WT_ASSERT(session, !WT_IS_HS(btree) && !WT_IS_METADATA(btree->dhandle));
+ WT_ASSERT(session, !WT_IS_HS(btree->dhandle) && !WT_IS_METADATA(btree->dhandle));
/* Flag as unused for non diagnostic builds. */
WT_UNUSED(btree);
diff --git a/src/third_party/wiredtiger/src/support/modify.c b/src/third_party/wiredtiger/src/support/modify.c
index e5106699dda..0a67847f420 100644
--- a/src/third_party/wiredtiger/src/support/modify.c
+++ b/src/third_party/wiredtiger/src/support/modify.c
@@ -115,12 +115,9 @@ __wt_modify_pack(WT_CURSOR *cursor, WT_MODIFY *entries, int nentries, WT_ITEM **
/*
* Update statistics. This is the common path called by WT_CURSOR::modify implementations.
*/
- WT_STAT_CONN_INCR(session, cursor_modify);
- WT_STAT_DATA_INCR(session, cursor_modify);
- WT_STAT_CONN_INCRV(session, cursor_modify_bytes, cursor->value.size);
- WT_STAT_DATA_INCRV(session, cursor_modify_bytes, cursor->value.size);
- WT_STAT_CONN_INCRV(session, cursor_modify_bytes_touch, diffsz);
- WT_STAT_DATA_INCRV(session, cursor_modify_bytes_touch, diffsz);
+ WT_STAT_CONN_DATA_INCR(session, cursor_modify);
+ WT_STAT_CONN_DATA_INCRV(session, cursor_modify_bytes, cursor->value.size);
+ WT_STAT_CONN_DATA_INCRV(session, cursor_modify_bytes_touch, diffsz);
return (0);
}
diff --git a/src/third_party/wiredtiger/src/txn/txn.c b/src/third_party/wiredtiger/src/txn/txn.c
index 59e197c5c78..94396fc92f2 100644
--- a/src/third_party/wiredtiger/src/txn/txn.c
+++ b/src/third_party/wiredtiger/src/txn/txn.c
@@ -1239,7 +1239,10 @@ __txn_commit_timestamps_assert(WT_SESSION_IMPL *session)
WT_TXN *txn;
WT_TXN_OP *op;
WT_UPDATE *upd;
- wt_timestamp_t op_ts, prev_op_durable_ts, prev_op_ts;
+#ifdef HAVE_DIAGNOSTIC
+ wt_timestamp_t op_ts;
+#endif
+ wt_timestamp_t prev_op_durable_ts, prev_op_ts;
u_int i;
bool op_zero_ts, upd_zero_ts, used_ts;
@@ -1290,8 +1293,9 @@ __txn_commit_timestamps_assert(WT_SESSION_IMPL *session)
else
upd = op->u.op_upd;
+#ifdef HAVE_DIAGNOSTIC
op_ts = upd->start_ts;
-
+#endif
/*
* Skip over any aborted update structures, internally created update structures or ones
* from our own transaction.
@@ -1342,12 +1346,14 @@ __txn_commit_timestamps_assert(WT_SESSION_IMPL *session)
if (op_zero_ts)
continue;
+#ifdef HAVE_DIAGNOSTIC
/*
* Only if the update structure doesn't have a timestamp then use the one in the transaction
* structure.
*/
if (op_ts == WT_TS_NONE)
op_ts = txn->commit_timestamp;
+#endif
/*
* Check based on the durable timestamp, but first ensure that it's a stronger check than
* comparing commit timestamps would be.
@@ -1722,7 +1728,7 @@ __wt_txn_prepare(WT_SESSION_IMPL *session, const char *cfg[])
for (i = 0, op = txn->mod; i < txn->mod_count; i++, op++) {
/* Assert it's not an update to the history store file. */
- WT_ASSERT(session, S2C(session)->cache->hs_fileid == 0 || !WT_IS_HS(op->btree));
+ WT_ASSERT(session, S2C(session)->cache->hs_fileid == 0 || !WT_IS_HS(op->btree->dhandle));
/* Metadata updates should never be prepared. */
WT_ASSERT(session, !WT_IS_METADATA(op->btree->dhandle));
@@ -1852,7 +1858,7 @@ __wt_txn_rollback(WT_SESSION_IMPL *session, const char *cfg[])
/* Rollback and free updates. */
for (i = 0, op = txn->mod; i < txn->mod_count; i++, op++) {
/* Assert it's not an update to the history store file. */
- WT_ASSERT(session, S2C(session)->cache->hs_fileid == 0 || !WT_IS_HS(op->btree));
+ WT_ASSERT(session, S2C(session)->cache->hs_fileid == 0 || !WT_IS_HS(op->btree->dhandle));
/* Metadata updates should never be rolled back. */
WT_ASSERT(session, !WT_IS_METADATA(op->btree->dhandle));
diff --git a/src/third_party/wiredtiger/src/txn/txn_ckpt.c b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
index 92066dd6e42..d9a15ed067c 100644
--- a/src/third_party/wiredtiger/src/txn/txn_ckpt.c
+++ b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
@@ -263,7 +263,7 @@ __wt_checkpoint_get_handles(WT_SESSION_IMPL *session, const char *cfg[])
* Skip files that are never involved in a checkpoint. Skip the history store file as it is,
* checkpointed manually later.
*/
- if (F_ISSET(btree, WT_BTREE_NO_CHECKPOINT) || WT_IS_HS(btree))
+ if (F_ISSET(btree, WT_BTREE_NO_CHECKPOINT) || WT_IS_HS(btree->dhandle))
return (0);
/*
diff --git a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
index f2320daf0ec..e3c8cba1648 100644
--- a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
+++ b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
@@ -266,10 +266,8 @@ __rollback_row_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW
hs_stop_durable_ts <= newer_hs_durable_ts || hs_start_ts == hs_stop_durable_ts ||
first_record);
- if (hs_stop_durable_ts < newer_hs_durable_ts) {
- WT_STAT_CONN_INCR(session, txn_rts_hs_stop_older_than_newer_start);
- WT_STAT_DATA_INCR(session, txn_rts_hs_stop_older_than_newer_start);
- }
+ if (hs_stop_durable_ts < newer_hs_durable_ts)
+ WT_STAT_CONN_DATA_INCR(session, txn_rts_hs_stop_older_than_newer_start);
/*
* Stop processing when we find the newer version value of this key is stable according to
@@ -318,10 +316,8 @@ __rollback_row_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW
WT_ERR(__wt_upd_alloc_tombstone(session, &hs_upd, NULL));
WT_ERR(__wt_hs_modify(cbt, hs_upd));
- WT_STAT_CONN_INCR(session, txn_rts_hs_removed);
- WT_STAT_CONN_INCR(session, cache_hs_key_truncate_rts_unstable);
- WT_STAT_DATA_INCR(session, txn_rts_hs_removed);
- WT_STAT_DATA_INCR(session, cache_hs_key_truncate_rts_unstable);
+ WT_STAT_CONN_DATA_INCR(session, txn_rts_hs_removed);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_key_truncate_rts_unstable);
}
if (replace) {
@@ -371,13 +367,11 @@ __rollback_row_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW
tombstone->next = upd;
upd = tombstone;
- WT_STAT_CONN_INCR(session, txn_rts_hs_restore_tombstones);
- WT_STAT_DATA_INCR(session, txn_rts_hs_restore_tombstones);
+ WT_STAT_CONN_DATA_INCR(session, txn_rts_hs_restore_tombstones);
}
} else {
WT_ERR(__wt_upd_alloc_tombstone(session, &upd, NULL));
- WT_STAT_CONN_INCR(session, txn_rts_keys_removed);
- WT_STAT_DATA_INCR(session, txn_rts_keys_removed);
+ WT_STAT_CONN_DATA_INCR(session, txn_rts_keys_removed);
__wt_verbose(session, WT_VERB_RTS, "%p: key removed", (void *)key);
}
@@ -388,10 +382,8 @@ __rollback_row_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW
if (valid_update_found) {
WT_ERR(__wt_upd_alloc_tombstone(session, &hs_upd, NULL));
WT_ERR(__wt_hs_modify(cbt, hs_upd));
- WT_STAT_CONN_INCR(session, txn_rts_hs_removed);
- WT_STAT_CONN_INCR(session, cache_hs_key_truncate_rts);
- WT_STAT_DATA_INCR(session, txn_rts_hs_removed);
- WT_STAT_DATA_INCR(session, cache_hs_key_truncate_rts);
+ WT_STAT_CONN_DATA_INCR(session, txn_rts_hs_removed);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_key_truncate_rts);
}
if (0) {
@@ -429,7 +421,7 @@ __rollback_abort_row_ondisk_kv(
__wt_row_leaf_value_cell(session, page, rip, NULL, vpack);
prepared = vpack->tw.prepare;
- if (WT_IS_HS(S2BT(session))) {
+ if (WT_IS_HS(session->dhandle)) {
/*
* Abort the history store update with stop durable timestamp greater than the stable
* timestamp or the updates with max stop timestamp which implies that they are associated
@@ -445,8 +437,7 @@ __rollback_abort_row_ondisk_kv(
__wt_timestamp_to_string(vpack->tw.stop_ts, ts_string[3]),
__wt_timestamp_to_string(rollback_timestamp, ts_string[4]));
WT_RET(__wt_upd_alloc_tombstone(session, &upd, NULL));
- WT_STAT_CONN_INCR(session, txn_rts_sweep_hs_keys);
- WT_STAT_DATA_INCR(session, txn_rts_sweep_hs_keys);
+ WT_STAT_CONN_DATA_INCR(session, txn_rts_sweep_hs_keys);
} else
return (0);
} else if (vpack->tw.durable_start_ts > rollback_timestamp ||
@@ -465,8 +456,7 @@ __rollback_abort_row_ondisk_kv(
* the key.
*/
WT_RET(__wt_upd_alloc_tombstone(session, &upd, NULL));
- WT_STAT_CONN_INCR(session, txn_rts_keys_removed);
- WT_STAT_DATA_INCR(session, txn_rts_keys_removed);
+ WT_STAT_CONN_DATA_INCR(session, txn_rts_keys_removed);
}
} else if (WT_TIME_WINDOW_HAS_STOP(&vpack->tw) &&
(vpack->tw.durable_stop_ts > rollback_timestamp || prepared)) {
@@ -481,8 +471,7 @@ __rollback_abort_row_ondisk_kv(
upd->durable_ts = vpack->tw.durable_start_ts;
upd->start_ts = vpack->tw.start_ts;
F_SET(upd, WT_UPDATE_RESTORED_FROM_DS);
- WT_STAT_CONN_INCR(session, txn_rts_keys_restored);
- WT_STAT_DATA_INCR(session, txn_rts_keys_restored);
+ WT_STAT_CONN_DATA_INCR(session, txn_rts_keys_restored);
__wt_verbose(session, WT_VERB_RTS,
"key restored with commit timestamp: %s, durable timestamp: %s txnid: %" PRIu64
"and removed commit timestamp: %s, durable timestamp: %s, txnid: %" PRIu64
@@ -622,7 +611,7 @@ __rollback_abort_row_reconciled_page(
__wt_timestamp_to_string(rollback_timestamp, ts_string[2]));
/* Remove the history store newer updates. */
- if (!WT_IS_HS(S2BT(session)))
+ if (!WT_IS_HS(session->dhandle))
WT_RET(__rollback_abort_row_reconciled_page_internal(session, mod->u1.r.disk_image,
mod->u1.r.replace.addr, mod->u1.r.replace.size, rollback_timestamp));
@@ -646,7 +635,7 @@ __rollback_abort_row_reconciled_page(
__wt_timestamp_to_string(rollback_timestamp, ts_string[2]));
/* Remove the history store newer updates. */
- if (!WT_IS_HS(S2BT(session)))
+ if (!WT_IS_HS(session->dhandle))
WT_RET(__rollback_abort_row_reconciled_page_internal(session, multi->disk_image,
multi->addr.addr, multi->addr.size, rollback_timestamp));
@@ -723,7 +712,7 @@ __rollback_abort_newer_row_leaf(
static wt_timestamp_t
__rollback_get_ref_max_durable_timestamp(WT_SESSION_IMPL *session, WT_TIME_AGGREGATE *ta)
{
- if (WT_IS_HS(S2BT(session)))
+ if (WT_IS_HS(session->dhandle))
return WT_MAX(ta->newest_stop_durable_ts, ta->newest_stop_ts);
else
return WT_MAX(ta->newest_start_durable_ts, ta->newest_stop_durable_ts);
@@ -1063,10 +1052,8 @@ __rollback_to_stable_btree_hs_truncate(WT_SESSION_IMPL *session, uint32_t btree_
WT_ERR(__wt_upd_alloc_tombstone(session, &hs_upd, NULL));
WT_ERR(__wt_hs_modify(cbt, hs_upd));
- WT_STAT_CONN_INCR(session, txn_rts_hs_removed);
- WT_STAT_CONN_INCR(session, cache_hs_key_truncate_rts);
- WT_STAT_DATA_INCR(session, txn_rts_hs_removed);
- WT_STAT_DATA_INCR(session, cache_hs_key_truncate_rts);
+ WT_STAT_CONN_DATA_INCR(session, txn_rts_hs_removed);
+ WT_STAT_CONN_DATA_INCR(session, cache_hs_key_truncate_rts);
hs_upd = NULL;
}
WT_ERR_NOTFOUND_OK(ret, false);
diff --git a/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c b/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c
index 92bd2c3cd4c..b1c93dc3c9a 100644
--- a/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c
+++ b/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c
@@ -481,8 +481,7 @@ subtest_main(int argc, char *argv[], bool close_test)
struct rlimit rlim;
TEST_OPTS *opts, _opts;
WT_SESSION *session;
- char config[1024], filename[1024];
- const char *p;
+ char config[1024], filename[1024], buf[1024];
opts = &_opts;
memset(opts, 0, sizeof(*opts));
@@ -499,17 +498,13 @@ subtest_main(int argc, char *argv[], bool close_test)
testutil_check(__wt_snprintf(filename, sizeof(filename), "%s/%s", opts->home, STDOUT_FILE));
testutil_assert(freopen(filename, "a", stdout) != NULL);
-/*
- * Use $top_builddir if it's available, otherwise assume we're building in build_posix and running
- * in the test/csuite directory.
- */
#define WT_FAIL_FS_LIB "ext/test/fail_fs/.libs/libwiredtiger_fail_fs.so"
- if ((p = getenv("top_builddir")) == NULL)
- p = "../../build_posix";
+
+ testutil_build_dir(buf, 1024);
testutil_check(__wt_snprintf(config, sizeof(config),
"create,cache_size=250M,log=(enabled),transaction_sync=(enabled,method=none),extensions=(%s/"
"%s=(early_load,config={environment=true,verbose=true}))",
- p, WT_FAIL_FS_LIB));
+ buf, WT_FAIL_FS_LIB));
testutil_check(wiredtiger_open(opts->home, &event_handler, config, &opts->conn));
testutil_check(opts->conn->open_session(opts->conn, NULL, NULL, &session));
diff --git a/src/third_party/wiredtiger/test/csuite/wt3120_filesys/main.c b/src/third_party/wiredtiger/test/csuite/wt3120_filesys/main.c
index c79b92586a4..34385e3dba7 100644
--- a/src/third_party/wiredtiger/test/csuite/wt3120_filesys/main.c
+++ b/src/third_party/wiredtiger/test/csuite/wt3120_filesys/main.c
@@ -39,24 +39,18 @@ main(int argc, char *argv[])
TEST_OPTS *opts, _opts;
WT_CURSOR *cursor;
WT_SESSION *session;
- char *kstr, *vstr, buf[1024];
- const char *p;
+ char *kstr, *vstr, buf[1024], config[1024];
opts = &_opts;
memset(opts, 0, sizeof(*opts));
testutil_check(testutil_parse_opts(argc, argv, opts));
testutil_make_work_dir(opts->home);
-/*
- * Use $top_builddir if it's available, otherwise assume we're building in build_posix and running
- * in the test/csuite directory.
- */
#define WT_FAIL_FS_LIB "ext/test/fail_fs/.libs/libwiredtiger_fail_fs.so"
- if ((p = getenv("top_builddir")) == NULL)
- p = "../../build_posix";
+ testutil_build_dir(buf, 1024);
testutil_check(__wt_snprintf(
- buf, sizeof(buf), "create,extensions=(%s/%s=(early_load=true))", p, WT_FAIL_FS_LIB));
- testutil_check(wiredtiger_open(opts->home, NULL, buf, &opts->conn));
+ config, sizeof(config), "create,extensions=(%s/%s=(early_load=true))", buf, WT_FAIL_FS_LIB));
+ testutil_check(wiredtiger_open(opts->home, NULL, config, &opts->conn));
testutil_check(opts->conn->open_session(opts->conn, NULL, NULL, &session));
testutil_check(session->create(session, opts->uri, "key_format=S,value_format=S"));
diff --git a/src/third_party/wiredtiger/test/utility/misc.c b/src/third_party/wiredtiger/test/utility/misc.c
index 14dd886258b..1fb420df23f 100644
--- a/src/third_party/wiredtiger/test/utility/misc.c
+++ b/src/third_party/wiredtiger/test/utility/misc.c
@@ -131,6 +131,40 @@ testutil_clean_work_dir(const char *dir)
}
/*
+ * testutil_build_dir --
+ * Get the git top level directory and concatenate the build directory.
+ */
+void
+testutil_build_dir(char *buf, int size)
+{
+ FILE *fp;
+ char *p;
+
+ /* Get the git top level directory. */
+#ifdef _WIN32
+ fp = _popen("git rev-parse --show-toplevel", "r");
+#else
+ fp = popen("git rev-parse --show-toplevel", "r");
+#endif
+
+ if (fp == NULL)
+ testutil_die(errno, "popen");
+ p = fgets(buf, size, fp);
+ if (p == NULL)
+ testutil_die(errno, "fgets");
+
+#ifdef _WIN32
+ _pclose(fp);
+#else
+ pclose(fp);
+#endif
+
+ /* Remove the trailing newline character added by fgets. */
+ buf[strlen(buf) - 1] = '\0';
+ strcat(buf, "/build_posix");
+}
+
+/*
* testutil_make_work_dir --
* Delete the existing work directory, then create a new one.
*/
diff --git a/src/third_party/wiredtiger/test/utility/test_util.h b/src/third_party/wiredtiger/test/utility/test_util.h
index dc533edd7ae..d6fd1b0e1f5 100644
--- a/src/third_party/wiredtiger/test/utility/test_util.h
+++ b/src/third_party/wiredtiger/test/utility/test_util.h
@@ -265,6 +265,7 @@ void testutil_clean_work_dir(const char *);
void testutil_cleanup(TEST_OPTS *);
void testutil_copy_data(const char *);
bool testutil_is_flag_set(const char *);
+void testutil_build_dir(char *, int);
void testutil_make_work_dir(const char *);
int testutil_parse_opts(int, char *const *, TEST_OPTS *);
void testutil_print_command_line(int argc, char *const *argv);