summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2020-06-04 17:14:03 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-04 07:25:43 +0000
commitdef02ddab1c5b547126dbcfb719bf3159c9b7c98 (patch)
tree9424ea508f51d3cf71da08bd852fd1e54880bd36
parentb7554bc8dcb59c3a9fea97ab2e682008413ebd81 (diff)
downloadmongo-def02ddab1c5b547126dbcfb719bf3159c9b7c98.tar.gz
Import wiredtiger: d198ee319dcb857f27358f9a75c11aab4725bedb from branch mongodb-4.4
ref: 3901b43d1e..d198ee319d for: 4.4.0-rc9 WT-6015 (4.4-only) Backup test appears to be missing oplog entries WT-6330 Perform rollback to stable on the history store as a final step WT-6358 Make wt dump print history store in human readable format WT-6359 Coverity analysis defect 114181: Explicit null dereferenced WT-6369 Make page dumps on format failure optional and off by default WT-6371 Add timing stress that delays checkpoint of history store by 10 seconds
-rw-r--r--src/third_party/wiredtiger/dist/api_data.py15
-rw-r--r--src/third_party/wiredtiger/dist/s_string.ok2
-rw-r--r--src/third_party/wiredtiger/dist/stat_data.py1
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_import.c6
-rw-r--r--src/third_party/wiredtiger/src/config/config_def.c27
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_api.c58
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_log.c31
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_open.c2
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_reconfig.c9
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_dump.c18
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_std.c14
-rw-r--r--src/third_party/wiredtiger/src/docs/command-line.dox6
-rw-r--r--src/third_party/wiredtiger/src/include/connection.h40
-rw-r--r--src/third_party/wiredtiger/src/include/cursor.h6
-rw-r--r--src/third_party/wiredtiger/src/include/extern.h6
-rw-r--r--src/third_party/wiredtiger/src/include/stat.h1
-rw-r--r--src/third_party/wiredtiger/src/include/wiredtiger.in114
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_turtle.c8
-rw-r--r--src/third_party/wiredtiger/src/support/stat.c3
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_ckpt.c14
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c97
-rwxr-xr-xsrc/third_party/wiredtiger/src/utilities/util_dump.c33
-rw-r--r--src/third_party/wiredtiger/test/checkpoint/workers.c2
-rw-r--r--src/third_party/wiredtiger/test/format/config.c7
-rw-r--r--src/third_party/wiredtiger/test/format/config.h7
-rw-r--r--src/third_party/wiredtiger/test/format/format.h4
-rw-r--r--src/third_party/wiredtiger/test/format/snap.c24
-rw-r--r--src/third_party/wiredtiger/test/format/t.c47
-rw-r--r--src/third_party/wiredtiger/test/format/wts.c11
30 files changed, 401 insertions, 214 deletions
diff --git a/src/third_party/wiredtiger/dist/api_data.py b/src/third_party/wiredtiger/dist/api_data.py
index 84ea7bd9266..49b2f4f8f27 100644
--- a/src/third_party/wiredtiger/dist/api_data.py
+++ b/src/third_party/wiredtiger/dist/api_data.py
@@ -707,9 +707,9 @@ connection_runtime_config = [
intended for use with internal stress testing of WiredTiger.''',
type='list', undoc=True,
choices=[
- 'aggressive_sweep', 'checkpoint_slow', 'history_store_sweep_race',
- 'split_1', 'split_2', 'split_3', 'split_4', 'split_5', 'split_6',
- 'split_7', 'split_8']),
+ 'aggressive_sweep', 'checkpoint_slow', 'history_store_checkpoint_delay',
+ 'history_store_sweep_race', 'split_1', 'split_2', 'split_3', 'split_4', 'split_5',
+ 'split_6', 'split_7', 'split_8']),
Config('verbose', '', r'''
enable messages for various events. Options are given as a
list, such as <code>"verbose=[evictserver,read]"</code>''',
@@ -1260,10 +1260,11 @@ methods = {
configure the cursor for dump format inputs and outputs: "hex"
selects a simple hexadecimal format, "json" selects a JSON format
with each record formatted as fields named by column names if
- available, and "print" selects a format where only non-printing
- characters are hexadecimal encoded. These formats are compatible
- with the @ref util_dump and @ref util_load commands''',
- choices=['hex', 'json', 'print']),
+ available, "pretty" selects a human-readable format (making it
+ incompatible with the "load") and "print" selects a format where only
+ non-printing characters are hexadecimal encoded. These formats are
+ compatible with the @ref util_dump and @ref util_load commands''',
+ choices=['hex', 'json', 'pretty', 'print']),
Config('incremental', '', r'''
configure the cursor for block incremental backup usage. These formats
are only compatible with the backup data source; see @ref backup''',
diff --git a/src/third_party/wiredtiger/dist/s_string.ok b/src/third_party/wiredtiger/dist/s_string.ok
index 914dc78087a..294166060f6 100644
--- a/src/third_party/wiredtiger/dist/s_string.ok
+++ b/src/third_party/wiredtiger/dist/s_string.ok
@@ -911,7 +911,7 @@ iteratively
iters
jjj
jnr
-jrx
+jprx
json
kb
kbits
diff --git a/src/third_party/wiredtiger/dist/stat_data.py b/src/third_party/wiredtiger/dist/stat_data.py
index 5d092836b29..f4400cc8bdf 100644
--- a/src/third_party/wiredtiger/dist/stat_data.py
+++ b/src/third_party/wiredtiger/dist/stat_data.py
@@ -651,6 +651,7 @@ connection_stats = [
TxnStat('txn_rollback', 'transactions rolled back'),
TxnStat('txn_rts', 'rollback to stable calls'),
TxnStat('txn_rts_hs_removed', 'rollback to stable updates removed from history store'),
+ TxnStat('txn_rts_sweep_hs_keys', 'rollback to stable sweeping history store keys'),
TxnStat('txn_rts_keys_removed', 'rollback to stable keys removed'),
TxnStat('txn_rts_keys_restored', 'rollback to stable keys restored'),
TxnStat('txn_rts_pages_visited', 'rollback to stable pages visited'),
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 1f51fdec549..1fd7bb991a6 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": "3901b43d1e0f034c46999ccfdbdd0914791859e0"
+ "commit": "d198ee319dcb857f27358f9a75c11aab4725bedb"
}
diff --git a/src/third_party/wiredtiger/src/btree/bt_import.c b/src/third_party/wiredtiger/src/btree/bt_import.c
index 9bf09711ac4..91fa8c471cf 100644
--- a/src/third_party/wiredtiger/src/btree/bt_import.c
+++ b/src/third_party/wiredtiger/src/btree/bt_import.c
@@ -108,9 +108,9 @@ __wt_import(WT_SESSION_IMPL *session, const char *uri)
__wt_verbose(session, WT_VERB_CHECKPOINT, "import configuration: %s/%s", uri, fileconf);
/*
- * The just inserted metadata was correct as of immediately before the before the final
- * checkpoint, but it's not quite right. The block manager returned the corrected final
- * checkpoint, put it all together.
+ * The just inserted metadata was correct as of immediately before the final checkpoint, but
+ * it's not quite right. The block manager returned the corrected final checkpoint, put it all
+ * together.
*
* Get the checkpoint information from the file's metadata as an array of WT_CKPT structures.
*
diff --git a/src/third_party/wiredtiger/src/config/config_def.c b/src/third_party/wiredtiger/src/config/config_def.c
index d5d99925797..6ef93c7bc4b 100644
--- a/src/third_party/wiredtiger/src/config/config_def.c
+++ b/src/third_party/wiredtiger/src/config/config_def.c
@@ -135,8 +135,9 @@ static const WT_CONFIG_CHECK confchk_WT_CONNECTION_reconfigure[] = {
confchk_WT_CONNECTION_reconfigure_statistics_log_subconfigs, 5},
{"timing_stress_for_test", "list", NULL,
"choices=[\"aggressive_sweep\",\"checkpoint_slow\","
- "\"history_store_sweep_race\",\"split_1\",\"split_2\",\"split_3\""
- ",\"split_4\",\"split_5\",\"split_6\",\"split_7\",\"split_8\"]",
+ "\"history_store_checkpoint_delay\",\"history_store_sweep_race\","
+ "\"split_1\",\"split_2\",\"split_3\",\"split_4\",\"split_5\","
+ "\"split_6\",\"split_7\",\"split_8\"]",
NULL, 0},
{"verbose", "list", NULL,
"choices=[\"api\",\"backup\",\"block\",\"checkpoint\","
@@ -310,7 +311,7 @@ static const WT_CONFIG_CHECK confchk_WT_SESSION_open_cursor[] = {
{"append", "boolean", NULL, NULL, NULL, 0}, {"bulk", "string", NULL, NULL, NULL, 0},
{"checkpoint", "string", NULL, NULL, NULL, 0},
{"checkpoint_wait", "boolean", NULL, NULL, NULL, 0},
- {"dump", "string", NULL, "choices=[\"hex\",\"json\",\"print\"]", NULL, 0},
+ {"dump", "string", NULL, "choices=[\"hex\",\"json\",\"pretty\",\"print\"]", NULL, 0},
{"incremental", "category", NULL, NULL, confchk_WT_SESSION_open_cursor_incremental_subconfigs, 6},
{"next_random", "boolean", NULL, NULL, NULL, 0},
{"next_random_sample_size", "string", NULL, NULL, NULL, 0},
@@ -576,8 +577,9 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open[] = {
{"statistics_log", "category", NULL, NULL, confchk_wiredtiger_open_statistics_log_subconfigs, 6},
{"timing_stress_for_test", "list", NULL,
"choices=[\"aggressive_sweep\",\"checkpoint_slow\","
- "\"history_store_sweep_race\",\"split_1\",\"split_2\",\"split_3\""
- ",\"split_4\",\"split_5\",\"split_6\",\"split_7\",\"split_8\"]",
+ "\"history_store_checkpoint_delay\",\"history_store_sweep_race\","
+ "\"split_1\",\"split_2\",\"split_3\",\"split_4\",\"split_5\","
+ "\"split_6\",\"split_7\",\"split_8\"]",
NULL, 0},
{"transaction_sync", "category", NULL, NULL, confchk_wiredtiger_open_transaction_sync_subconfigs,
2},
@@ -649,8 +651,9 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_all[] = {
{"statistics_log", "category", NULL, NULL, confchk_wiredtiger_open_statistics_log_subconfigs, 6},
{"timing_stress_for_test", "list", NULL,
"choices=[\"aggressive_sweep\",\"checkpoint_slow\","
- "\"history_store_sweep_race\",\"split_1\",\"split_2\",\"split_3\""
- ",\"split_4\",\"split_5\",\"split_6\",\"split_7\",\"split_8\"]",
+ "\"history_store_checkpoint_delay\",\"history_store_sweep_race\","
+ "\"split_1\",\"split_2\",\"split_3\",\"split_4\",\"split_5\","
+ "\"split_6\",\"split_7\",\"split_8\"]",
NULL, 0},
{"transaction_sync", "category", NULL, NULL, confchk_wiredtiger_open_transaction_sync_subconfigs,
2},
@@ -719,8 +722,9 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_basecfg[] = {
{"statistics_log", "category", NULL, NULL, confchk_wiredtiger_open_statistics_log_subconfigs, 6},
{"timing_stress_for_test", "list", NULL,
"choices=[\"aggressive_sweep\",\"checkpoint_slow\","
- "\"history_store_sweep_race\",\"split_1\",\"split_2\",\"split_3\""
- ",\"split_4\",\"split_5\",\"split_6\",\"split_7\",\"split_8\"]",
+ "\"history_store_checkpoint_delay\",\"history_store_sweep_race\","
+ "\"split_1\",\"split_2\",\"split_3\",\"split_4\",\"split_5\","
+ "\"split_6\",\"split_7\",\"split_8\"]",
NULL, 0},
{"transaction_sync", "category", NULL, NULL, confchk_wiredtiger_open_transaction_sync_subconfigs,
2},
@@ -787,8 +791,9 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_usercfg[] = {
{"statistics_log", "category", NULL, NULL, confchk_wiredtiger_open_statistics_log_subconfigs, 6},
{"timing_stress_for_test", "list", NULL,
"choices=[\"aggressive_sweep\",\"checkpoint_slow\","
- "\"history_store_sweep_race\",\"split_1\",\"split_2\",\"split_3\""
- ",\"split_4\",\"split_5\",\"split_6\",\"split_7\",\"split_8\"]",
+ "\"history_store_checkpoint_delay\",\"history_store_sweep_race\","
+ "\"split_1\",\"split_2\",\"split_3\",\"split_4\",\"split_5\","
+ "\"split_6\",\"split_7\",\"split_8\"]",
NULL, 0},
{"transaction_sync", "category", NULL, NULL, confchk_wiredtiger_open_transaction_sync_subconfigs,
2},
diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c
index 6c1b1c4a759..4596f0095d6 100644
--- a/src/third_party/wiredtiger/src/conn/conn_api.c
+++ b/src/third_party/wiredtiger/src/conn/conn_api.c
@@ -1982,6 +1982,7 @@ __wt_timing_stress_config(WT_SESSION_IMPL *session, const char *cfg[])
static const WT_NAME_FLAG stress_types[] = {
{"aggressive_sweep", WT_TIMING_STRESS_AGGRESSIVE_SWEEP},
{"checkpoint_slow", WT_TIMING_STRESS_CHECKPOINT_SLOW},
+ {"history_store_checkpoint_delay", WT_TIMING_STRESS_HS_CHECKPOINT_DELAY},
{"history_store_sweep_race", WT_TIMING_STRESS_HS_SWEEP},
{"split_1", WT_TIMING_STRESS_SPLIT_1}, {"split_2", WT_TIMING_STRESS_SPLIT_2},
{"split_3", WT_TIMING_STRESS_SPLIT_3}, {"split_4", WT_TIMING_STRESS_SPLIT_4},
@@ -2266,6 +2267,37 @@ wiredtiger_dummy_session_init(WT_CONNECTION_IMPL *conn, WT_EVENT_HANDLER *event_
}
/*
+ * __conn_version_verify --
+ * Verify the versions before modifying the database.
+ */
+static int
+__conn_version_verify(WT_SESSION_IMPL *session)
+{
+ WT_CONNECTION_IMPL *conn;
+ bool exist;
+
+ conn = S2C(session);
+
+ /* Always set the compatibility versions. */
+ __wt_logmgr_compat_version(session);
+ /*
+ * If we're salvaging, don't verify now.
+ */
+ if (F_ISSET(conn, WT_CONN_SALVAGE))
+ return (0);
+
+ /* If we have a turtle file, validate versions. */
+ WT_RET(__wt_fs_exist(session, WT_METADATA_TURTLE, &exist));
+ if (exist)
+ WT_RET(__wt_turtle_validate_version(session));
+
+ if (FLD_ISSET(conn->log_flags, WT_CONN_LOG_CONFIG_ENABLED))
+ WT_RET(__wt_log_compat_verify(session));
+
+ return (0);
+}
+
+/*
* wiredtiger_open --
* Main library entry point: open a new connection to a WiredTiger database.
*/
@@ -2401,18 +2433,6 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, const char *c
/* Make sure no other thread of control already owns this database. */
WT_ERR(__conn_single(session, cfg));
- /*
- * Set compatibility versions early so that any subsystem sees it. Call after we own the
- * database so that we can know if the database is new or not. Compatibility testing needs to
- * know if salvage has been set, so parse that early.
- */
- WT_ERR(__wt_config_gets(session, cfg, "salvage", &cval));
- if (cval.val) {
- if (F_ISSET(conn, WT_CONN_READONLY))
- WT_ERR_MSG(session, EINVAL, "Readonly configuration incompatible with salvage");
- F_SET(conn, WT_CONN_SALVAGE);
- }
-
WT_ERR(__wt_conn_compat_config(session, cfg, false));
/*
@@ -2606,6 +2626,13 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, const char *c
WT_ERR(__wt_config_gets(session, cfg, "operation_timeout_ms", &cval));
conn->operation_timeout_us = (uint64_t)(cval.val * WT_THOUSAND);
+ WT_ERR(__wt_config_gets(session, cfg, "salvage", &cval));
+ if (cval.val) {
+ if (F_ISSET(conn, WT_CONN_READONLY))
+ WT_ERR_MSG(session, EINVAL, "Readonly configuration incompatible with salvage");
+ F_SET(conn, WT_CONN_SALVAGE);
+ }
+
WT_ERR(__wt_conn_statistics_config(session, cfg));
WT_ERR(__wt_lsm_manager_config(session, cfg));
WT_ERR(__wt_sweep_config(session, cfg));
@@ -2659,6 +2686,13 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, const char *c
__wt_encryptor_config(session, &cval, &keyid, (WT_CONFIG_ARG *)enc_cfg, &conn->kencryptor));
/*
+ * We need to parse the logging configuration here to verify the compatibility settings because
+ * we may need the log path and encryption and compression settings.
+ */
+ WT_ERR(__wt_logmgr_config(session, cfg, false));
+ WT_ERR(__conn_version_verify(session));
+
+ /*
* Configuration completed; optionally write a base configuration file.
*/
WT_ERR(__conn_write_base_config(session, cfg));
diff --git a/src/third_party/wiredtiger/src/conn/conn_log.c b/src/third_party/wiredtiger/src/conn/conn_log.c
index 09b5290b790..3419f329c16 100644
--- a/src/third_party/wiredtiger/src/conn/conn_log.c
+++ b/src/third_party/wiredtiger/src/conn/conn_log.c
@@ -190,11 +190,11 @@ __logmgr_version(WT_SESSION_IMPL *session, bool reconfig)
}
/*
- * __logmgr_config --
+ * __wt_logmgr_config --
* Parse and setup the logging server options.
*/
-static int
-__logmgr_config(WT_SESSION_IMPL *session, const char **cfg, bool *runp, bool reconfig)
+int
+__wt_logmgr_config(WT_SESSION_IMPL *session, const char **cfg, bool reconfig)
{
WT_CONFIG_ITEM cval;
WT_CONNECTION_IMPL *conn;
@@ -245,7 +245,10 @@ __logmgr_config(WT_SESSION_IMPL *session, const char **cfg, bool *runp, bool rec
"log=(enabled=true)");
}
- *runp = enabled;
+ if (enabled)
+ FLD_SET(conn->log_flags, WT_CONN_LOG_CONFIG_ENABLED);
+ else
+ FLD_CLR(conn->log_flags, WT_CONN_LOG_CONFIG_ENABLED);
/*
* Setup a log path and compression even if logging is disabled in case we are going to print a
@@ -258,12 +261,13 @@ __logmgr_config(WT_SESSION_IMPL *session, const char **cfg, bool *runp, bool rec
WT_RET(__wt_config_gets_none(session, cfg, "log.compressor", &cval));
WT_RET(__wt_compressor_config(session, &cval, &conn->log_compressor));
+ conn->log_path = NULL;
WT_RET(__wt_config_gets(session, cfg, "log.path", &cval));
WT_RET(__wt_strndup(session, cval.str, cval.len, &conn->log_path));
}
/* We are done if logging isn't enabled. */
- if (!*runp)
+ if (!FLD_ISSET(conn->log_flags, WT_CONN_LOG_CONFIG_ENABLED))
return (0);
WT_RET(__wt_config_gets(session, cfg, "log.archive", &cval));
@@ -336,9 +340,7 @@ __logmgr_config(WT_SESSION_IMPL *session, const char **cfg, bool *runp, bool rec
int
__wt_logmgr_reconfig(WT_SESSION_IMPL *session, const char **cfg)
{
- bool dummy;
-
- WT_RET(__logmgr_config(session, cfg, &dummy, true));
+ WT_RET(__wt_logmgr_config(session, cfg, true));
return (__logmgr_version(session, true));
}
@@ -967,19 +969,18 @@ err:
* Initialize the log subsystem (before running recovery).
*/
int
-__wt_logmgr_create(WT_SESSION_IMPL *session, const char *cfg[])
+__wt_logmgr_create(WT_SESSION_IMPL *session)
{
WT_CONNECTION_IMPL *conn;
WT_LOG *log;
- bool run;
conn = S2C(session);
- /* Handle configuration. */
- WT_RET(__logmgr_config(session, cfg, &run, false));
-
- /* If logging is not configured, we're done. */
- if (!run)
+ /*
+ * Logging configuration is parsed early on for compatibility checking. It is separated from
+ * turning on the subsystem. We only need to proceed here if logging is enabled.
+ */
+ if (!FLD_ISSET(conn->log_flags, WT_CONN_LOG_CONFIG_ENABLED))
return (0);
FLD_SET(conn->log_flags, WT_CONN_LOG_ENABLED);
diff --git a/src/third_party/wiredtiger/src/conn/conn_open.c b/src/third_party/wiredtiger/src/conn/conn_open.c
index 7ad449ed492..01577317a32 100644
--- a/src/third_party/wiredtiger/src/conn/conn_open.c
+++ b/src/third_party/wiredtiger/src/conn/conn_open.c
@@ -205,7 +205,7 @@ __wt_connection_workers(WT_SESSION_IMPL *session, const char *cfg[])
* can know if statistics are enabled or not.
*/
WT_RET(__wt_statlog_create(session, cfg));
- WT_RET(__wt_logmgr_create(session, cfg));
+ WT_RET(__wt_logmgr_create(session));
/*
* Run recovery. NOTE: This call will start (and stop) eviction if recovery is required.
diff --git a/src/third_party/wiredtiger/src/conn/conn_reconfig.c b/src/third_party/wiredtiger/src/conn/conn_reconfig.c
index 0ecec54931a..1f53ceecfd7 100644
--- a/src/third_party/wiredtiger/src/conn/conn_reconfig.c
+++ b/src/third_party/wiredtiger/src/conn/conn_reconfig.c
@@ -200,15 +200,6 @@ done:
conn->req_max_minor = max_minor;
conn->req_min_major = min_major;
conn->req_min_minor = min_minor;
- /*
- * Set up the log manager versions in the connection and verify any logs. We do this at the end
- * here, but very early in the startup process so that if we're starting from a backup and there
- * are compatibility errors, we inform the user but leave the directory unchanged.
- */
- __wt_logmgr_compat_version(session);
- if (!reconfig && !F_ISSET(conn, WT_CONN_SALVAGE))
- WT_ERR(__wt_log_compat_verify(session));
-
err:
__wt_free(session, value);
diff --git a/src/third_party/wiredtiger/src/cursor/cur_dump.c b/src/third_party/wiredtiger/src/cursor/cur_dump.c
index 2327bdcec28..21ed7e4fa75 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_dump.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_dump.c
@@ -90,8 +90,12 @@ __curdump_get_key(WT_CURSOR *cursor, ...)
} else {
WT_ERR(child->get_key(child, &item));
- WT_ERR(
- __raw_to_dump(session, &item, &cursor->key, F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
+ if (F_ISSET(cursor, WT_CURSTD_DUMP_PRETTY)) {
+ WT_IGNORE_RET_PTR(__wt_buf_set_printable_format(
+ session, item.data, item.size, cursor->key_format, &cursor->key));
+ } else
+ WT_ERR(
+ __raw_to_dump(session, &item, &cursor->key, F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
}
va_start(ap, cursor);
@@ -236,7 +240,12 @@ __curdump_get_value(WT_CURSOR *cursor, ...)
} else {
WT_ERR(child->get_value(child, &item));
- WT_ERR(__raw_to_dump(session, &item, &cursor->value, F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
+ if (F_ISSET(cursor, WT_CURSTD_DUMP_PRETTY))
+ WT_IGNORE_RET_PTR(__wt_buf_set_printable_format(
+ session, item.data, item.size, cursor->value_format, &cursor->value));
+ else
+ WT_ERR(
+ __raw_to_dump(session, &item, &cursor->value, F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
va_start(ap, cursor);
if (F_ISSET(cursor, WT_CURSTD_RAW)) {
@@ -411,7 +420,8 @@ __wt_curdump_create(WT_CURSOR *child, WT_CURSOR *owner, WT_CURSOR **cursorp)
cdump->child = child;
/* Copy the dump flags from the child cursor. */
- F_SET(cursor, F_MASK(child, WT_CURSTD_DUMP_HEX | WT_CURSTD_DUMP_JSON | WT_CURSTD_DUMP_PRINT));
+ F_SET(cursor, F_MASK(child, WT_CURSTD_DUMP_HEX | WT_CURSTD_DUMP_JSON | WT_CURSTD_DUMP_PRETTY |
+ WT_CURSTD_DUMP_PRINT));
if (F_ISSET(cursor, WT_CURSTD_DUMP_JSON)) {
WT_ERR(__wt_calloc_one(session, &json));
cursor->json_private = child->json_private = json;
diff --git a/src/third_party/wiredtiger/src/cursor/cur_std.c b/src/third_party/wiredtiger/src/cursor/cur_std.c
index 57a22a04aac..7985720c70a 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_std.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_std.c
@@ -1112,10 +1112,16 @@ __wt_cursor_init(
*/
WT_RET(__wt_config_gets_def(session, cfg, "dump", 0, &cval));
if (cval.len != 0 && owner == NULL) {
- F_SET(cursor, WT_STRING_MATCH("json", cval.str, cval.len) ?
- WT_CURSTD_DUMP_JSON :
- (WT_STRING_MATCH("print", cval.str, cval.len) ? WT_CURSTD_DUMP_PRINT :
- WT_CURSTD_DUMP_HEX));
+ uint32_t dump_flag;
+ if (WT_STRING_MATCH("json", cval.str, cval.len))
+ dump_flag = WT_CURSTD_DUMP_JSON;
+ else if (WT_STRING_MATCH("print", cval.str, cval.len))
+ dump_flag = WT_CURSTD_DUMP_PRINT;
+ else if (WT_STRING_MATCH("pretty", cval.str, cval.len))
+ dump_flag = WT_CURSTD_DUMP_PRETTY;
+ else
+ dump_flag = WT_CURSTD_DUMP_HEX;
+ F_SET(cursor, dump_flag);
/*
* Dump cursors should not have owners: only the top-level cursor should be wrapped in a
* dump cursor.
diff --git a/src/third_party/wiredtiger/src/docs/command-line.dox b/src/third_party/wiredtiger/src/docs/command-line.dox
index 2165b5215a3..40ad6ffb043 100644
--- a/src/third_party/wiredtiger/src/docs/command-line.dox
+++ b/src/third_party/wiredtiger/src/docs/command-line.dox
@@ -167,7 +167,7 @@ which can be re-loaded into a new table using the \c load command.
See @subpage dump_formats for details of the dump file formats.
@subsection util_dump_synopsis Synopsis
-<code>wt [-RrVv] [-C config] [-E secretkey ] [-h directory] dump [-jrx] [-c checkpoint] [-f output] [-t timestamp] uri</code>
+<code>wt [-RrVv] [-C config] [-E secretkey ] [-h directory] dump [-jprx] [-c checkpoint] [-f output] [-t timestamp] uri</code>
@subsection util_dump_options Options
The following are command-specific options for the \c dump command:
@@ -185,6 +185,10 @@ the \c -f option re-directs the output to the specified file.
Dump in JSON (<a href="http://www.json.org">JavaScript Object Notation</a>)
format.
+@par <code>-p</code>
+Dump in human-readable format (pretty-print). The \c -p flag is incompatible
+with the \c load command.
+
@par <code>-r</code>
Dump in reverse order, from largest key to smallest.
diff --git a/src/third_party/wiredtiger/src/include/connection.h b/src/third_party/wiredtiger/src/include/connection.h
index 0295929c496..20c11fa42dc 100644
--- a/src/third_party/wiredtiger/src/include/connection.h
+++ b/src/third_party/wiredtiger/src/include/connection.h
@@ -354,16 +354,17 @@ struct __wt_connection_impl {
/* AUTOMATIC FLAG VALUE GENERATION START */
#define WT_CONN_LOG_ARCHIVE 0x001u /* Archive is enabled */
-#define WT_CONN_LOG_DEBUG_MODE 0x002u /* Debug-mode logging enabled */
-#define WT_CONN_LOG_DOWNGRADED 0x004u /* Running older version */
-#define WT_CONN_LOG_ENABLED 0x008u /* Logging is enabled */
-#define WT_CONN_LOG_EXISTED 0x010u /* Log files found */
-#define WT_CONN_LOG_FORCE_DOWNGRADE 0x020u /* Force downgrade */
-#define WT_CONN_LOG_RECOVER_DIRTY 0x040u /* Recovering unclean */
-#define WT_CONN_LOG_RECOVER_DONE 0x080u /* Recovery completed */
-#define WT_CONN_LOG_RECOVER_ERR 0x100u /* Error if recovery required */
-#define WT_CONN_LOG_RECOVER_FAILED 0x200u /* Recovery failed */
-#define WT_CONN_LOG_ZERO_FILL 0x400u /* Manually zero files */
+#define WT_CONN_LOG_CONFIG_ENABLED 0x002u /* Logging is configured */
+#define WT_CONN_LOG_DEBUG_MODE 0x004u /* Debug-mode logging enabled */
+#define WT_CONN_LOG_DOWNGRADED 0x008u /* Running older version */
+#define WT_CONN_LOG_ENABLED 0x010u /* Logging is enabled */
+#define WT_CONN_LOG_EXISTED 0x020u /* Log files found */
+#define WT_CONN_LOG_FORCE_DOWNGRADE 0x040u /* Force downgrade */
+#define WT_CONN_LOG_RECOVER_DIRTY 0x080u /* Recovering unclean */
+#define WT_CONN_LOG_RECOVER_DONE 0x100u /* Recovery completed */
+#define WT_CONN_LOG_RECOVER_ERR 0x200u /* Error if recovery required */
+#define WT_CONN_LOG_RECOVER_FAILED 0x400u /* Recovery failed */
+#define WT_CONN_LOG_ZERO_FILL 0x800u /* Manually zero files */
/* AUTOMATIC FLAG VALUE GENERATION STOP */
uint32_t log_flags; /* Global logging configuration */
WT_CONDVAR *log_cond; /* Log server wait mutex */
@@ -495,15 +496,16 @@ struct __wt_connection_impl {
/* AUTOMATIC FLAG VALUE GENERATION START */
#define WT_TIMING_STRESS_AGGRESSIVE_SWEEP 0x001u
#define WT_TIMING_STRESS_CHECKPOINT_SLOW 0x002u
-#define WT_TIMING_STRESS_HS_SWEEP 0x004u
-#define WT_TIMING_STRESS_SPLIT_1 0x008u
-#define WT_TIMING_STRESS_SPLIT_2 0x010u
-#define WT_TIMING_STRESS_SPLIT_3 0x020u
-#define WT_TIMING_STRESS_SPLIT_4 0x040u
-#define WT_TIMING_STRESS_SPLIT_5 0x080u
-#define WT_TIMING_STRESS_SPLIT_6 0x100u
-#define WT_TIMING_STRESS_SPLIT_7 0x200u
-#define WT_TIMING_STRESS_SPLIT_8 0x400u
+#define WT_TIMING_STRESS_HS_CHECKPOINT_DELAY 0x004u
+#define WT_TIMING_STRESS_HS_SWEEP 0x008u
+#define WT_TIMING_STRESS_SPLIT_1 0x010u
+#define WT_TIMING_STRESS_SPLIT_2 0x020u
+#define WT_TIMING_STRESS_SPLIT_3 0x040u
+#define WT_TIMING_STRESS_SPLIT_4 0x080u
+#define WT_TIMING_STRESS_SPLIT_5 0x100u
+#define WT_TIMING_STRESS_SPLIT_6 0x200u
+#define WT_TIMING_STRESS_SPLIT_7 0x400u
+#define WT_TIMING_STRESS_SPLIT_8 0x800u
/* AUTOMATIC FLAG VALUE GENERATION STOP */
uint64_t timing_stress_flags;
diff --git a/src/third_party/wiredtiger/src/include/cursor.h b/src/third_party/wiredtiger/src/include/cursor.h
index 24931905227..e35791e5cb9 100644
--- a/src/third_party/wiredtiger/src/include/cursor.h
+++ b/src/third_party/wiredtiger/src/include/cursor.h
@@ -503,6 +503,8 @@ struct __wt_cursor_table {
#define WT_CURSOR_RECNO(cursor) WT_STREQ((cursor)->key_format, "r")
#define WT_CURSOR_IS_DUMP(cursor) \
- F_ISSET(cursor, (WT_CURSTD_DUMP_HEX | WT_CURSTD_DUMP_PRINT | WT_CURSTD_DUMP_JSON))
+ F_ISSET(cursor, \
+ (WT_CURSTD_DUMP_HEX | WT_CURSTD_DUMP_JSON | WT_CURSTD_DUMP_PRETTY | WT_CURSTD_DUMP_PRINT))
-#define WT_CURSOR_RAW_OK (WT_CURSTD_DUMP_HEX | WT_CURSTD_DUMP_PRINT | WT_CURSTD_RAW)
+#define WT_CURSOR_RAW_OK \
+ (WT_CURSTD_DUMP_HEX | WT_CURSTD_DUMP_PRETTY | WT_CURSTD_DUMP_PRINT | WT_CURSTD_RAW)
diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h
index c2be01409f4..4bc55287eef 100644
--- a/src/third_party/wiredtiger/src/include/extern.h
+++ b/src/third_party/wiredtiger/src/include/extern.h
@@ -854,7 +854,9 @@ extern int __wt_log_vprintf(WT_SESSION_IMPL *session, const char *fmt, va_list a
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_log_write(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, uint32_t flags)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
-extern int __wt_logmgr_create(WT_SESSION_IMPL *session, const char *cfg[])
+extern int __wt_logmgr_config(WT_SESSION_IMPL *session, const char **cfg, bool reconfig)
+ WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
+extern int __wt_logmgr_create(WT_SESSION_IMPL *session)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_logmgr_destroy(WT_SESSION_IMPL *session)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
@@ -1446,6 +1448,8 @@ extern int __wt_turtle_read(WT_SESSION_IMPL *session, const char *key, char **va
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_turtle_update(WT_SESSION_IMPL *session, const char *key, const char *value)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
+extern int __wt_turtle_validate_version(WT_SESSION_IMPL *session)
+ WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_txn_activity_drain(WT_SESSION_IMPL *session)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[], bool waiting)
diff --git a/src/third_party/wiredtiger/src/include/stat.h b/src/third_party/wiredtiger/src/include/stat.h
index 11e59f299ee..3df5aa605d8 100644
--- a/src/third_party/wiredtiger/src/include/stat.h
+++ b/src/third_party/wiredtiger/src/include/stat.h
@@ -714,6 +714,7 @@ struct __wt_connection_stats {
int64_t txn_rts_keys_removed;
int64_t txn_rts_keys_restored;
int64_t txn_rts_pages_visited;
+ int64_t txn_rts_sweep_hs_keys;
int64_t txn_rts_upd_aborted;
int64_t txn_rts_hs_removed;
int64_t txn_set_ts;
diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in
index 72d79d9622f..4784d990ee7 100644
--- a/src/third_party/wiredtiger/src/include/wiredtiger.in
+++ b/src/third_party/wiredtiger/src/include/wiredtiger.in
@@ -711,19 +711,20 @@ struct __wt_cursor {
#define WT_CURSTD_DEBUG_COPY_VALUE 0x000040u
#define WT_CURSTD_DUMP_HEX 0x000080u
#define WT_CURSTD_DUMP_JSON 0x000100u
-#define WT_CURSTD_DUMP_PRINT 0x000200u
-#define WT_CURSTD_IGNORE_TOMBSTONE 0x000400u
-#define WT_CURSTD_JOINED 0x000800u
-#define WT_CURSTD_KEY_EXT 0x001000u /* Key points out of tree. */
-#define WT_CURSTD_KEY_INT 0x002000u /* Key points into tree. */
-#define WT_CURSTD_META_INUSE 0x004000u
-#define WT_CURSTD_OPEN 0x008000u
-#define WT_CURSTD_OVERWRITE 0x010000u
-#define WT_CURSTD_RAW 0x020000u
-#define WT_CURSTD_RAW_SEARCH 0x040000u
-#define WT_CURSTD_UPDATE_LOCAL 0x080000u
-#define WT_CURSTD_VALUE_EXT 0x100000u /* Value points out of tree. */
-#define WT_CURSTD_VALUE_INT 0x200000u /* Value points into tree. */
+#define WT_CURSTD_DUMP_PRETTY 0x000200u
+#define WT_CURSTD_DUMP_PRINT 0x000400u
+#define WT_CURSTD_IGNORE_TOMBSTONE 0x000800u
+#define WT_CURSTD_JOINED 0x001000u
+#define WT_CURSTD_KEY_EXT 0x002000u /* Key points out of tree. */
+#define WT_CURSTD_KEY_INT 0x004000u /* Key points into tree. */
+#define WT_CURSTD_META_INUSE 0x008000u
+#define WT_CURSTD_OPEN 0x010000u
+#define WT_CURSTD_OVERWRITE 0x020000u
+#define WT_CURSTD_RAW 0x040000u
+#define WT_CURSTD_RAW_SEARCH 0x080000u
+#define WT_CURSTD_UPDATE_LOCAL 0x100000u
+#define WT_CURSTD_VALUE_EXT 0x200000u /* Value points out of tree. */
+#define WT_CURSTD_VALUE_INT 0x400000u /* Value points into tree. */
/* AUTOMATIC FLAG VALUE GENERATION STOP */
#define WT_CURSTD_KEY_SET (WT_CURSTD_KEY_EXT | WT_CURSTD_KEY_INT)
#define WT_CURSTD_VALUE_SET (WT_CURSTD_VALUE_EXT | WT_CURSTD_VALUE_INT)
@@ -1063,10 +1064,11 @@ struct __wt_session {
* The cursor does not support data modification., a string; default empty.}
* @config{dump, configure the cursor for dump format inputs and outputs: "hex" selects a
* simple hexadecimal format\, "json" selects a JSON format with each record formatted as
- * fields named by column names if available\, and "print" selects a format where only
+ * fields named by column names if available\, "pretty" selects a human-readable format
+ * (making it incompatible with the "load") and "print" selects a format where only
* non-printing characters are hexadecimal encoded. These formats are compatible with the
* @ref util_dump and @ref util_load commands., a string\, chosen from the following
- * options: \c "hex"\, \c "json"\, \c "print"; default empty.}
+ * options: \c "hex"\, \c "json"\, \c "pretty"\, \c "print"; default empty.}
* @config{incremental = (, configure the cursor for block incremental backup usage. These
* formats are only compatible with the backup data source; see @ref backup., a set of
* related configuration options defined below.}
@@ -5883,104 +5885,106 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection);
#define WT_STAT_CONN_TXN_RTS_KEYS_RESTORED 1417
/*! transaction: rollback to stable pages visited */
#define WT_STAT_CONN_TXN_RTS_PAGES_VISITED 1418
+/*! transaction: rollback to stable sweeping history store keys */
+#define WT_STAT_CONN_TXN_RTS_SWEEP_HS_KEYS 1419
/*! transaction: rollback to stable updates aborted */
-#define WT_STAT_CONN_TXN_RTS_UPD_ABORTED 1419
+#define WT_STAT_CONN_TXN_RTS_UPD_ABORTED 1420
/*! transaction: rollback to stable updates removed from history store */
-#define WT_STAT_CONN_TXN_RTS_HS_REMOVED 1420
+#define WT_STAT_CONN_TXN_RTS_HS_REMOVED 1421
/*! transaction: set timestamp calls */
-#define WT_STAT_CONN_TXN_SET_TS 1421
+#define WT_STAT_CONN_TXN_SET_TS 1422
/*! transaction: set timestamp durable calls */
-#define WT_STAT_CONN_TXN_SET_TS_DURABLE 1422
+#define WT_STAT_CONN_TXN_SET_TS_DURABLE 1423
/*! transaction: set timestamp durable updates */
-#define WT_STAT_CONN_TXN_SET_TS_DURABLE_UPD 1423
+#define WT_STAT_CONN_TXN_SET_TS_DURABLE_UPD 1424
/*! transaction: set timestamp oldest calls */
-#define WT_STAT_CONN_TXN_SET_TS_OLDEST 1424
+#define WT_STAT_CONN_TXN_SET_TS_OLDEST 1425
/*! transaction: set timestamp oldest updates */
-#define WT_STAT_CONN_TXN_SET_TS_OLDEST_UPD 1425
+#define WT_STAT_CONN_TXN_SET_TS_OLDEST_UPD 1426
/*! transaction: set timestamp stable calls */
-#define WT_STAT_CONN_TXN_SET_TS_STABLE 1426
+#define WT_STAT_CONN_TXN_SET_TS_STABLE 1427
/*! transaction: set timestamp stable updates */
-#define WT_STAT_CONN_TXN_SET_TS_STABLE_UPD 1427
+#define WT_STAT_CONN_TXN_SET_TS_STABLE_UPD 1428
/*! transaction: transaction begins */
-#define WT_STAT_CONN_TXN_BEGIN 1428
+#define WT_STAT_CONN_TXN_BEGIN 1429
/*! transaction: transaction checkpoint currently running */
-#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1429
+#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1430
/*! transaction: transaction checkpoint generation */
-#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1430
+#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1431
/*!
* transaction: transaction checkpoint history store file duration
* (usecs)
*/
-#define WT_STAT_CONN_TXN_HS_CKPT_DURATION 1431
+#define WT_STAT_CONN_TXN_HS_CKPT_DURATION 1432
/*! transaction: transaction checkpoint max time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1432
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1433
/*! transaction: transaction checkpoint min time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1433
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1434
/*! transaction: transaction checkpoint most recent time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1434
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1435
/*! transaction: transaction checkpoint prepare currently running */
-#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_RUNNING 1435
+#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_RUNNING 1436
/*! transaction: transaction checkpoint prepare max time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_MAX 1436
+#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_MAX 1437
/*! transaction: transaction checkpoint prepare min time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_MIN 1437
+#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_MIN 1438
/*! transaction: transaction checkpoint prepare most recent time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_RECENT 1438
+#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_RECENT 1439
/*! transaction: transaction checkpoint prepare total time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_TOTAL 1439
+#define WT_STAT_CONN_TXN_CHECKPOINT_PREP_TOTAL 1440
/*! transaction: transaction checkpoint scrub dirty target */
-#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TARGET 1440
+#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TARGET 1441
/*! transaction: transaction checkpoint scrub time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TIME 1441
+#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TIME 1442
/*! transaction: transaction checkpoint total time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1442
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1443
/*! transaction: transaction checkpoints */
-#define WT_STAT_CONN_TXN_CHECKPOINT 1443
+#define WT_STAT_CONN_TXN_CHECKPOINT 1444
/*!
* transaction: transaction checkpoints skipped because database was
* clean
*/
-#define WT_STAT_CONN_TXN_CHECKPOINT_SKIPPED 1444
+#define WT_STAT_CONN_TXN_CHECKPOINT_SKIPPED 1445
/*! transaction: transaction failures due to history store */
-#define WT_STAT_CONN_TXN_FAIL_CACHE 1445
+#define WT_STAT_CONN_TXN_FAIL_CACHE 1446
/*!
* transaction: transaction fsync calls for checkpoint after allocating
* the transaction ID
*/
-#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST 1446
+#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST 1447
/*!
* transaction: transaction fsync duration for checkpoint after
* allocating the transaction ID (usecs)
*/
-#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST_DURATION 1447
+#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST_DURATION 1448
/*! transaction: transaction range of IDs currently pinned */
-#define WT_STAT_CONN_TXN_PINNED_RANGE 1448
+#define WT_STAT_CONN_TXN_PINNED_RANGE 1449
/*! transaction: transaction range of IDs currently pinned by a checkpoint */
-#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1449
+#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1450
/*! transaction: transaction range of timestamps currently pinned */
-#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP 1450
+#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP 1451
/*! transaction: transaction range of timestamps pinned by a checkpoint */
-#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_CHECKPOINT 1451
+#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_CHECKPOINT 1452
/*!
* transaction: transaction range of timestamps pinned by the oldest
* active read timestamp
*/
-#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_READER 1452
+#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_READER 1453
/*!
* transaction: transaction range of timestamps pinned by the oldest
* timestamp
*/
-#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_OLDEST 1453
+#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_OLDEST 1454
/*! transaction: transaction read timestamp of the oldest active reader */
-#define WT_STAT_CONN_TXN_TIMESTAMP_OLDEST_ACTIVE_READ 1454
+#define WT_STAT_CONN_TXN_TIMESTAMP_OLDEST_ACTIVE_READ 1455
/*! transaction: transaction sync calls */
-#define WT_STAT_CONN_TXN_SYNC 1455
+#define WT_STAT_CONN_TXN_SYNC 1456
/*! transaction: transactions committed */
-#define WT_STAT_CONN_TXN_COMMIT 1456
+#define WT_STAT_CONN_TXN_COMMIT 1457
/*! transaction: transactions rolled back */
-#define WT_STAT_CONN_TXN_ROLLBACK 1457
+#define WT_STAT_CONN_TXN_ROLLBACK 1458
/*! transaction: update conflicts */
-#define WT_STAT_CONN_TXN_UPDATE_CONFLICT 1458
+#define WT_STAT_CONN_TXN_UPDATE_CONFLICT 1459
/*!
* @}
diff --git a/src/third_party/wiredtiger/src/meta/meta_turtle.c b/src/third_party/wiredtiger/src/meta/meta_turtle.c
index 10605a71020..00427acae80 100644
--- a/src/third_party/wiredtiger/src/meta/meta_turtle.c
+++ b/src/third_party/wiredtiger/src/meta/meta_turtle.c
@@ -145,12 +145,12 @@ err:
}
/*
- * __turtle_validate_version --
+ * __wt_turtle_validate_version --
* Retrieve version numbers from the turtle file and validate them against our WiredTiger
* version.
*/
-static int
-__turtle_validate_version(WT_SESSION_IMPL *session)
+int
+__wt_turtle_validate_version(WT_SESSION_IMPL *session)
{
WT_DECL_RET;
uint32_t major, minor;
@@ -293,7 +293,7 @@ __wt_turtle_init(WT_SESSION_IMPL *session)
WT_RET(__wt_remove_if_exists(session, WT_METADATA_TURTLE, false));
load = true;
} else if (validate_turtle)
- WT_RET(__turtle_validate_version(session));
+ WT_RET(__wt_turtle_validate_version(session));
} else
load = true;
if (load) {
diff --git a/src/third_party/wiredtiger/src/support/stat.c b/src/third_party/wiredtiger/src/support/stat.c
index 250cb9234fe..5e481d850f6 100644
--- a/src/third_party/wiredtiger/src/support/stat.c
+++ b/src/third_party/wiredtiger/src/support/stat.c
@@ -1053,6 +1053,7 @@ static const char *const __stats_connection_desc[] = {
"transaction: read timestamp queue inserts total", "transaction: read timestamp queue length",
"transaction: rollback to stable calls", "transaction: rollback to stable keys removed",
"transaction: rollback to stable keys restored", "transaction: rollback to stable pages visited",
+ "transaction: rollback to stable sweeping history store keys",
"transaction: rollback to stable updates aborted",
"transaction: rollback to stable updates removed from history store",
"transaction: set timestamp calls", "transaction: set timestamp durable calls",
@@ -1546,6 +1547,7 @@ __wt_stat_connection_clear_single(WT_CONNECTION_STATS *stats)
stats->txn_rts_keys_removed = 0;
stats->txn_rts_keys_restored = 0;
stats->txn_rts_pages_visited = 0;
+ stats->txn_rts_sweep_hs_keys = 0;
stats->txn_rts_upd_aborted = 0;
stats->txn_rts_hs_removed = 0;
stats->txn_set_ts = 0;
@@ -2048,6 +2050,7 @@ __wt_stat_connection_aggregate(WT_CONNECTION_STATS **from, WT_CONNECTION_STATS *
to->txn_rts_keys_removed += WT_STAT_READ(from, txn_rts_keys_removed);
to->txn_rts_keys_restored += WT_STAT_READ(from, txn_rts_keys_restored);
to->txn_rts_pages_visited += WT_STAT_READ(from, txn_rts_pages_visited);
+ to->txn_rts_sweep_hs_keys += WT_STAT_READ(from, txn_rts_sweep_hs_keys);
to->txn_rts_upd_aborted += WT_STAT_READ(from, txn_rts_upd_aborted);
to->txn_rts_hs_removed += WT_STAT_READ(from, txn_rts_hs_removed);
to->txn_set_ts += WT_STAT_READ(from, txn_set_ts);
diff --git a/src/third_party/wiredtiger/src/txn/txn_ckpt.c b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
index eb3ab25b823..78c04c792cd 100644
--- a/src/third_party/wiredtiger/src/txn/txn_ckpt.c
+++ b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
@@ -8,7 +8,7 @@
#include "wt_internal.h"
-static void __checkpoint_timing_stress(WT_SESSION_IMPL *);
+static void __checkpoint_timing_stress(WT_SESSION_IMPL *, bool);
static int __checkpoint_lock_dirty_tree(WT_SESSION_IMPL *, bool, bool, bool, const char *[]);
static int __checkpoint_mark_skip(WT_SESSION_IMPL *, WT_CKPT *, bool);
static int __checkpoint_presync(WT_SESSION_IMPL *, const char *[]);
@@ -859,9 +859,12 @@ __txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
if (full && logging)
WT_ERR(__wt_txn_checkpoint_log(session, full, WT_TXN_LOG_CKPT_START, NULL));
- __checkpoint_timing_stress(session);
+ __checkpoint_timing_stress(session, false);
WT_ERR(__checkpoint_apply_to_dhandles(session, cfg, __checkpoint_tree_helper));
+ /* Wait prior to checkpointing the history store to simulate checkpoint slowness. */
+ __checkpoint_timing_stress(session, true);
+
/*
* Get a history store dhandle. If the history store file is opened for a special operation this
* will return EBUSY which we treat as an error. In scenarios where the history store is not
@@ -1862,7 +1865,7 @@ __wt_checkpoint_close(WT_SESSION_IMPL *session, bool final)
* for a checkpoint to complete.
*/
static void
-__checkpoint_timing_stress(WT_SESSION_IMPL *session)
+__checkpoint_timing_stress(WT_SESSION_IMPL *session, bool history_store_stress)
{
WT_CONNECTION_IMPL *conn;
@@ -1873,6 +1876,9 @@ __checkpoint_timing_stress(WT_SESSION_IMPL *session)
* the session used is either of the two sessions set aside for internal checkpoints.
*/
if (conn->ckpt_session != session && conn->meta_ckpt_session != session &&
- FLD_ISSET(conn->timing_stress_flags, WT_TIMING_STRESS_CHECKPOINT_SLOW))
+ ((FLD_ISSET(conn->timing_stress_flags, WT_TIMING_STRESS_CHECKPOINT_SLOW) &&
+ !history_store_stress) ||
+ (FLD_ISSET(conn->timing_stress_flags, WT_TIMING_STRESS_HS_CHECKPOINT_DELAY) &&
+ history_store_stress)))
__wt_sleep(10, 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 e546d8401e8..d9f6afe3477 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
@@ -355,14 +355,28 @@ __rollback_abort_row_ondisk_kv(
WT_DECL_RET;
WT_ITEM buf;
WT_UPDATE *upd;
- char ts_string[4][WT_TS_INT_STRING_SIZE];
+ char ts_string[5][WT_TS_INT_STRING_SIZE];
bool prepared;
vpack = &_vpack;
upd = NULL;
__wt_row_leaf_value_cell(session, page, rip, NULL, vpack);
prepared = vpack->tw.prepare;
- if (vpack->tw.durable_start_ts > rollback_timestamp ||
+ if (WT_IS_HS(S2BT(session))) {
+ if (vpack->tw.durable_stop_ts > rollback_timestamp) {
+ __wt_verbose(session, WT_VERB_RTS,
+ "hs update aborted with start durable/commit timestamp: %s, %s, "
+ "stop durable/commit timestamp: %s, %s and stable timestamp: %s",
+ __wt_timestamp_to_string(vpack->tw.durable_start_ts, ts_string[0]),
+ __wt_timestamp_to_string(vpack->tw.start_ts, ts_string[1]),
+ __wt_timestamp_to_string(vpack->tw.durable_stop_ts, ts_string[2]),
+ __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);
+ } else
+ return (0);
+ } else if (vpack->tw.durable_start_ts > rollback_timestamp ||
(vpack->tw.durable_stop_ts == WT_TS_NONE && prepared)) {
__wt_verbose(session, WT_VERB_RTS,
"on-disk update aborted with start durable timestamp: %s, commit timestamp: %s, "
@@ -532,14 +546,16 @@ __rollback_abort_row_reconciled_page(
mod->mod_replace.ta.newest_stop_durable_ts > rollback_timestamp ||
mod->mod_replace.ta.prepare)) {
__wt_verbose(session, WT_VERB_RTS,
- "reconciled replace block page history store update removal On-disk with start "
+ "reconciled replace block page history store update removal on-disk with start "
"durable timestamp: %s, stop durable timestamp: %s and stable timestamp: %s",
__wt_timestamp_to_string(mod->mod_replace.ta.newest_start_durable_ts, ts_string[0]),
__wt_timestamp_to_string(mod->mod_replace.ta.newest_stop_durable_ts, ts_string[1]),
__wt_timestamp_to_string(rollback_timestamp, ts_string[2]));
- 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));
+ /* Remove the history store newer updates. */
+ if (!WT_IS_HS(S2BT(session)))
+ 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));
/*
* As this page has newer aborts that are aborted, make sure to mark the page as dirty to
@@ -561,8 +577,10 @@ __rollback_abort_row_reconciled_page(
__wt_timestamp_to_string(multi->addr.ta.newest_stop_durable_ts, ts_string[1]),
__wt_timestamp_to_string(rollback_timestamp, ts_string[2]));
- WT_RET(__rollback_abort_row_reconciled_page_internal(session, multi->disk_image,
- multi->addr.addr, multi->addr.size, rollback_timestamp));
+ /* Remove the history store newer updates. */
+ if (!WT_IS_HS(S2BT(session)))
+ WT_RET(__rollback_abort_row_reconciled_page_internal(session, multi->disk_image,
+ multi->addr.addr, multi->addr.size, rollback_timestamp));
/*
* As this page has newer aborts that are aborted, make sure to mark the page as
@@ -754,7 +772,7 @@ __rollback_abort_newer_updates(
WT_RET(__wt_page_in(session, ref, 0));
if (ref->page->type == WT_PAGE_ROW_LEAF)
__rollback_verify_ondisk_page(session, ref->page, rollback_timestamp);
- WT_TRET_BUSY_OK(__wt_page_release_evict(session, ref, 0));
+ WT_TRET_BUSY_OK(__wt_page_release_evict(session, ref, WT_READ_NO_SPLIT));
}
#endif
return (0);
@@ -795,7 +813,7 @@ __rollback_abort_newer_updates(
err:
if (local_read)
- WT_TRET_BUSY_OK(__wt_page_release_evict(session, ref, 0));
+ WT_TRET_BUSY_OK(__wt_page_release_evict(session, ref, WT_READ_NO_SPLIT));
return (ret);
}
@@ -999,6 +1017,64 @@ err:
}
/*
+ * __rollback_to_stable_hs_final_pass --
+ * Perform rollback to stable on the history store to remove any entries newer than the stable
+ * timestamp.
+ */
+static int
+__rollback_to_stable_hs_final_pass(WT_SESSION_IMPL *session, wt_timestamp_t rollback_timestamp)
+{
+ WT_CONFIG ckptconf;
+ WT_CONFIG_ITEM cval, durableval, key;
+ WT_DECL_RET;
+ wt_timestamp_t max_durable_ts, newest_start_durable_ts, newest_stop_durable_ts;
+ char *config;
+ char ts_string[2][WT_TS_INT_STRING_SIZE];
+
+ config = NULL;
+
+ WT_RET(__wt_metadata_search(session, WT_HS_URI, &config));
+
+ /* Find out the max durable timestamp of the object from checkpoint. */
+ newest_start_durable_ts = newest_stop_durable_ts = WT_TS_NONE;
+ WT_ERR(__wt_config_getones(session, config, "checkpoint", &cval));
+ __wt_config_subinit(session, &ckptconf, &cval);
+ for (; __wt_config_next(&ckptconf, &key, &cval) == 0;) {
+ ret = __wt_config_subgets(session, &cval, "newest_start_durable_ts", &durableval);
+ if (ret == 0)
+ newest_start_durable_ts =
+ WT_MAX(newest_start_durable_ts, (wt_timestamp_t)durableval.val);
+ WT_ERR_NOTFOUND_OK(ret, false);
+ ret = __wt_config_subgets(session, &cval, "newest_stop_durable_ts", &durableval);
+ if (ret == 0)
+ newest_stop_durable_ts = WT_MAX(newest_stop_durable_ts, (wt_timestamp_t)durableval.val);
+ WT_ERR_NOTFOUND_OK(ret, false);
+ }
+ max_durable_ts = WT_MAX(newest_start_durable_ts, newest_stop_durable_ts);
+ WT_ERR(__wt_session_get_dhandle(session, WT_HS_URI, NULL, NULL, 0));
+
+ /*
+ * The rollback operation should be performed on the history store file when the checkpoint
+ * durable start/stop timestamp is greater than the rollback timestamp.
+ */
+ if (max_durable_ts > rollback_timestamp) {
+ __wt_verbose(session, WT_VERB_RTS, "tree rolled back with durable timestamp: %s",
+ __wt_timestamp_to_string(max_durable_ts, ts_string[0]));
+ WT_TRET(__rollback_to_stable_btree(session, rollback_timestamp));
+ } else
+ __wt_verbose(session, WT_VERB_RTS,
+ "tree skipped with durable timestamp: %s and stable timestamp: %s",
+ __wt_timestamp_to_string(max_durable_ts, ts_string[0]),
+ __wt_timestamp_to_string(rollback_timestamp, ts_string[1]));
+
+ WT_TRET(__wt_session_release_dhandle(session));
+
+err:
+ __wt_free(session, config);
+ return (ret);
+}
+
+/*
* __rollback_to_stable_btree_apply --
* Perform rollback to stable to all files listed in the metadata, apart from the metadata and
* history store files.
@@ -1118,6 +1194,9 @@ __rollback_to_stable_btree_apply(WT_SESSION_IMPL *session)
}
WT_ERR_NOTFOUND_OK(ret, false);
+ if (F_ISSET(S2C(session), WT_CONN_RECOVERING))
+ WT_ERR(__rollback_to_stable_hs_final_pass(session, rollback_timestamp));
+
err:
WT_TRET(__wt_metadata_cursor_release(session, &cursor));
return (ret);
diff --git a/src/third_party/wiredtiger/src/utilities/util_dump.c b/src/third_party/wiredtiger/src/utilities/util_dump.c
index 44897ddf044..82e6ac54d17 100755
--- a/src/third_party/wiredtiger/src/utilities/util_dump.c
+++ b/src/third_party/wiredtiger/src/utilities/util_dump.c
@@ -33,7 +33,8 @@ usage(void)
static const char *options[] = {"-c checkpoint",
"dump as of the named checkpoint (the default is the most recent version of the data)",
"-f output", "dump to the specified file (the default is stdout)", "-j",
- "dump in JSON format", "-r", "dump in reverse order", "-t timestamp",
+ "dump in JSON format", "-p", "dump in human readable format (pretty-print)", "-r",
+ "dump in reverse order", "-t timestamp",
"dump as of the specified timestamp (the default is the most recent version of the data)",
"-x",
"dump all characters in a hexadecimal encoding (by default printable characters are not "
@@ -41,7 +42,7 @@ usage(void)
NULL, NULL};
util_usage(
- "dump [-jrx] [-c checkpoint] [-f output-file] [-t timestamp] uri", "options:", options);
+ "dump [-jprx] [-c checkpoint] [-f output-file] [-t timestamp] uri", "options:", options);
return (1);
}
@@ -55,17 +56,17 @@ util_dump(WT_SESSION *session, int argc, char *argv[])
WT_DECL_ITEM(tmp);
WT_DECL_RET;
WT_SESSION_IMPL *session_impl;
- int ch, i;
+ int ch, format_specifiers, i;
char *checkpoint, *ofile, *p, *simpleuri, *timestamp, *uri;
- bool hex, json, reverse;
+ bool hex, json, pretty, reverse;
session_impl = (WT_SESSION_IMPL *)session;
cursor = NULL;
hs_dump_cursor = NULL;
checkpoint = ofile = simpleuri = uri = timestamp = NULL;
- hex = json = reverse = false;
- while ((ch = __wt_getopt(progname, argc, argv, "c:f:t:jrx")) != EOF)
+ hex = json = pretty = reverse = false;
+ while ((ch = __wt_getopt(progname, argc, argv, "c:f:t:jprx")) != EOF)
switch (ch) {
case 'c':
checkpoint = __wt_optarg;
@@ -76,6 +77,9 @@ util_dump(WT_SESSION *session, int argc, char *argv[])
case 'j':
json = true;
break;
+ case 'p':
+ pretty = true;
+ break;
case 'r':
reverse = true;
break;
@@ -96,9 +100,16 @@ util_dump(WT_SESSION *session, int argc, char *argv[])
if (argc < 1 || (argc != 1 && !json))
return (usage());
- /* -j and -x are incompatible. */
- if (hex && json) {
- fprintf(stderr, "%s: the -j and -x dump options are incompatible\n", progname);
+ /* -j, -p and -x are incompatible. */
+ format_specifiers = 0;
+ if (json)
+ ++format_specifiers;
+ if (pretty)
+ ++format_specifiers;
+ if (hex)
+ ++format_specifiers;
+ if (format_specifiers > 1) {
+ fprintf(stderr, "%s: the -j, -p and -x dump options are incompatible\n", progname);
return (usage());
}
@@ -136,8 +147,8 @@ util_dump(WT_SESSION *session, int argc, char *argv[])
WT_ERR(__wt_buf_set(session_impl, tmp, "", 0));
if (checkpoint != NULL)
WT_ERR(__wt_buf_catfmt(session_impl, tmp, "checkpoint=%s,", checkpoint));
- WT_ERR(
- __wt_buf_catfmt(session_impl, tmp, "dump=%s", json ? "json" : (hex ? "hex" : "print")));
+ WT_ERR(__wt_buf_catfmt(session_impl, tmp, "dump=%s",
+ json ? "json" : (hex ? "hex" : (pretty ? "pretty" : "print"))));
if ((ret = session->open_cursor(session, uri, NULL, (char *)tmp->data, &cursor)) != 0) {
fprintf(stderr, "%s: cursor open(%s) failed: %s\n", progname, uri,
session->strerror(session, ret));
diff --git a/src/third_party/wiredtiger/test/checkpoint/workers.c b/src/third_party/wiredtiger/test/checkpoint/workers.c
index d8df3d49393..55cd5dba91d 100644
--- a/src/third_party/wiredtiger/test/checkpoint/workers.c
+++ b/src/third_party/wiredtiger/test/checkpoint/workers.c
@@ -311,7 +311,7 @@ real_worker(void)
}
err:
- if ((t_ret = session->close(session, NULL)) != 0 && ret == 0) {
+ if (session != NULL && (t_ret = session->close(session, NULL)) != 0 && ret == 0) {
ret = t_ret;
(void)log_print_err("session.close", ret, 1);
}
diff --git a/src/third_party/wiredtiger/test/format/config.c b/src/third_party/wiredtiger/test/format/config.c
index dffde8eb25a..f802d8eb36b 100644
--- a/src/third_party/wiredtiger/test/format/config.c
+++ b/src/third_party/wiredtiger/test/format/config.c
@@ -349,6 +349,13 @@ config_backward_compatible(void)
testutil_die(EINVAL, "stress.hs_sweep not supported in backward compatibility mode");
config_single("stress.hs_sweep=off", false);
}
+
+ if (g.c_timing_stress_hs_checkpoint_delay) {
+ if (config_is_perm("stress.hs_checkpoint_delay"))
+ testutil_die(
+ EINVAL, "stress.hs_checkpoint_delay not supported in backward compatibility mode");
+ config_single("stress.hs_checkpoint_delay=off", false);
+ }
}
/*
diff --git a/src/third_party/wiredtiger/test/format/config.h b/src/third_party/wiredtiger/test/format/config.h
index d0023be05d2..cef2eda6142 100644
--- a/src/third_party/wiredtiger/test/format/config.h
+++ b/src/third_party/wiredtiger/test/format/config.h
@@ -289,6 +289,9 @@ static CONFIG c[] = {
{"runs.type", "type of store to create (fix | var | row)", C_IGNORE | C_STRING, 0, 0, 0, NULL,
&g.c_file_type},
+ {"runs.verify_failure_dump", "attempt page dump on repeatable read error", C_IGNORE | C_BOOL, 0,
+ 0, 1, &g.c_verify_failure_dump, NULL},
+
/* 20% */
{"statistics", "maintain statistics", C_BOOL, 20, 0, 0, &g.c_statistics, NULL},
@@ -304,6 +307,10 @@ static CONFIG c[] = {
{"stress.checkpoint", "stress checkpoints", C_BOOL, 2, 0, 0, &g.c_timing_stress_checkpoint, NULL},
/* 2% */
+ {"stress.hs_checkpoint_delay", "stress history store checkpoint delay", C_BOOL, 2, 0, 0,
+ &g.c_timing_stress_hs_checkpoint_delay, NULL},
+
+ /* 2% */
{"stress.hs_sweep", "stress history store sweep", C_BOOL, 2, 0, 0, &g.c_timing_stress_hs_sweep,
NULL},
diff --git a/src/third_party/wiredtiger/test/format/format.h b/src/third_party/wiredtiger/test/format/format.h
index c8bafaaafd8..9416c45cd60 100644
--- a/src/third_party/wiredtiger/test/format/format.h
+++ b/src/third_party/wiredtiger/test/format/format.h
@@ -79,6 +79,7 @@ typedef struct {
WT_CONNECTION *wts_conn;
WT_CONNECTION *wts_conn_inmemory;
+ WT_SESSION *wts_session;
char *uri; /* Object name */
@@ -129,6 +130,7 @@ typedef struct {
* misbehaving.
*/
pthread_rwlock_t death_lock;
+ WT_CURSOR *page_dump_cursor; /* Snapshot isolation read failed, modifies failure handling. */
uint32_t c_abort; /* Config values */
uint32_t c_alter;
@@ -207,6 +209,7 @@ typedef struct {
uint32_t c_timer;
uint32_t c_timing_stress_aggressive_sweep;
uint32_t c_timing_stress_checkpoint;
+ uint32_t c_timing_stress_hs_checkpoint_delay;
uint32_t c_timing_stress_hs_sweep;
uint32_t c_timing_stress_split_1;
uint32_t c_timing_stress_split_2;
@@ -222,6 +225,7 @@ typedef struct {
uint32_t c_value_max;
uint32_t c_value_min;
uint32_t c_verify;
+ uint32_t c_verify_failure_dump;
uint32_t c_write_pct;
uint32_t c_wt_mutex;
diff --git a/src/third_party/wiredtiger/test/format/snap.c b/src/third_party/wiredtiger/test/format/snap.c
index 031f52635d6..15c82a649fb 100644
--- a/src/third_party/wiredtiger/test/format/snap.c
+++ b/src/third_party/wiredtiger/test/format/snap.c
@@ -226,29 +226,7 @@ snap_verify(WT_CURSOR *cursor, TINFO *tinfo, SNAP_OPS *snap)
break;
}
-#ifdef HAVE_DIAGNOSTIC
- /*
- * We have a mismatch. Try to print out as much information as we can. In doing so, we are
- * calling into the debug code directly and that does not take locks, so it's possible we will
- * simply drop core. The most important information is the key/value mismatch information. Then
- * try to dump out the other information. Right now we dump the entire history store table
- * including what is on disk. That can potentially be very large. If it becomes a problem, this
- * can be modified to just dump out the page this key is on. Write a failure message into the
- * log file first so format.sh knows we failed, and turn off core dumps.
- */
- fprintf(stderr, "\n%s: run FAILED\n", progname);
- set_core_off();
-
- fprintf(stderr, "snapshot-isolation error: Dumping page to %s\n", g.home_pagedump);
- testutil_check(__wt_debug_cursor_page(cursor, g.home_pagedump));
- fprintf(stderr, "snapshot-isolation error: Dumping HS to %s\n", g.home_hsdump);
-#if WIREDTIGER_VERSION_MAJOR >= 10
- testutil_check(__wt_debug_cursor_tree_hs(cursor, g.home_hsdump));
-#endif
- if (g.c_logging)
- testutil_check(cursor->session->log_flush(cursor->session, "sync=off"));
-#endif
-
+ g.page_dump_cursor = cursor;
testutil_assert(0);
/* NOTREACHED */
diff --git a/src/third_party/wiredtiger/test/format/t.c b/src/third_party/wiredtiger/test/format/t.c
index de329749335..65eb53eb2ac 100644
--- a/src/third_party/wiredtiger/test/format/t.c
+++ b/src/third_party/wiredtiger/test/format/t.c
@@ -266,11 +266,11 @@ main(int argc, char *argv[])
if (g.reopen) {
config_final();
- wts_open(g.home, &g.wts_conn, NULL, true);
+ wts_open(g.home, &g.wts_conn, &g.wts_session, true);
} else {
wts_create(g.home);
config_final();
- wts_open(g.home, &g.wts_conn, NULL, true);
+ wts_open(g.home, &g.wts_conn, &g.wts_session, true);
trace_init();
TIMED_MAJOR_OP(wts_load()); /* Load and verify initial records */
@@ -295,7 +295,7 @@ main(int argc, char *argv[])
TIMED_MAJOR_OP(wts_verify(g.wts_conn, "post-ops verify"));
track("shutting down", 0ULL, NULL);
- wts_close(&g.wts_conn, NULL);
+ wts_close(&g.wts_conn, &g.wts_session);
/*
* Rebalance testing.
@@ -334,27 +334,54 @@ main(int argc, char *argv[])
static void
format_die(void)
{
-
/*
- * Turn off progress reports and logging so we don't obscure the error message. The lock we're
- * about to acquire will act as a barrier to flush the writes. This is really a "best effort"
- * more than a guarantee, there's too much stuff in flight to be sure.
+ * Turn off progress reports so we don't obscure the error message. The lock we're about to
+ * acquire will act as a barrier to schedule the write. This is really a "best effort" more than
+ * a guarantee, there's too much stuff in flight to be sure.
*/
g.c_quiet = 1;
- g.trace = false;
/*
* Single-thread error handling, our caller exits after calling us (we never release the lock).
*/
(void)pthread_rwlock_wrlock(&g.death_lock);
- trace_teardown();
-
+ /* Write a failure message so format.sh knows we failed. */
fprintf(stderr, "\n%s: run FAILED\n", progname);
+ fflush(stderr);
+ fflush(stdout);
+
+ /* Flush the logs, they may contain debugging information. */
+ trace_teardown();
+ if (g.c_logging && g.wts_session != NULL)
+ testutil_check(g.wts_session->log_flush(g.wts_session, "sync=off"));
/* Display the configuration that failed. */
if (g.run_cnt)
config_print(true);
+
+#ifdef HAVE_DIAGNOSTIC
+ /*
+ * We have a mismatch, optionally dump WiredTiger datastore pages. In doing so, we are calling
+ * into the debug code directly which does not take locks, so it's possible we will simply drop
+ * core. Turn off core dumps, those core files aren't interesting.
+ *
+ * The most important information is the key/value mismatch information. Then try to dump out
+ * additional information. We dump the entire history store table including what is on disk,
+ * which can potentially be very large. If it becomes a problem, this can be modified to just
+ * dump out the page this key is on.
+ */
+ if (g.c_verify_failure_dump && g.page_dump_cursor != NULL) {
+ set_core_off();
+
+ fprintf(stderr, "snapshot-isolation error: Dumping page to %s\n", g.home_pagedump);
+ testutil_check(__wt_debug_cursor_page(g.page_dump_cursor, g.home_pagedump));
+ fprintf(stderr, "snapshot-isolation error: Dumping HS to %s\n", g.home_hsdump);
+#if WIREDTIGER_VERSION_MAJOR >= 10
+ testutil_check(__wt_debug_cursor_tree_hs(g.page_dump_cursor, g.home_hsdump));
+#endif
+ }
+#endif
}
/*
diff --git a/src/third_party/wiredtiger/test/format/wts.c b/src/third_party/wiredtiger/test/format/wts.c
index f822a6e8bea..9fc7e9be2f5 100644
--- a/src/third_party/wiredtiger/test/format/wts.c
+++ b/src/third_party/wiredtiger/test/format/wts.c
@@ -232,6 +232,8 @@ create_database(const char *home, WT_CONNECTION **connp)
CONFIG_APPEND(p, ",aggressive_sweep");
if (g.c_timing_stress_checkpoint)
CONFIG_APPEND(p, ",checkpoint_slow");
+ if (g.c_timing_stress_hs_checkpoint_delay)
+ CONFIG_APPEND(p, ",history_store_checkpoint_delay");
if (g.c_timing_stress_hs_sweep)
CONFIG_APPEND(p, ",history_store_sweep_race");
if (g.c_timing_stress_split_1)
@@ -439,8 +441,7 @@ wts_open(const char *home, WT_CONNECTION **connp, WT_SESSION **sessionp, bool al
const char *config;
*connp = NULL;
- if (sessionp != NULL)
- *sessionp = NULL;
+ *sessionp = NULL;
/* If in-memory, there's only a single, shared WT_CONNECTION handle. */
if (g.c_in_memory != 0)
@@ -456,8 +457,7 @@ wts_open(const char *home, WT_CONNECTION **connp, WT_SESSION **sessionp, bool al
testutil_checkfmt(wiredtiger_open(home, &event_handler, config, &conn), "%s", home);
}
- if (sessionp != NULL)
- testutil_check(conn->open_session(conn, NULL, NULL, sessionp));
+ testutil_check(conn->open_session(conn, NULL, NULL, sessionp));
*connp = conn;
}
@@ -477,8 +477,7 @@ wts_close(WT_CONNECTION **connp, WT_SESSION **sessionp)
*/
if (conn == g.wts_conn_inmemory)
g.wts_conn_inmemory = NULL;
- if (sessionp != NULL)
- *sessionp = NULL;
+ *sessionp = NULL;
if (g.backward_compatible)
testutil_check(conn->reconfigure(conn, "compatibility=(release=3.3)"));