summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/third_party/wiredtiger/dist/api_data.py3
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/config/config_def.c41
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_api.c6
-rw-r--r--src/third_party/wiredtiger/src/include/connection.h5
-rw-r--r--src/third_party/wiredtiger/src/include/wiredtiger.in31
-rw-r--r--src/third_party/wiredtiger/src/os_common/os_alloc.c23
-rw-r--r--src/third_party/wiredtiger/test/format/config.h148
-rwxr-xr-xsrc/third_party/wiredtiger/test/format/config.sh4
-rw-r--r--src/third_party/wiredtiger/test/format/config_def.c6
-rw-r--r--src/third_party/wiredtiger/test/format/wts.c11
-rw-r--r--src/third_party/wiredtiger/test/suite/test_debug_mode10.py58
12 files changed, 225 insertions, 113 deletions
diff --git a/src/third_party/wiredtiger/dist/api_data.py b/src/third_party/wiredtiger/dist/api_data.py
index 4d795bc1f4c..84b3719692c 100644
--- a/src/third_party/wiredtiger/dist/api_data.py
+++ b/src/third_party/wiredtiger/dist/api_data.py
@@ -593,6 +593,9 @@ connection_runtime_config = [
if true, reallocation of memory will only provide the exact amount requested. This
will help with spotting memory allocation issues more easily.''',
type='boolean'),
+ Config('realloc_malloc', 'false', r'''
+ if true, every realloc call will force a new memory allocation by using malloc.''',
+ type='boolean'),
Config('rollback_error', '0', r'''
return a WT_ROLLBACK error from a transaction operation about every Nth operation
to simulate a collision''',
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 935466405c7..e5351f75aea 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-master",
- "commit": "f3627162fc31834acb008a92da5b2993aaae6484"
+ "commit": "34370d2091b601498ecf85fad57bcc892cc9bff9"
}
diff --git a/src/third_party/wiredtiger/src/config/config_def.c b/src/third_party/wiredtiger/src/config/config_def.c
index 94458924c1b..bb81254db81 100644
--- a/src/third_party/wiredtiger/src/config/config_def.c
+++ b/src/third_party/wiredtiger/src/config/config_def.c
@@ -67,6 +67,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_debug_mode_subconfigs[] = {
{"eviction", "boolean", NULL, NULL, NULL, 0},
{"log_retention", "int", NULL, "min=0,max=1024", NULL, 0},
{"realloc_exact", "boolean", NULL, NULL, NULL, 0},
+ {"realloc_malloc", "boolean", NULL, NULL, NULL, 0},
{"rollback_error", "int", NULL, "min=0,max=10M", NULL, 0},
{"slow_checkpoint", "boolean", NULL, NULL, NULL, 0},
{"table_logging", "boolean", NULL, NULL, NULL, 0},
@@ -123,7 +124,7 @@ static const WT_CONFIG_CHECK confchk_WT_CONNECTION_reconfigure[] = {
{"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2},
{"compatibility", "category", NULL, NULL,
confchk_WT_CONNECTION_reconfigure_compatibility_subconfigs, 1},
- {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 11},
+ {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 12},
{"error_prefix", "string", NULL, NULL, NULL, 0},
{"eviction", "category", NULL, NULL, confchk_wiredtiger_open_eviction_subconfigs, 2},
{"eviction_checkpoint_target", "int", NULL, "min=0,max=10TB", NULL, 0},
@@ -861,7 +862,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open[] = {
{"checkpoint_sync", "boolean", NULL, NULL, NULL, 0},
{"compatibility", "category", NULL, NULL, confchk_wiredtiger_open_compatibility_subconfigs, 3},
{"config_base", "boolean", NULL, NULL, NULL, 0}, {"create", "boolean", NULL, NULL, NULL, 0},
- {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 11},
+ {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 12},
{"direct_io", "list", NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", NULL, 0},
{"encryption", "category", NULL, NULL, confchk_wiredtiger_open_encryption_subconfigs, 3},
{"error_prefix", "string", NULL, NULL, NULL, 0},
@@ -945,7 +946,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_all[] = {
{"checkpoint_sync", "boolean", NULL, NULL, NULL, 0},
{"compatibility", "category", NULL, NULL, confchk_wiredtiger_open_compatibility_subconfigs, 3},
{"config_base", "boolean", NULL, NULL, NULL, 0}, {"create", "boolean", NULL, NULL, NULL, 0},
- {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 11},
+ {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 12},
{"direct_io", "list", NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", NULL, 0},
{"encryption", "category", NULL, NULL, confchk_wiredtiger_open_encryption_subconfigs, 3},
{"error_prefix", "string", NULL, NULL, NULL, 0},
@@ -1028,7 +1029,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_basecfg[] = {
{"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2},
{"checkpoint_sync", "boolean", NULL, NULL, NULL, 0},
{"compatibility", "category", NULL, NULL, confchk_wiredtiger_open_compatibility_subconfigs, 3},
- {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 11},
+ {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 12},
{"direct_io", "list", NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", NULL, 0},
{"encryption", "category", NULL, NULL, confchk_wiredtiger_open_encryption_subconfigs, 3},
{"error_prefix", "string", NULL, NULL, NULL, 0},
@@ -1108,7 +1109,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_usercfg[] = {
{"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2},
{"checkpoint_sync", "boolean", NULL, NULL, NULL, 0},
{"compatibility", "category", NULL, NULL, confchk_wiredtiger_open_compatibility_subconfigs, 3},
- {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 11},
+ {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 12},
{"direct_io", "list", NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", NULL, 0},
{"encryption", "category", NULL, NULL, confchk_wiredtiger_open_encryption_subconfigs, 3},
{"error_prefix", "string", NULL, NULL, NULL, 0},
@@ -1205,8 +1206,8 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"checkpoint=(log_size=0,wait=0),compatibility=(release=),"
"debug_mode=(checkpoint_retention=0,corruption_abort=true,"
"cursor_copy=false,cursor_reposition=false,eviction=false,"
- "log_retention=0,realloc_exact=false,rollback_error=0,"
- "slow_checkpoint=false,table_logging=false,"
+ "log_retention=0,realloc_exact=false,realloc_malloc=false,"
+ "rollback_error=0,slow_checkpoint=false,table_logging=false,"
"update_restore_evict=false),error_prefix=,"
"eviction=(threads_max=8,threads_min=1),"
"eviction_checkpoint_target=1,eviction_dirty_target=5,"
@@ -1486,10 +1487,11 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"config_base=true,create=false,debug_mode=(checkpoint_retention=0"
",corruption_abort=true,cursor_copy=false,cursor_reposition=false"
",eviction=false,log_retention=0,realloc_exact=false,"
- "rollback_error=0,slow_checkpoint=false,table_logging=false,"
- "update_restore_evict=false),direct_io=,encryption=(keyid=,name=,"
- "secretkey=),error_prefix=,eviction=(threads_max=8,threads_min=1)"
- ",eviction_checkpoint_target=1,eviction_dirty_target=5,"
+ "realloc_malloc=false,rollback_error=0,slow_checkpoint=false,"
+ "table_logging=false,update_restore_evict=false),direct_io=,"
+ "encryption=(keyid=,name=,secretkey=),error_prefix=,"
+ "eviction=(threads_max=8,threads_min=1),"
+ "eviction_checkpoint_target=1,eviction_dirty_target=5,"
"eviction_dirty_trigger=20,eviction_target=80,eviction_trigger=95"
",eviction_updates_target=0,eviction_updates_trigger=0,"
"exclusive=false,extensions=,file_extend=,"
@@ -1526,10 +1528,11 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"config_base=true,create=false,debug_mode=(checkpoint_retention=0"
",corruption_abort=true,cursor_copy=false,cursor_reposition=false"
",eviction=false,log_retention=0,realloc_exact=false,"
- "rollback_error=0,slow_checkpoint=false,table_logging=false,"
- "update_restore_evict=false),direct_io=,encryption=(keyid=,name=,"
- "secretkey=),error_prefix=,eviction=(threads_max=8,threads_min=1)"
- ",eviction_checkpoint_target=1,eviction_dirty_target=5,"
+ "realloc_malloc=false,rollback_error=0,slow_checkpoint=false,"
+ "table_logging=false,update_restore_evict=false),direct_io=,"
+ "encryption=(keyid=,name=,secretkey=),error_prefix=,"
+ "eviction=(threads_max=8,threads_min=1),"
+ "eviction_checkpoint_target=1,eviction_dirty_target=5,"
"eviction_dirty_trigger=20,eviction_target=80,eviction_trigger=95"
",eviction_updates_target=0,eviction_updates_trigger=0,"
"exclusive=false,extensions=,file_extend=,"
@@ -1566,8 +1569,8 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"compatibility=(release=,require_max=,require_min=),"
"debug_mode=(checkpoint_retention=0,corruption_abort=true,"
"cursor_copy=false,cursor_reposition=false,eviction=false,"
- "log_retention=0,realloc_exact=false,rollback_error=0,"
- "slow_checkpoint=false,table_logging=false,"
+ "log_retention=0,realloc_exact=false,realloc_malloc=false,"
+ "rollback_error=0,slow_checkpoint=false,table_logging=false,"
"update_restore_evict=false),direct_io=,encryption=(keyid=,name=,"
"secretkey=),error_prefix=,eviction=(threads_max=8,threads_min=1)"
",eviction_checkpoint_target=1,eviction_dirty_target=5,"
@@ -1605,8 +1608,8 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"compatibility=(release=,require_max=,require_min=),"
"debug_mode=(checkpoint_retention=0,corruption_abort=true,"
"cursor_copy=false,cursor_reposition=false,eviction=false,"
- "log_retention=0,realloc_exact=false,rollback_error=0,"
- "slow_checkpoint=false,table_logging=false,"
+ "log_retention=0,realloc_exact=false,realloc_malloc=false,"
+ "rollback_error=0,slow_checkpoint=false,table_logging=false,"
"update_restore_evict=false),direct_io=,encryption=(keyid=,name=,"
"secretkey=),error_prefix=,eviction=(threads_max=8,threads_min=1)"
",eviction_checkpoint_target=1,eviction_dirty_target=5,"
diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c
index 24a3d662ec8..1282c4ced1d 100644
--- a/src/third_party/wiredtiger/src/conn/conn_api.c
+++ b/src/third_party/wiredtiger/src/conn/conn_api.c
@@ -2017,6 +2017,12 @@ __wt_debug_mode_config(WT_SESSION_IMPL *session, const char *cfg[])
else
FLD_CLR(conn->debug_flags, WT_CONN_DEBUG_REALLOC_EXACT);
+ WT_RET(__wt_config_gets(session, cfg, "debug_mode.realloc_malloc", &cval));
+ if (cval.val)
+ FLD_SET(conn->debug_flags, WT_CONN_DEBUG_REALLOC_MALLOC);
+ else
+ FLD_CLR(conn->debug_flags, WT_CONN_DEBUG_REALLOC_MALLOC);
+
WT_RET(__wt_config_gets(session, cfg, "debug_mode.rollback_error", &cval));
txn_global->debug_rollback = (uint64_t)cval.val;
diff --git a/src/third_party/wiredtiger/src/include/connection.h b/src/third_party/wiredtiger/src/include/connection.h
index a7b9c41e29d..a348415b1cc 100644
--- a/src/third_party/wiredtiger/src/include/connection.h
+++ b/src/third_party/wiredtiger/src/include/connection.h
@@ -567,8 +567,9 @@ struct __wt_connection_impl {
#define WT_CONN_DEBUG_CURSOR_COPY 0x04u
#define WT_CONN_DEBUG_CURSOR_REPOSITION 0x08u
#define WT_CONN_DEBUG_REALLOC_EXACT 0x10u
-#define WT_CONN_DEBUG_SLOW_CKPT 0x20u
-#define WT_CONN_DEBUG_UPDATE_RESTORE_EVICT 0x40u
+#define WT_CONN_DEBUG_REALLOC_MALLOC 0x20u
+#define WT_CONN_DEBUG_SLOW_CKPT 0x40u
+#define WT_CONN_DEBUG_UPDATE_RESTORE_EVICT 0x80u
/* AUTOMATIC FLAG VALUE GENERATION STOP 16 */
uint16_t debug_flags;
diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in
index 83af70db554..e103766eed4 100644
--- a/src/third_party/wiredtiger/src/include/wiredtiger.in
+++ b/src/third_party/wiredtiger/src/include/wiredtiger.in
@@ -2247,6 +2247,8 @@ struct __wt_connection {
* @config{    realloc_exact, if true\, reallocation of memory
* will only provide the exact amount requested. This will help with spotting memory
* allocation issues more easily., a boolean flag; default \c false.}
+ * @config{    realloc_malloc, if true\, every realloc call will force a
+ * new memory allocation by using malloc., a boolean flag; default \c false.}
* @config{    rollback_error, return a WT_ROLLBACK error from a
* transaction operation about every Nth operation to simulate a collision., an integer
* between \c 0 and \c 10M; default \c 0.}
@@ -2972,21 +2974,22 @@ struct __wt_connection {
* @config{    realloc_exact, if true\, reallocation of memory will only provide
* the exact amount requested. This will help with spotting memory allocation issues more easily.,
* a boolean flag; default \c false.}
- * @config{    rollback_error, return a
- * WT_ROLLBACK error from a transaction operation about every Nth operation to simulate a
- * collision., an integer between \c 0 and \c 10M; default \c 0.}
+ * @config{    realloc_malloc, if true\,
+ * every realloc call will force a new memory allocation by using malloc., a boolean flag; default
+ * \c false.}
+ * @config{    rollback_error, return a WT_ROLLBACK error from a
+ * transaction operation about every Nth operation to simulate a collision., an integer between \c 0
+ * and \c 10M; default \c 0.}
+ * @config{    slow_checkpoint, if true\, slow down
+ * checkpoint creation by slowing down internal page processing., a boolean flag; default \c false.}
+ * @config{    table_logging, if true\, write transaction related information to
+ * the log for all operations\, even operations for tables with logging turned off. This additional
+ * logging information is intended for debugging and is informational only\, that is\, it is ignored
+ * during recovery., a boolean flag; default \c false.}
* @config{    
- * slow_checkpoint, if true\, slow down checkpoint creation by slowing down internal page
- * processing., a boolean flag; default \c false.}
- * @config{    table_logging, if
- * true\, write transaction related information to the log for all operations\, even operations for
- * tables with logging turned off. This additional logging information is intended for debugging
- * and is informational only\, that is\, it is ignored during recovery., a boolean flag; default \c
- * false.}
- * @config{    update_restore_evict, if true\, control all dirty page
- * evictions through forcing update restore eviction., a boolean flag; default \c false.}
- * @config{
- * ),,}
+ * update_restore_evict, if true\, control all dirty page evictions through forcing update restore
+ * eviction., a boolean flag; default \c false.}
+ * @config{ ),,}
* @config{direct_io, Use \c O_DIRECT on POSIX systems\, and \c FILE_FLAG_NO_BUFFERING on Windows to
* access files. Options are given as a list\, such as <code>"direct_io=[data]"</code>. Configuring
* \c direct_io requires care; see @ref tuning_system_buffer_cache_direct_io for important warnings.
diff --git a/src/third_party/wiredtiger/src/os_common/os_alloc.c b/src/third_party/wiredtiger/src/os_common/os_alloc.c
index 93e77805f72..7f8ef0c1fb5 100644
--- a/src/third_party/wiredtiger/src/os_common/os_alloc.c
+++ b/src/third_party/wiredtiger/src/os_common/os_alloc.c
@@ -105,7 +105,7 @@ __realloc_func(WT_SESSION_IMPL *session, size_t *bytes_allocated_ret, size_t byt
bool clear_memory, void *retp)
{
size_t bytes_allocated;
- void *p;
+ void *p, *tmpp;
/*
* !!!
@@ -129,9 +129,24 @@ __realloc_func(WT_SESSION_IMPL *session, size_t *bytes_allocated_ret, size_t byt
WT_STAT_CONN_INCR(session, memory_grow);
}
- if ((p = realloc(p, bytes_to_allocate)) == NULL)
- WT_RET_MSG(session, __wt_errno(), "memory allocation of %" WT_SIZET_FMT " bytes failed",
- bytes_to_allocate);
+ /*
+ * If realloc_malloc is enabled, force a new memory allocation by using malloc, copy to the new
+ * memory, scribble over the old memory then free it.
+ */
+ tmpp = p;
+ if (session != NULL && FLD_ISSET(S2C(session)->debug_flags, WT_CONN_DEBUG_REALLOC_MALLOC) &&
+ (bytes_allocated_ret != NULL)) {
+ if ((p = malloc(bytes_to_allocate)) == NULL)
+ WT_RET_MSG(session, __wt_errno(), "memory allocation of %" WT_SIZET_FMT " bytes failed",
+ bytes_to_allocate);
+ memcpy(p, tmpp, *bytes_allocated_ret);
+ memset((uint8_t *)tmpp, WT_DEBUG_BYTE, bytes_allocated);
+ free(tmpp);
+ } else {
+ if ((p = realloc(p, bytes_to_allocate)) == NULL)
+ WT_RET_MSG(session, __wt_errno(), "memory allocation of %" WT_SIZET_FMT " bytes failed",
+ bytes_to_allocate);
+ }
/*
* Clear the allocated memory, parts of WiredTiger depend on allocated memory being cleared.
diff --git a/src/third_party/wiredtiger/test/format/config.h b/src/third_party/wiredtiger/test/format/config.h
index 17ff84d15bd..38b7adc3aac 100644
--- a/src/third_party/wiredtiger/test/format/config.h
+++ b/src/third_party/wiredtiger/test/format/config.h
@@ -61,77 +61,79 @@ typedef struct {
#define V_GLOBAL_CHECKPOINT 29
#define V_GLOBAL_CHECKPOINT_LOG_SIZE 30
#define V_GLOBAL_CHECKPOINT_WAIT 31
-#define V_TABLE_DISK_CHECKSUM 32
-#define V_GLOBAL_DISK_DATA_EXTEND 33
-#define V_GLOBAL_DISK_DIRECT_IO 34
-#define V_GLOBAL_DISK_ENCRYPTION 35
-#define V_TABLE_DISK_FIRSTFIT 36
-#define V_GLOBAL_DISK_MMAP 37
-#define V_GLOBAL_DISK_MMAP_ALL 38
-#define V_GLOBAL_FORMAT_ABORT 39
-#define V_GLOBAL_FORMAT_INDEPENDENT_THREAD_RNG 40
-#define V_GLOBAL_FORMAT_MAJOR_TIMEOUT 41
-#define V_GLOBAL_IMPORT 42
-#define V_GLOBAL_LOGGING 43
-#define V_GLOBAL_LOGGING_COMPRESSION 44
-#define V_GLOBAL_LOGGING_FILE_MAX 45
-#define V_GLOBAL_LOGGING_PREALLOC 46
-#define V_GLOBAL_LOGGING_REMOVE 47
-#define V_TABLE_LSM_AUTO_THROTTLE 48
-#define V_TABLE_LSM_BLOOM 49
-#define V_TABLE_LSM_BLOOM_BIT_COUNT 50
-#define V_TABLE_LSM_BLOOM_HASH_COUNT 51
-#define V_TABLE_LSM_BLOOM_OLDEST 52
-#define V_TABLE_LSM_CHUNK_SIZE 53
-#define V_TABLE_LSM_MERGE_MAX 54
-#define V_GLOBAL_LSM_WORKER_THREADS 55
-#define V_GLOBAL_OPS_ALTER 56
-#define V_GLOBAL_OPS_COMPACTION 57
-#define V_GLOBAL_OPS_HS_CURSOR 58
-#define V_TABLE_OPS_PCT_DELETE 59
-#define V_TABLE_OPS_PCT_INSERT 60
-#define V_TABLE_OPS_PCT_MODIFY 61
-#define V_TABLE_OPS_PCT_READ 62
-#define V_TABLE_OPS_PCT_WRITE 63
-#define V_GLOBAL_OPS_BOUND_CURSOR 64
-#define V_GLOBAL_OPS_PREPARE 65
-#define V_GLOBAL_OPS_RANDOM_CURSOR 66
-#define V_GLOBAL_OPS_SALVAGE 67
-#define V_TABLE_OPS_TRUNCATE 68
-#define V_GLOBAL_OPS_VERIFY 69
-#define V_GLOBAL_QUIET 70
-#define V_GLOBAL_RUNS_IN_MEMORY 71
-#define V_GLOBAL_RUNS_OPS 72
-#define V_TABLE_RUNS_MIRROR 73
-#define V_TABLE_RUNS_ROWS 74
-#define V_TABLE_RUNS_SOURCE 75
-#define V_GLOBAL_RUNS_TABLES 76
-#define V_GLOBAL_RUNS_THREADS 77
-#define V_GLOBAL_RUNS_TIMER 78
-#define V_TABLE_RUNS_TYPE 79
-#define V_GLOBAL_RUNS_VERIFY_FAILURE_DUMP 80
-#define V_GLOBAL_STATISTICS_SERVER 81
-#define V_GLOBAL_STRESS_AGGRESSIVE_SWEEP 82
-#define V_GLOBAL_STRESS_CHECKPOINT 83
-#define V_GLOBAL_STRESS_CHECKPOINT_EVICT_PAGE 84
-#define V_GLOBAL_STRESS_CHECKPOINT_PREPARE 85
-#define V_GLOBAL_STRESS_EVICT_REPOSITION 86
-#define V_GLOBAL_STRESS_FAILPOINT_EVICTION_FAIL_AFTER_RECONCILIATION 87
-#define V_GLOBAL_STRESS_FAILPOINT_HS_DELETE_KEY_FROM_TS 88
-#define V_GLOBAL_STRESS_HS_CHECKPOINT_DELAY 89
-#define V_GLOBAL_STRESS_HS_SEARCH 90
-#define V_GLOBAL_STRESS_HS_SWEEP 91
-#define V_GLOBAL_STRESS_SPLIT_1 92
-#define V_GLOBAL_STRESS_SPLIT_2 93
-#define V_GLOBAL_STRESS_SPLIT_3 94
-#define V_GLOBAL_STRESS_SPLIT_4 95
-#define V_GLOBAL_STRESS_SPLIT_5 96
-#define V_GLOBAL_STRESS_SPLIT_6 97
-#define V_GLOBAL_STRESS_SPLIT_7 98
-#define V_GLOBAL_TRANSACTION_IMPLICIT 99
-#define V_GLOBAL_TRANSACTION_TIMESTAMPS 100
-#define V_GLOBAL_WIREDTIGER_CONFIG 101
-#define V_GLOBAL_WIREDTIGER_RWLOCK 102
-#define V_GLOBAL_WIREDTIGER_LEAK_MEMORY 103
+#define V_GLOBAL_DEBUG_REALLOC_EXACT 32
+#define V_GLOBAL_DEBUG_REALLOC_MALLOC 33
+#define V_TABLE_DISK_CHECKSUM 34
+#define V_GLOBAL_DISK_DATA_EXTEND 35
+#define V_GLOBAL_DISK_DIRECT_IO 36
+#define V_GLOBAL_DISK_ENCRYPTION 37
+#define V_TABLE_DISK_FIRSTFIT 38
+#define V_GLOBAL_DISK_MMAP 39
+#define V_GLOBAL_DISK_MMAP_ALL 40
+#define V_GLOBAL_FORMAT_ABORT 41
+#define V_GLOBAL_FORMAT_INDEPENDENT_THREAD_RNG 42
+#define V_GLOBAL_FORMAT_MAJOR_TIMEOUT 43
+#define V_GLOBAL_IMPORT 44
+#define V_GLOBAL_LOGGING 45
+#define V_GLOBAL_LOGGING_COMPRESSION 46
+#define V_GLOBAL_LOGGING_FILE_MAX 47
+#define V_GLOBAL_LOGGING_PREALLOC 48
+#define V_GLOBAL_LOGGING_REMOVE 49
+#define V_TABLE_LSM_AUTO_THROTTLE 50
+#define V_TABLE_LSM_BLOOM 51
+#define V_TABLE_LSM_BLOOM_BIT_COUNT 52
+#define V_TABLE_LSM_BLOOM_HASH_COUNT 53
+#define V_TABLE_LSM_BLOOM_OLDEST 54
+#define V_TABLE_LSM_CHUNK_SIZE 55
+#define V_TABLE_LSM_MERGE_MAX 56
+#define V_GLOBAL_LSM_WORKER_THREADS 57
+#define V_GLOBAL_OPS_ALTER 58
+#define V_GLOBAL_OPS_COMPACTION 59
+#define V_GLOBAL_OPS_HS_CURSOR 60
+#define V_TABLE_OPS_PCT_DELETE 61
+#define V_TABLE_OPS_PCT_INSERT 62
+#define V_TABLE_OPS_PCT_MODIFY 63
+#define V_TABLE_OPS_PCT_READ 64
+#define V_TABLE_OPS_PCT_WRITE 65
+#define V_GLOBAL_OPS_BOUND_CURSOR 66
+#define V_GLOBAL_OPS_PREPARE 67
+#define V_GLOBAL_OPS_RANDOM_CURSOR 68
+#define V_GLOBAL_OPS_SALVAGE 69
+#define V_TABLE_OPS_TRUNCATE 70
+#define V_GLOBAL_OPS_VERIFY 71
+#define V_GLOBAL_QUIET 72
+#define V_GLOBAL_RUNS_IN_MEMORY 73
+#define V_GLOBAL_RUNS_OPS 74
+#define V_TABLE_RUNS_MIRROR 75
+#define V_TABLE_RUNS_ROWS 76
+#define V_TABLE_RUNS_SOURCE 77
+#define V_GLOBAL_RUNS_TABLES 78
+#define V_GLOBAL_RUNS_THREADS 79
+#define V_GLOBAL_RUNS_TIMER 80
+#define V_TABLE_RUNS_TYPE 81
+#define V_GLOBAL_RUNS_VERIFY_FAILURE_DUMP 82
+#define V_GLOBAL_STATISTICS_SERVER 83
+#define V_GLOBAL_STRESS_AGGRESSIVE_SWEEP 84
+#define V_GLOBAL_STRESS_CHECKPOINT 85
+#define V_GLOBAL_STRESS_CHECKPOINT_EVICT_PAGE 86
+#define V_GLOBAL_STRESS_CHECKPOINT_PREPARE 87
+#define V_GLOBAL_STRESS_EVICT_REPOSITION 88
+#define V_GLOBAL_STRESS_FAILPOINT_EVICTION_FAIL_AFTER_RECONCILIATION 89
+#define V_GLOBAL_STRESS_FAILPOINT_HS_DELETE_KEY_FROM_TS 90
+#define V_GLOBAL_STRESS_HS_CHECKPOINT_DELAY 91
+#define V_GLOBAL_STRESS_HS_SEARCH 92
+#define V_GLOBAL_STRESS_HS_SWEEP 93
+#define V_GLOBAL_STRESS_SPLIT_1 94
+#define V_GLOBAL_STRESS_SPLIT_2 95
+#define V_GLOBAL_STRESS_SPLIT_3 96
+#define V_GLOBAL_STRESS_SPLIT_4 97
+#define V_GLOBAL_STRESS_SPLIT_5 98
+#define V_GLOBAL_STRESS_SPLIT_6 99
+#define V_GLOBAL_STRESS_SPLIT_7 100
+#define V_GLOBAL_TRANSACTION_IMPLICIT 101
+#define V_GLOBAL_TRANSACTION_TIMESTAMPS 102
+#define V_GLOBAL_WIREDTIGER_CONFIG 103
+#define V_GLOBAL_WIREDTIGER_RWLOCK 104
+#define V_GLOBAL_WIREDTIGER_LEAK_MEMORY 105
-#define V_ELEMENT_COUNT 104
+#define V_ELEMENT_COUNT 106
diff --git a/src/third_party/wiredtiger/test/format/config.sh b/src/third_party/wiredtiger/test/format/config.sh
index a79144512a8..4d6622a9060 100755
--- a/src/third_party/wiredtiger/test/format/config.sh
+++ b/src/third_party/wiredtiger/test/format/config.sh
@@ -135,6 +135,10 @@ CONFIG configuration_list[] = {
{"checkpoint.wait", "seconds to wait if wiredtiger checkpoints configured", 0x0, 5, 100, 3600}
+{"debug.realloc_exact", "reallocation of memory will only provide the exact amount requested", C_BOOL, 0, 0, 0}
+
+{"debug.realloc_malloc", "every realloc call will force a new memory allocation by using malloc", C_BOOL, 5, 0, 0}
+
{"disk.checksum", "checksum type (on | off | uncompressed | unencrypted)", C_IGNORE | C_STRING | C_TABLE, 0, 0, 0}
{"disk.data_extend", "configure data file extension", C_BOOL, 5, 0, 0}
diff --git a/src/third_party/wiredtiger/test/format/config_def.c b/src/third_party/wiredtiger/test/format/config_def.c
index 2d94c4538fd..539ba902299 100644
--- a/src/third_party/wiredtiger/test/format/config_def.c
+++ b/src/third_party/wiredtiger/test/format/config_def.c
@@ -99,6 +99,12 @@ CONFIG configuration_list[] = {
{"checkpoint.wait", "seconds to wait if wiredtiger checkpoints configured",
0x0, 5, 100, 3600, V_GLOBAL_CHECKPOINT_WAIT},
+ {"debug.realloc_exact", "reallocation of memory will only provide the exact amount requested",
+ C_BOOL, 0, 0, 0, V_GLOBAL_DEBUG_REALLOC_EXACT},
+
+ {"debug.realloc_malloc", "every realloc call will force a new memory allocation by using malloc",
+ C_BOOL, 5, 0, 0, V_GLOBAL_DEBUG_REALLOC_MALLOC},
+
{"disk.checksum", "checksum type (on | off | uncompressed | unencrypted)",
C_IGNORE | C_STRING | C_TABLE, 0, 0, 0, V_TABLE_DISK_CHECKSUM},
diff --git a/src/third_party/wiredtiger/test/format/wts.c b/src/third_party/wiredtiger/test/format/wts.c
index ec2e53eccbb..27ca5e0ca3b 100644
--- a/src/third_party/wiredtiger/test/format/wts.c
+++ b/src/third_party/wiredtiger/test/format/wts.c
@@ -273,6 +273,17 @@ create_database(const char *home, WT_CONNECTION **connp)
if (GV(DISK_DATA_EXTEND))
CONFIG_APPEND(p, ",file_extend=(data=8MB)");
+ if (GV(DEBUG_REALLOC_EXACT))
+ CONFIG_APPEND(p, ",debug_mode=(realloc_exact=true)");
+
+ /* Configure realloc malloc debug mode. */
+ if (GV(DEBUG_REALLOC_MALLOC)) {
+ if (mmrand(NULL, 0, 1) == 1)
+ CONFIG_APPEND(p, ",debug_mode=(realloc_exact=true,realloc_malloc=true)");
+ else
+ CONFIG_APPEND(p, ",debug_mode=(realloc_malloc=true)");
+ }
+
/*
* Run the statistics server and/or maintain statistics in the engine. Sometimes specify a set
* of sources just to exercise that code.
diff --git a/src/third_party/wiredtiger/test/suite/test_debug_mode10.py b/src/third_party/wiredtiger/test/suite/test_debug_mode10.py
new file mode 100644
index 00000000000..4c34aa41816
--- /dev/null
+++ b/src/third_party/wiredtiger/test/suite/test_debug_mode10.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-present MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+#
+# This is free and unencumbered software released into the public domain.
+#
+# Anyone is free to copy, modify, publish, use, compile, sell, or
+# distribute this software, either in source code form or as a compiled
+# binary, for any purpose, commercial or non-commercial, and by any
+# means.
+#
+# In jurisdictions that recognize copyright laws, the author or authors
+# of this software dedicate any and all copyright interest in the
+# software to the public domain. We make this dedication for the benefit
+# of the public at large and to the detriment of our heirs and
+# successors. We intend this dedication to be an overt act of
+# relinquishment in perpetuity of all present and future rights to this
+# software under copyright law.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+import wttest
+
+# test_debug_mode10.py
+# Test the debug mode settings. Test realloc_malloc use.
+class test_debug_mode10(wttest.WiredTigerTestCase):
+ conn_config = 'debug_mode=(realloc_malloc=true)'
+ uri = 'file:test_debug_mode10'
+
+ # Insert some data to ensure setting/unsetting the flag does not
+ # break existing functionality. Also call checkpoint because it
+ # causes the realloc function to be called numerous times.
+ def insert_data(self):
+ self.session.create(self.uri, 'key_format=s,value_format=s')
+ self.cursor = self.session.open_cursor(self.uri, None)
+ self.cursor['key'] = 'value'
+ self.cursor.close()
+ self.session.checkpoint()
+
+ # Make flag works when set.
+ def test_realloc_exact(self):
+ self.insert_data()
+
+ # Make sure the flag can be 'turned off' as well.
+ def test_realloc_exact_off(self):
+ conn_reconfig = 'debug_mode=(realloc_malloc=false)'
+ self.conn.reconfigure(conn_reconfig)
+ self.insert_data()
+
+if __name__ == '__main__':
+ wttest.run()