summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pearson <luke.pearson@mongodb.com>2023-05-02 14:07:35 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-02 04:57:17 +0000
commit49e521352a4aea1ee5b5bb5132de9b6e3fccf405 (patch)
treea5dc7c20cbce74efbd3f6cee7e780f05ede27aaf
parent85f9d6ae24d6dc491a5f7ea84054931a83f2781e (diff)
downloadmongo-49e521352a4aea1ee5b5bb5132de9b6e3fccf405.tar.gz
Import wiredtiger: 7848b4373b108ee4d9ec60630769def2439dba92 from branch mongodb-master
ref: f77c5af3eb..7848b4373b for: 7.1.0-rc0 WT-10655 Add configuration setting to manage cache stuck timeout
-rw-r--r--src/third_party/wiredtiger/dist/api_data.py4
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/config/config_def.c130
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_cache.c4
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_lru.c40
-rw-r--r--src/third_party/wiredtiger/src/include/cache.h7
-rw-r--r--src/third_party/wiredtiger/src/include/wiredtiger.in6
7 files changed, 109 insertions, 84 deletions
diff --git a/src/third_party/wiredtiger/dist/api_data.py b/src/third_party/wiredtiger/dist/api_data.py
index 1981eb20e63..cb2e594b1a7 100644
--- a/src/third_party/wiredtiger/dist/api_data.py
+++ b/src/third_party/wiredtiger/dist/api_data.py
@@ -523,6 +523,10 @@ connection_runtime_config = [
the maximum number of milliseconds an application thread will wait for space to be
available in cache before giving up. Default will wait forever''',
min=0),
+ Config('cache_stuck_timeout_ms', '300000', r'''
+ the number of milliseconds to wait before a stuck cache times out in diagnostic mode.
+ Default will wait for 5 minutes, 0 will wait forever''',
+ min=0),
Config('cache_overhead', '8', r'''
assume the heap allocator overhead is the specified percentage, and adjust the cache
usage by that amount (for example, if there is 10GB of data in cache, a percentage of
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index a1999c53ac0..132ef2e008b 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": "f77c5af3ebf80456d50bc8b4adec5fa1874d9f9a"
+ "commit": "7848b4373b108ee4d9ec60630769def2439dba92"
}
diff --git a/src/third_party/wiredtiger/src/config/config_def.c b/src/third_party/wiredtiger/src/config/config_def.c
index 41fee870d3c..b09ac4a2856 100644
--- a/src/third_party/wiredtiger/src/config/config_def.c
+++ b/src/third_party/wiredtiger/src/config/config_def.c
@@ -130,6 +130,7 @@ static const WT_CONFIG_CHECK confchk_WT_CONNECTION_reconfigure[] = {
{"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0},
{"cache_overhead", "int", NULL, "min=0,max=30", NULL, 0},
{"cache_size", "int", NULL, "min=1MB,max=10TB", NULL, 0},
+ {"cache_stuck_timeout_ms", "int", NULL, "min=0", NULL, 0},
{"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2},
{"chunk_cache", "category", NULL, NULL, confchk_wiredtiger_open_chunk_cache_subconfigs, 7},
{"compatibility", "category", NULL, NULL,
@@ -882,6 +883,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open[] = {
{"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0},
{"cache_overhead", "int", NULL, "min=0,max=30", NULL, 0},
{"cache_size", "int", NULL, "min=1MB,max=10TB", NULL, 0},
+ {"cache_stuck_timeout_ms", "int", NULL, "min=0", NULL, 0},
{"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2},
{"checkpoint_sync", "boolean", NULL, NULL, NULL, 0},
{"chunk_cache", "category", NULL, NULL, confchk_wiredtiger_open_chunk_cache_subconfigs, 7},
@@ -975,6 +977,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_all[] = {
{"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0},
{"cache_overhead", "int", NULL, "min=0,max=30", NULL, 0},
{"cache_size", "int", NULL, "min=1MB,max=10TB", NULL, 0},
+ {"cache_stuck_timeout_ms", "int", NULL, "min=0", NULL, 0},
{"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2},
{"checkpoint_sync", "boolean", NULL, NULL, NULL, 0},
{"chunk_cache", "category", NULL, NULL, confchk_wiredtiger_open_chunk_cache_subconfigs, 7},
@@ -1068,6 +1071,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_basecfg[] = {
{"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0},
{"cache_overhead", "int", NULL, "min=0,max=30", NULL, 0},
{"cache_size", "int", NULL, "min=1MB,max=10TB", NULL, 0},
+ {"cache_stuck_timeout_ms", "int", NULL, "min=0", NULL, 0},
{"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2},
{"checkpoint_sync", "boolean", NULL, NULL, NULL, 0},
{"chunk_cache", "category", NULL, NULL, confchk_wiredtiger_open_chunk_cache_subconfigs, 7},
@@ -1157,6 +1161,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_usercfg[] = {
{"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0},
{"cache_overhead", "int", NULL, "min=0,max=30", NULL, 0},
{"cache_size", "int", NULL, "min=1MB,max=10TB", NULL, 0},
+ {"cache_stuck_timeout_ms", "int", NULL, "min=0", NULL, 0},
{"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2},
{"checkpoint_sync", "boolean", NULL, NULL, NULL, 0},
{"chunk_cache", "category", NULL, NULL, confchk_wiredtiger_open_chunk_cache_subconfigs, 7},
@@ -1263,14 +1268,15 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"full_target=95,hashsize=32768,max_percent_overhead=10,"
"nvram_path=,percent_file_in_dram=50,size=0,system_ram=0,type=),"
"cache_max_wait_ms=0,cache_overhead=8,cache_size=100MB,"
- "checkpoint=(log_size=0,wait=0),chunk_cache=(capacity=10GB,"
- "chunk_cache_evict_trigger=90,chunk_size=1MB,device_path=,"
- "enabled=false,hashsize=1024,type=),compatibility=(release=),"
- "debug_mode=(checkpoint_retention=0,corruption_abort=true,"
- "cursor_copy=false,cursor_reposition=false,eviction=false,"
- "log_retention=0,realloc_exact=false,realloc_malloc=false,"
- "rollback_error=0,slow_checkpoint=false,stress_skiplist=false,"
- "table_logging=false,update_restore_evict=false),error_prefix=,"
+ "cache_stuck_timeout_ms=300000,checkpoint=(log_size=0,wait=0),"
+ "chunk_cache=(capacity=10GB,chunk_cache_evict_trigger=90,"
+ "chunk_size=1MB,device_path=,enabled=false,hashsize=1024,type=),"
+ "compatibility=(release=),debug_mode=(checkpoint_retention=0,"
+ "corruption_abort=true,cursor_copy=false,cursor_reposition=false,"
+ "eviction=false,log_retention=0,realloc_exact=false,"
+ "realloc_malloc=false,rollback_error=0,slow_checkpoint=false,"
+ "stress_skiplist=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,"
"eviction_dirty_trigger=20,eviction_target=80,eviction_trigger=95"
@@ -1286,7 +1292,7 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"on_close=false,sources=,timestamp=\"%b %d %H:%M:%S\",wait=0),"
"tiered_storage=(local_retention=300),timing_stress_for_test=,"
"verbose=[]",
- confchk_WT_CONNECTION_reconfigure, 32},
+ confchk_WT_CONNECTION_reconfigure, 33},
{"WT_CONNECTION.rollback_to_stable", "dryrun=false", confchk_WT_CONNECTION_rollback_to_stable, 1},
{"WT_CONNECTION.set_file_system", "", NULL, 0},
{"WT_CONNECTION.set_timestamp",
@@ -1549,18 +1555,19 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"nvram_path=,percent_file_in_dram=50,size=0,system_ram=0,type=),"
"buffer_alignment=-1,builtin_extension_config=,cache_cursors=true"
",cache_max_wait_ms=0,cache_overhead=8,cache_size=100MB,"
- "checkpoint=(log_size=0,wait=0),checkpoint_sync=true,"
- "chunk_cache=(capacity=10GB,chunk_cache_evict_trigger=90,"
- "chunk_size=1MB,device_path=,enabled=false,hashsize=1024,type=),"
- "compatibility=(release=,require_max=,require_min=),"
- "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,"
- "realloc_malloc=false,rollback_error=0,slow_checkpoint=false,"
- "stress_skiplist=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,"
+ "cache_stuck_timeout_ms=300000,checkpoint=(log_size=0,wait=0),"
+ "checkpoint_sync=true,chunk_cache=(capacity=10GB,"
+ "chunk_cache_evict_trigger=90,chunk_size=1MB,device_path=,"
+ "enabled=false,hashsize=1024,type=),compatibility=(release=,"
+ "require_max=,require_min=),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,realloc_malloc=false,"
+ "rollback_error=0,slow_checkpoint=false,stress_skiplist=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=,extra_diagnostics=[],file_extend=,"
@@ -1584,7 +1591,7 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"transaction_sync=(enabled=false,method=fsync),"
"use_environment=true,use_environment_priv=false,verbose=[],"
"verify_metadata=false,write_through=",
- confchk_wiredtiger_open, 60},
+ confchk_wiredtiger_open, 61},
{"wiredtiger_open_all",
"backup_restore_target=,"
"block_cache=(blkcache_eviction_aggression=1800,"
@@ -1593,18 +1600,19 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"nvram_path=,percent_file_in_dram=50,size=0,system_ram=0,type=),"
"buffer_alignment=-1,builtin_extension_config=,cache_cursors=true"
",cache_max_wait_ms=0,cache_overhead=8,cache_size=100MB,"
- "checkpoint=(log_size=0,wait=0),checkpoint_sync=true,"
- "chunk_cache=(capacity=10GB,chunk_cache_evict_trigger=90,"
- "chunk_size=1MB,device_path=,enabled=false,hashsize=1024,type=),"
- "compatibility=(release=,require_max=,require_min=),"
- "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,"
- "realloc_malloc=false,rollback_error=0,slow_checkpoint=false,"
- "stress_skiplist=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,"
+ "cache_stuck_timeout_ms=300000,checkpoint=(log_size=0,wait=0),"
+ "checkpoint_sync=true,chunk_cache=(capacity=10GB,"
+ "chunk_cache_evict_trigger=90,chunk_size=1MB,device_path=,"
+ "enabled=false,hashsize=1024,type=),compatibility=(release=,"
+ "require_max=,require_min=),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,realloc_malloc=false,"
+ "rollback_error=0,slow_checkpoint=false,stress_skiplist=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=,extra_diagnostics=[],file_extend=,"
@@ -1628,7 +1636,7 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"transaction_sync=(enabled=false,method=fsync),"
"use_environment=true,use_environment_priv=false,verbose=[],"
"verify_metadata=false,version=(major=0,minor=0),write_through=",
- confchk_wiredtiger_open_all, 61},
+ confchk_wiredtiger_open_all, 62},
{"wiredtiger_open_basecfg",
"backup_restore_target=,"
"block_cache=(blkcache_eviction_aggression=1800,"
@@ -1637,18 +1645,18 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"nvram_path=,percent_file_in_dram=50,size=0,system_ram=0,type=),"
"buffer_alignment=-1,builtin_extension_config=,cache_cursors=true"
",cache_max_wait_ms=0,cache_overhead=8,cache_size=100MB,"
- "checkpoint=(log_size=0,wait=0),checkpoint_sync=true,"
- "chunk_cache=(capacity=10GB,chunk_cache_evict_trigger=90,"
- "chunk_size=1MB,device_path=,enabled=false,hashsize=1024,type=),"
- "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,realloc_malloc=false,"
- "rollback_error=0,slow_checkpoint=false,stress_skiplist=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,"
+ "cache_stuck_timeout_ms=300000,checkpoint=(log_size=0,wait=0),"
+ "checkpoint_sync=true,chunk_cache=(capacity=10GB,"
+ "chunk_cache_evict_trigger=90,chunk_size=1MB,device_path=,"
+ "enabled=false,hashsize=1024,type=),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,"
+ "realloc_malloc=false,rollback_error=0,slow_checkpoint=false,"
+ "stress_skiplist=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,"
"extensions=,extra_diagnostics=[],file_extend=,"
@@ -1670,7 +1678,7 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"shared=false),timing_stress_for_test=,"
"transaction_sync=(enabled=false,method=fsync),verbose=[],"
"verify_metadata=false,version=(major=0,minor=0),write_through=",
- confchk_wiredtiger_open_basecfg, 55},
+ confchk_wiredtiger_open_basecfg, 56},
{"wiredtiger_open_usercfg",
"backup_restore_target=,"
"block_cache=(blkcache_eviction_aggression=1800,"
@@ -1679,18 +1687,18 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"nvram_path=,percent_file_in_dram=50,size=0,system_ram=0,type=),"
"buffer_alignment=-1,builtin_extension_config=,cache_cursors=true"
",cache_max_wait_ms=0,cache_overhead=8,cache_size=100MB,"
- "checkpoint=(log_size=0,wait=0),checkpoint_sync=true,"
- "chunk_cache=(capacity=10GB,chunk_cache_evict_trigger=90,"
- "chunk_size=1MB,device_path=,enabled=false,hashsize=1024,type=),"
- "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,realloc_malloc=false,"
- "rollback_error=0,slow_checkpoint=false,stress_skiplist=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,"
+ "cache_stuck_timeout_ms=300000,checkpoint=(log_size=0,wait=0),"
+ "checkpoint_sync=true,chunk_cache=(capacity=10GB,"
+ "chunk_cache_evict_trigger=90,chunk_size=1MB,device_path=,"
+ "enabled=false,hashsize=1024,type=),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,"
+ "realloc_malloc=false,rollback_error=0,slow_checkpoint=false,"
+ "stress_skiplist=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,"
"extensions=,extra_diagnostics=[],file_extend=,"
@@ -1712,7 +1720,7 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator",
"shared=false),timing_stress_for_test=,"
"transaction_sync=(enabled=false,method=fsync),verbose=[],"
"verify_metadata=false,write_through=",
- confchk_wiredtiger_open_usercfg, 54},
+ confchk_wiredtiger_open_usercfg, 55},
{NULL, NULL, NULL, 0}};
int
diff --git a/src/third_party/wiredtiger/src/conn/conn_cache.c b/src/third_party/wiredtiger/src/conn/conn_cache.c
index 34de9b72ae5..1f3d5cba1f5 100644
--- a/src/third_party/wiredtiger/src/conn/conn_cache.c
+++ b/src/third_party/wiredtiger/src/conn/conn_cache.c
@@ -155,6 +155,10 @@ __cache_config_local(WT_SESSION_IMPL *session, bool shared, const char *cfg[])
WT_RET(__wt_config_gets(session, cfg, "cache_max_wait_ms", &cval));
cache->cache_max_wait_us = (uint64_t)(cval.val * WT_THOUSAND);
+ /* Retrieve the timeout value and convert from seconds */
+ WT_RET(__wt_config_gets(session, cfg, "cache_stuck_timeout_ms", &cval));
+ cache->cache_stuck_timeout_ms = (uint64_t)cval.val;
+
return (0);
}
diff --git a/src/third_party/wiredtiger/src/evict/evict_lru.c b/src/third_party/wiredtiger/src/evict/evict_lru.c
index 297d157b1e7..380e1a642d2 100644
--- a/src/third_party/wiredtiger/src/evict/evict_lru.c
+++ b/src/third_party/wiredtiger/src/evict/evict_lru.c
@@ -470,33 +470,35 @@ __evict_server(WT_SESSION_IMPL *session, bool *did_work)
__wt_epoch(session, &now);
-#define WT_CACHE_STUCK_TIMEOUT_MS (300 * WT_THOUSAND)
- time_diff_ms = WT_TIMEDIFF_MS(now, cache->stuck_time);
-
+ /* The checks below should only be executed when a cache timeout has been set. */
+ if (cache->cache_stuck_timeout_ms > 0) {
+ time_diff_ms = WT_TIMEDIFF_MS(now, cache->stuck_time);
#ifdef HAVE_DIAGNOSTIC
- /* Enable extra logs 20ms before timing out. */
- if (time_diff_ms > WT_CACHE_STUCK_TIMEOUT_MS - 20) {
- WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICT, WT_VERBOSE_DEBUG_1);
- WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICTSERVER, WT_VERBOSE_DEBUG_1);
- WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICT_STUCK, WT_VERBOSE_DEBUG_1);
- }
+ /* Enable extra logs 20ms before timing out. */
+ if (cache->cache_stuck_timeout_ms < 20 ||
+ (time_diff_ms > cache->cache_stuck_timeout_ms - 20)) {
+ WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICT, WT_VERBOSE_DEBUG_1);
+ WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICTSERVER, WT_VERBOSE_DEBUG_1);
+ WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICT_STUCK, WT_VERBOSE_DEBUG_1);
+ }
#endif
- if (time_diff_ms > WT_CACHE_STUCK_TIMEOUT_MS) {
+ if (time_diff_ms >= cache->cache_stuck_timeout_ms) {
#ifdef HAVE_DIAGNOSTIC
- __wt_err(session, ETIMEDOUT, "Cache stuck for too long, giving up");
- WT_RET(__wt_verbose_dump_txn(session));
- WT_RET(__wt_verbose_dump_cache(session));
- return (__wt_set_return(session, ETIMEDOUT));
-#else
- if (WT_VERBOSE_ISSET(session, WT_VERB_EVICT_STUCK)) {
+ __wt_err(session, ETIMEDOUT, "Cache stuck for too long, giving up");
WT_RET(__wt_verbose_dump_txn(session));
WT_RET(__wt_verbose_dump_cache(session));
+ return (__wt_set_return(session, ETIMEDOUT));
+#else
+ if (WT_VERBOSE_ISSET(session, WT_VERB_EVICT_STUCK)) {
+ WT_RET(__wt_verbose_dump_txn(session));
+ WT_RET(__wt_verbose_dump_cache(session));
- /* Reset the timer. */
- __wt_epoch(session, &cache->stuck_time);
- }
+ /* Reset the timer. */
+ __wt_epoch(session, &cache->stuck_time);
+ }
#endif
+ }
}
return (0);
}
diff --git a/src/third_party/wiredtiger/src/include/cache.h b/src/third_party/wiredtiger/src/include/cache.h
index a1eefce9dbf..03fda6f9d71 100644
--- a/src/third_party/wiredtiger/src/include/cache.h
+++ b/src/third_party/wiredtiger/src/include/cache.h
@@ -130,9 +130,10 @@ struct __wt_cache {
to during checkpoint scrubs */
double eviction_scrub_target; /* Current scrub target */
- u_int overhead_pct; /* Cache percent adjustment */
- uint64_t cache_max_wait_us; /* Maximum time an operation waits for
- * space in cache */
+ u_int overhead_pct; /* Cache percent adjustment */
+ uint64_t cache_max_wait_us; /* Maximum time an operation waits for space in cache */
+ uint64_t cache_stuck_timeout_ms; /* Maximum time the cache can be stuck for in diagnostic mode
+ before timing out */
/*
* Eviction thread tuning information.
diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in
index 6bc5a215a44..09dc6909694 100644
--- a/src/third_party/wiredtiger/src/include/wiredtiger.in
+++ b/src/third_party/wiredtiger/src/include/wiredtiger.in
@@ -2189,6 +2189,9 @@ struct __wt_connection {
* @config{cache_size, maximum heap memory to allocate for the cache. A database should
* configure either \c cache_size or \c shared_cache but not both., an integer between \c 1MB
* and \c 10TB; default \c 100MB.}
+ * @config{cache_stuck_timeout_ms, the number of milliseconds to wait before a stuck cache times
+ * out in diagnostic mode. Default will wait for 5 minutes\, 0 will wait forever., an integer
+ * greater than or equal to \c 0; default \c 300000.}
* @config{checkpoint = (, periodically checkpoint the database. Enabling the checkpoint server
* uses a session from the configured \c session_max., a set of related configuration options
* defined as follows.}
@@ -2933,6 +2936,9 @@ struct __wt_connection {
* @config{cache_size, maximum heap memory to allocate for the cache. A database should configure
* either \c cache_size or \c shared_cache but not both., an integer between \c 1MB and \c 10TB;
* default \c 100MB.}
+ * @config{cache_stuck_timeout_ms, the number of milliseconds to wait before a stuck cache times out
+ * in diagnostic mode. Default will wait for 5 minutes\, 0 will wait forever., an integer greater
+ * than or equal to \c 0; default \c 300000.}
* @config{checkpoint = (, periodically checkpoint the database. Enabling the checkpoint server
* uses a session from the configured \c session_max., a set of related configuration options
* defined as follows.}