diff options
author | Will Korteland <will.korteland@mongodb.com> | 2022-10-20 02:11:17 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-20 02:43:27 +0000 |
commit | 31311d7a82198e1dd5c73e8a5ebaf8d32c1b2c64 (patch) | |
tree | fbdff1c76164aad28288985f649162d6a3ee8fa2 /src/third_party/wiredtiger | |
parent | 8a0aabdf03cdb69f14375f109d6b49da21bbeee2 (diff) | |
download | mongo-31311d7a82198e1dd5c73e8a5ebaf8d32c1b2c64.tar.gz |
Import wiredtiger: 9540e4553ce3ac24d28a1b9021fa06c4b06221be from branch mongodb-master
ref: 05c20a5d82..9540e4553c
for: 6.2.0-rc0
WT-9922 Add more debug log levels (#8384)
Diffstat (limited to 'src/third_party/wiredtiger')
15 files changed, 239 insertions, 44 deletions
diff --git a/src/third_party/wiredtiger/dist/s_define.list b/src/third_party/wiredtiger/dist/s_define.list index d79519f70ec..4040226b9ce 100644 --- a/src/third_party/wiredtiger/dist/s_define.list +++ b/src/third_party/wiredtiger/dist/s_define.list @@ -90,6 +90,7 @@ WT_TXN_UPDATE WT_UPDATE_SIZE WT_USE_OPENAT WT_VERBOSE_CATEGORY_DEFAULT +WT_VERBOSE_DEBUG WT_VERBOSE_LEVEL_DEFAULT WT_WITH_LOCK_NOWAIT WT_WITH_LOCK_WAIT diff --git a/src/third_party/wiredtiger/ext/storage_sources/s3_store/s3_log_system.h b/src/third_party/wiredtiger/ext/storage_sources/s3_store/s3_log_system.h index 5542b1b3bc9..3e6b2c42e21 100644 --- a/src/third_party/wiredtiger/ext/storage_sources/s3_store/s3_log_system.h +++ b/src/third_party/wiredtiger/ext/storage_sources/s3_store/s3_log_system.h @@ -43,7 +43,11 @@ static const std::map<int32_t, Aws::Utils::Logging::LogLevel> verbosityMapping = {WT_VERBOSE_WARNING, Aws::Utils::Logging::LogLevel::Error}, {WT_VERBOSE_WARNING, Aws::Utils::Logging::LogLevel::Warn}, {WT_VERBOSE_INFO, Aws::Utils::Logging::LogLevel::Info}, - {WT_VERBOSE_DEBUG, Aws::Utils::Logging::LogLevel::Debug}}; + {WT_VERBOSE_DEBUG_1, Aws::Utils::Logging::LogLevel::Debug}, + {WT_VERBOSE_DEBUG_2, Aws::Utils::Logging::LogLevel::Debug}, + {WT_VERBOSE_DEBUG_3, Aws::Utils::Logging::LogLevel::Debug}, + {WT_VERBOSE_DEBUG_4, Aws::Utils::Logging::LogLevel::Debug}, + {WT_VERBOSE_DEBUG_5, Aws::Utils::Logging::LogLevel::Trace}}; // Provides the S3 Store with a logger implementation that redirects the generated logs to // WiredTiger's logging streams. This class implements AWS's LogSystemInterface class, an interface @@ -73,7 +77,7 @@ class S3LogSystem : public Aws::Utils::Logging::LogSystemInterface { void LogDebugMessage(const std::string &message) const { - LogVerboseMessage(WT_VERBOSE_DEBUG, message); + LogVerboseMessage(WT_VERBOSE_DEBUG_1, message); } // Sets the WiredTiger Extension's verbosity level and matches the AWS log levels diff --git a/src/third_party/wiredtiger/ext/storage_sources/s3_store/s3_storage_source.cpp b/src/third_party/wiredtiger/ext/storage_sources/s3_store/s3_storage_source.cpp index 4b66197845a..4010c5bcf99 100644 --- a/src/third_party/wiredtiger/ext/storage_sources/s3_store/s3_storage_source.cpp +++ b/src/third_party/wiredtiger/ext/storage_sources/s3_store/s3_storage_source.cpp @@ -869,7 +869,7 @@ wiredtiger_extension_init(WT_CONNECTION *connection, WT_CONFIG_ARG *config) s3->verbose = WT_VERBOSE_ERROR; s3->log = Aws::MakeShared<S3LogSystem>("storage", s3->wtApi, s3->verbose); - if (ret == 0 && v.val >= WT_VERBOSE_ERROR && v.val <= WT_VERBOSE_DEBUG) { + if (ret == 0 && v.val >= WT_VERBOSE_ERROR && v.val <= WT_VERBOSE_DEBUG_5) { s3->verbose = v.val; s3->log->SetWtVerbosityLevel(s3->verbose); } else if (ret != WT_NOTFOUND) { diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 595cc3ed768..862c40d8b76 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": "05c20a5d821233f2e646a76610f92f09068fff92" + "commit": "9540e4553ce3ac24d28a1b9021fa06c4b06221be" } diff --git a/src/third_party/wiredtiger/src/block/block_compact.c b/src/third_party/wiredtiger/src/block/block_compact.c index 098832cbfb6..a033e5cefa8 100644 --- a/src/third_party/wiredtiger/src/block/block_compact.c +++ b/src/third_party/wiredtiger/src/block/block_compact.c @@ -42,7 +42,7 @@ __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block) __wt_block_configure_first_fit(block, false); /* Dump the results of the compaction pass. */ - if (WT_VERBOSE_LEVEL_ISSET(session, WT_VERB_COMPACT, WT_VERBOSE_DEBUG)) { + if (WT_VERBOSE_LEVEL_ISSET(session, WT_VERB_COMPACT, WT_VERBOSE_DEBUG_1)) { __wt_spin_lock(session, &block->live_lock); __block_dump_file_stat(session, block, false); __wt_spin_unlock(session, &block->live_lock); @@ -77,7 +77,7 @@ __wt_block_compact_progress(WT_SESSION_IMPL *session, WT_BLOCK *block, u_int *ms struct timespec cur_time; uint64_t time_diff; - if (!WT_VERBOSE_LEVEL_ISSET(session, WT_VERB_COMPACT_PROGRESS, WT_VERBOSE_DEBUG)) + if (!WT_VERBOSE_LEVEL_ISSET(session, WT_VERB_COMPACT_PROGRESS, WT_VERBOSE_DEBUG_1)) return; __wt_epoch(session, &cur_time); @@ -121,7 +121,7 @@ __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp) __wt_spin_lock(session, &block->live_lock); /* Dump the current state of the file. */ - if (WT_VERBOSE_LEVEL_ISSET(session, WT_VERB_COMPACT, WT_VERBOSE_DEBUG)) + if (WT_VERBOSE_LEVEL_ISSET(session, WT_VERB_COMPACT, WT_VERBOSE_DEBUG_1)) __block_dump_file_stat(session, block, true); /* Sum the available bytes in the initial 80% and 90% of the file. */ diff --git a/src/third_party/wiredtiger/src/block/block_ext.c b/src/third_party/wiredtiger/src/block/block_ext.c index a4451ea00e0..17357c21958 100644 --- a/src/third_party/wiredtiger/src/block/block_ext.c +++ b/src/third_party/wiredtiger/src/block/block_ext.c @@ -1353,7 +1353,7 @@ __block_extlist_dump(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST *el, if (block->verify_layout) level = WT_VERBOSE_NOTICE; else - level = WT_VERBOSE_DEBUG; + level = WT_VERBOSE_DEBUG_1; __wt_verbose_level(session, WT_VERB_BLOCK, level, "%s extent list %s, %" PRIu32 " entries, %s bytes", tag, el->name, el->entries, __wt_buf_set_size(session, el->bytes, true, t1)); diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c index 1282c4ced1d..3862e4b59de 100644 --- a/src/third_party/wiredtiger/src/conn/conn_api.c +++ b/src/third_party/wiredtiger/src/conn/conn_api.c @@ -2141,13 +2141,13 @@ __wt_verbose_config(WT_SESSION_IMPL *session, const char *cfg[], bool reconfig) else if (sval.type == WT_CONFIG_ITEM_BOOL && sval.len == 0) /* * If no value is associated with the event (i.e passing verbose=[checkpoint]), default - * the event to WT_VERBOSE_DEBUG. Correspondingly, all legacy uses of '__wt_verbose', + * the event to WT_VERBOSE_DEBUG_1. Correspondingly, all legacy uses of '__wt_verbose', * being messages without an explicit verbosity level, will default to - * 'WT_VERBOSE_DEBUG'. + * 'WT_VERBOSE_DEBUG_1'. */ - conn->verbose[ft->flag] = WT_VERBOSE_DEBUG; + conn->verbose[ft->flag] = WT_VERBOSE_DEBUG_1; else if (sval.type == WT_CONFIG_ITEM_NUM && sval.val >= WT_VERBOSE_INFO && - sval.val <= WT_VERBOSE_DEBUG) + sval.val <= WT_VERBOSE_DEBUG_5) conn->verbose[ft->flag] = (WT_VERBOSE_LEVEL)sval.val; else /* diff --git a/src/third_party/wiredtiger/src/evict/evict_lru.c b/src/third_party/wiredtiger/src/evict/evict_lru.c index fd76f2b5aa1..63fa232bd39 100644 --- a/src/third_party/wiredtiger/src/evict/evict_lru.c +++ b/src/third_party/wiredtiger/src/evict/evict_lru.c @@ -461,9 +461,9 @@ __evict_server(WT_SESSION_IMPL *session, bool *did_work) #ifdef HAVE_DIAGNOSTIC /* Enable extra logs 20ms before timing out. */ if (!verbose_timeout_flags && time_diff_ms > WT_CACHE_STUCK_TIMEOUT_MS - 20) { - WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICT, WT_VERBOSE_DEBUG); - WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICTSERVER, WT_VERBOSE_DEBUG); - WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICT_STUCK, WT_VERBOSE_DEBUG); + 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); verbose_timeout_flags = true; } #endif diff --git a/src/third_party/wiredtiger/src/include/txn_inline.h b/src/third_party/wiredtiger/src/include/txn_inline.h index 44514ce410f..7c50afbc84f 100644 --- a/src/third_party/wiredtiger/src/include/txn_inline.h +++ b/src/third_party/wiredtiger/src/include/txn_inline.h @@ -1480,7 +1480,7 @@ __wt_txn_modify_block( if (rollback) { /* Dump information about the txn snapshot. */ - if (WT_VERBOSE_LEVEL_ISSET(session, WT_VERB_TRANSACTION, WT_VERBOSE_DEBUG)) { + if (WT_VERBOSE_LEVEL_ISSET(session, WT_VERB_TRANSACTION, WT_VERBOSE_DEBUG_1)) { WT_ERR(__wt_scr_alloc(session, 1024, &buf)); WT_ERR(__wt_buf_fmt(session, buf, "snapshot_min=%" PRIu64 ", snapshot_max=%" PRIu64 ", snapshot_count=%" PRIu32, diff --git a/src/third_party/wiredtiger/src/include/verbose.h b/src/third_party/wiredtiger/src/include/verbose.h index e457e6e4b11..2aeb383b7e2 100644 --- a/src/third_party/wiredtiger/src/include/verbose.h +++ b/src/third_party/wiredtiger/src/include/verbose.h @@ -74,18 +74,30 @@ case WT_VERBOSE_INFO: \ (level_str) = "INFO"; \ break; \ - case WT_VERBOSE_DEBUG: \ - (level_str) = "DEBUG"; \ + case WT_VERBOSE_DEBUG_1: \ + (level_str) = "DEBUG_1"; \ + break; \ + case WT_VERBOSE_DEBUG_2: \ + (level_str) = "DEBUG_2"; \ + break; \ + case WT_VERBOSE_DEBUG_3: \ + (level_str) = "DEBUG_3"; \ + break; \ + case WT_VERBOSE_DEBUG_4: \ + (level_str) = "DEBUG_4"; \ + break; \ + case WT_VERBOSE_DEBUG_5: \ + (level_str) = "DEBUG_5"; \ break; \ } \ } while (0) /* - * Default verbosity level. WT_VERBOSE_DEBUG being the default level assigned to verbose messages + * Default verbosity level. WT_VERBOSE_DEBUG_1 being the default level assigned to verbose messages * prior to the introduction of verbosity levels. */ #ifndef WT_VERBOSE_LEVEL_DEFAULT -#define WT_VERBOSE_LEVEL_DEFAULT WT_VERBOSE_DEBUG +#define WT_VERBOSE_LEVEL_DEFAULT WT_VERBOSE_DEBUG_1 #endif /* Default category for messages that don't explicitly specify a category. */ @@ -162,7 +174,7 @@ struct __wt_verbose_multi_category { * Wrapper to __wt_verbose_level using the default verbosity level. */ #define __wt_verbose_debug(session, category, fmt, ...) \ - __wt_verbose_level(session, category, WT_VERBOSE_DEBUG, fmt, __VA_ARGS__) + __wt_verbose_level(session, category, WT_VERBOSE_DEBUG_1, fmt, __VA_ARGS__) /* * __wt_verbose -- diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in index 372fd3fd629..fb84611e4de 100644 --- a/src/third_party/wiredtiger/src/include/wiredtiger.in +++ b/src/third_party/wiredtiger/src/include/wiredtiger.in @@ -7491,7 +7491,7 @@ typedef enum { /*! * WiredTiger verbosity levels. The levels define a range of severity categories, with * \c WT_VERBOSE_ERROR being the lowest, most critical level (used by messages on critical error - * paths) and \c WT_VERBOSE_DEBUG being the highest verbosity/informational level (mostly adopted + * paths) and \c WT_VERBOSE_DEBUG_5 being the highest verbosity/informational level (mostly adopted * for debugging). */ typedef enum { @@ -7501,8 +7501,16 @@ typedef enum { WT_VERBOSE_NOTICE, /*!< Messages for significant events in WiredTiger, usually worth noting. */ WT_VERBOSE_INFO, /*!< Informational style messages. */ - WT_VERBOSE_DEBUG /*!< Low severity messages, useful for debugging purposes. */ + WT_VERBOSE_DEBUG_1, /*!< Low severity messages, useful for debugging purposes. This is + the default level when debugging. */ + WT_VERBOSE_DEBUG_2, /*!< Low severity messages, an increase in verbosity from + the previous level. */ + WT_VERBOSE_DEBUG_3, /*!< Low severity messages. */ + WT_VERBOSE_DEBUG_4, /*!< Low severity messages. */ + WT_VERBOSE_DEBUG_5 /*!< Lowest severity messages. */ } WT_VERBOSE_LEVEL; +/*! Temporary, for compatibility. FIXME: SERVER-70652. */ +#define WT_VERBOSE_DEBUG WT_VERBOSE_DEBUG_1 /*! @} */ /* * Verbose section: END diff --git a/src/third_party/wiredtiger/src/support/generation.c b/src/third_party/wiredtiger/src/support/generation.c index 121b755f29f..88af5655bef 100644 --- a/src/third_party/wiredtiger/src/support/generation.c +++ b/src/third_party/wiredtiger/src/support/generation.c @@ -176,14 +176,15 @@ __wt_gen_drain(WT_SESSION_IMPL *session, int which, uint64_t generation) else if (!verbose_timeout_flags && time_diff_ms > (WT_GEN_DRAIN_TIMEOUT_MIN * WT_MINUTE * WT_THOUSAND - 20)) { if (which == WT_GEN_EVICT) { - WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICT, WT_VERBOSE_DEBUG); - WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICTSERVER, WT_VERBOSE_DEBUG); - WT_SET_VERBOSE_LEVEL(session, WT_VERB_EVICT_STUCK, WT_VERBOSE_DEBUG); + 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); } else if (which == WT_GEN_CHECKPOINT) { - WT_SET_VERBOSE_LEVEL(session, WT_VERB_CHECKPOINT, WT_VERBOSE_DEBUG); - WT_SET_VERBOSE_LEVEL(session, WT_VERB_CHECKPOINT_CLEANUP, WT_VERBOSE_DEBUG); + WT_SET_VERBOSE_LEVEL(session, WT_VERB_CHECKPOINT, WT_VERBOSE_DEBUG_1); WT_SET_VERBOSE_LEVEL( - session, WT_VERB_CHECKPOINT_PROGRESS, WT_VERBOSE_DEBUG); + session, WT_VERB_CHECKPOINT_CLEANUP, WT_VERBOSE_DEBUG_1); + WT_SET_VERBOSE_LEVEL( + session, WT_VERB_CHECKPOINT_PROGRESS, WT_VERBOSE_DEBUG_1); } verbose_timeout_flags = true; } 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 37269ec53f1..71320a2942d 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 @@ -459,7 +459,7 @@ __rollback_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_REF *ref, WT_ROW *rip, WT_ERR(__wt_buf_set(session, full_value, hs_value->data, hs_value->size)); } } else - __wt_verbose_multi(session, WT_VERB_RECOVERY_RTS(session), + __wt_verbose_level_multi(session, WT_VERB_RECOVERY_RTS(session), WT_VERBOSE_DEBUG_3, "history store update more recent than on-disk update with time window: %s and type: " "%" PRIu8, __wt_time_window_to_string(hs_tw, tw_string), type); @@ -511,7 +511,7 @@ __rollback_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_REF *ref, WT_ROW *rip, */ if (__rollback_txn_visible_id(session, hs_tw->start_txn) && hs_tw->durable_start_ts <= rollback_timestamp) { - __wt_verbose_multi(session, WT_VERB_RECOVERY_RTS(session), + __wt_verbose_level_multi(session, WT_VERB_RECOVERY_RTS(session), WT_VERBOSE_DEBUG_2, "history store update valid with time window: %s, type: %" PRIu8 " and stable timestamp: %s", __wt_time_window_to_string(hs_tw, tw_string), type, @@ -623,7 +623,8 @@ __rollback_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_REF *ref, WT_ROW *rip, } else { WT_ERR(__wt_upd_alloc_tombstone(session, &upd, NULL)); WT_STAT_CONN_DATA_INCR(session, txn_rts_keys_removed); - __wt_verbose_multi(session, WT_VERB_RECOVERY_RTS(session), "%s", "key removed"); + __wt_verbose_level_multi( + session, WT_VERB_RECOVERY_RTS(session), WT_VERBOSE_DEBUG_5, "%s", "key removed"); } if (rip != NULL) @@ -1234,7 +1235,7 @@ __rollback_abort_updates(WT_SESSION_IMPL *session, WT_REF *ref, wt_timestamp_t r } WT_STAT_CONN_INCR(session, txn_rts_pages_visited); - __wt_verbose_multi(session, WT_VERB_RECOVERY_RTS(session), + __wt_verbose_level_multi(session, WT_VERB_RECOVERY_RTS(session), WT_VERBOSE_DEBUG_4, "%p: page rolled back when page is modified: %s", (void *)ref, __wt_page_is_modified(page) ? "true" : "false"); diff --git a/src/third_party/wiredtiger/test/suite/test_verbose02.py b/src/third_party/wiredtiger/test/suite/test_verbose02.py index c7ad990d951..a7f6128fbce 100755 --- a/src/third_party/wiredtiger/test/suite/test_verbose02.py +++ b/src/third_party/wiredtiger/test/suite/test_verbose02.py @@ -52,11 +52,11 @@ class test_verbose02(test_verbose_base): self.close_conn() # Test passing a single verbose category, 'api' along with the verbosity level - # WT_VERBOSE_DEBUG (1). Ensuring the only verbose output generated is related to the 'api' - # category. + # WT_VERBOSE_DEBUG_1 (1). Ensuring the only verbose output generated is related to the + # 'api' category. with self.expect_verbose(['api:1'], ['WT_VERB_API'], self.is_json) as conn: # Perform a set of simple API operations to generate verbose API messages. - uri = 'table:test_verbose01_api' + uri = 'table:test_verbose02_api' session = conn.open_session() session.create(uri, self.collection_cfg) c = session.open_cursor(uri) @@ -67,7 +67,7 @@ class test_verbose02(test_verbose_base): # At this time, there is no verbose messages with the category WT_VERB_API and the verbosity # level WT_VERBOSE_INFO (0), hence we don't expect any output. with self.expect_verbose(['api:0'], ['WT_VERB_API'], self.is_json, False) as conn: - uri = 'table:test_verbose01_api' + uri = 'table:test_verbose02_api' session = conn.open_session() session.create(uri, self.collection_cfg) c = session.open_cursor(uri) @@ -76,15 +76,15 @@ class test_verbose02(test_verbose_base): session.close() # Test passing another single verbose category, 'compact' with different verbosity levels. - # Since there are verbose message with the category WT_VERB_COMPACT and the verbosity levels - # WT_VERBOSE_INFO (0) and WT_VERBOSE_DEBUG (1), we can test them both. - cfgs = ['compact:0', 'compact:1'] + # Since there are verbose messages with the category WT_VERB_COMPACT and the verbosity + # levels WT_VERBOSE_INFO (0) through WT_VERBOSE_DEBUG_5 (5), we can test them all. + cfgs = ['compact:0', 'compact:1', 'compact:2', 'compact:3', 'compact:4', 'compact:5'] for cfg in cfgs: with self.expect_verbose([cfg], ['WT_VERB_COMPACT'], self.is_json) as conn: # Create a simple table to invoke compaction on. We aren't doing anything # interesting with the table, we want to simply invoke a compaction pass to generate # verbose messages. - uri = 'table:test_verbose01_compact' + uri = 'table:test_verbose02_compact' session = conn.open_session() session.create(uri, self.collection_cfg) session.compact(uri) @@ -103,7 +103,7 @@ class test_verbose02(test_verbose_base): # Perform a set of simple API operations (table creations and cursor operations) to # generate verbose API messages. Beyond opening the connection resource, we # shouldn't need to do anything special for the version category. - uri = 'table:test_verbose01_multiple' + uri = 'table:test_verbose02_multiple' session = conn.open_session() session.create(uri, self.collection_cfg) c = session.open_cursor(uri) @@ -118,9 +118,9 @@ class test_verbose02(test_verbose_base): self.assertRaisesHavingMessage(wiredtiger.WiredTigerError, lambda:self.wiredtiger_open(self.home, 'verbose=[api:-1]'), '/Failed to parse verbose option \'api\'/') - # Any value greater than WT_VERBOSE_DEBUG (1) is invalid. + # Any value greater than WT_VERBOSE_DEBUG_5 (5) is invalid. self.assertRaisesHavingMessage(wiredtiger.WiredTigerError, - lambda:self.wiredtiger_open(self.home, 'verbose=[api:2]'), + lambda:self.wiredtiger_open(self.home, 'verbose=[api:6]'), '/Failed to parse verbose option \'api\'/') if __name__ == '__main__': diff --git a/src/third_party/wiredtiger/test/suite/test_verbose04.py b/src/third_party/wiredtiger/test/suite/test_verbose04.py new file mode 100644 index 00000000000..09d0beffff9 --- /dev/null +++ b/src/third_party/wiredtiger/test/suite/test_verbose04.py @@ -0,0 +1,168 @@ +#!/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. +# + +from test_verbose01 import test_verbose_base +from wtdataset import SimpleDataSet +import wttest + +# test_verbose04.py +# Verify extended debug verbose levels (WT_VERBOSE_DEBUG_2 through 5). +class test_verbose04(test_verbose_base): + def updates(self, uri, value, ds, nrows, commit_ts): + session = self.session + cursor = session.open_cursor(uri) + for i in range(1, nrows + 1): + session.begin_transaction() + cursor[ds.key(i)] = value + session.commit_transaction('commit_timestamp=' + self.timestamp_str(commit_ts)) + cursor.close() + + def test_verbose_level_2(self): + self.close_conn() + + self.cleanStdout() + verbose_config = self.create_verbose_configuration(['rts:2']) + conn = self.wiredtiger_open(self.home, verbose_config) + session = conn.open_session() + + self.conn = conn + self.session = session + + uri = "table:test_verbose04" + create_params = 'key_format=i,value_format=S' + session.create(uri, create_params) + + ds = SimpleDataSet(self, uri, 0, key_format='i', value_format="S") + ds.populate() + + nrows = 1000 + value = 'x' * 1000 + + # Insert values with varying timestamps. + self.updates(uri, value, ds, nrows, 20) + + # Move the stable timestamp past our updates. + self.conn.set_timestamp('stable_timestamp=' + self.timestamp_str(40)) + + # Update values. + self.updates(uri, value, ds, nrows, 60) + + # Perform a checkpoint and close the connection. + self.session.checkpoint('use_timestamp=true') + conn.close() + + output = self.readStdout(self.nlines) + self.assertTrue('DEBUG_2' in output) + self.cleanStdout() + + def walk_at_ts(self, check_value, uri, read_ts): + session = self.session + session.begin_transaction() + cursor = session.open_cursor(uri) + for k, v in cursor: + pass + session.commit_transaction() + cursor.close() + + def test_verbose_level_3(self): + self.close_conn() + + self.cleanStdout() + verbose_config = self.create_verbose_configuration(['rts:3']) + conn = self.wiredtiger_open(self.home, 'cache_size=50MB,' + verbose_config) + session = conn.open_session() + + self.conn = conn + self.session = session + + nrows = 1000 + + # Create a table. + uri = "table:test_verbose_04" + ds = SimpleDataSet(self, uri, 0, key_format='i', value_format='S') + ds.populate() + + value = "aaaaa" * 100 + + # Pin the stable timestamp to 10. + self.conn.set_timestamp('stable_timestamp=' + self.timestamp_str(10)) + + # Perform several updates. + self.updates(uri, value, ds, nrows, 20) + self.updates(uri, value, ds, nrows, 30) + self.updates(uri, value, ds, nrows, 40) + self.updates(uri, value, ds, nrows, 50) + + # Touch all of our data with a read timestamp > the commit timestamp. + self.walk_at_ts(value, uri, 21) + self.walk_at_ts(value, uri, 31) + self.walk_at_ts(value, uri, 41) + self.walk_at_ts(value, uri, 51) + + # Perform a checkpoint and close the connection. + self.session.checkpoint() + conn.close() + + # Possibly a lot of output here, allow many more chars than nlines. + output = self.readStdout(self.nlines * 100000) + self.assertTrue('DEBUG_3' in output) + self.cleanStdout() + + def test_verbose_level_4_and_5(self): + self.close_conn() + + self.cleanStdout() + verbose_config = self.create_verbose_configuration(['recovery:5']) + conn = self.wiredtiger_open(self.home, verbose_config) + session = conn.open_session() + + ckpt_uri = 'table:test_verbose_04' + session.create(ckpt_uri, 'key_format=i,value_format=i,log=(enabled=false)') + c_ckpt = session.open_cursor(ckpt_uri) + + # Add some data. + session.begin_transaction() + c_ckpt[1] = 1 + session.commit_transaction('commit_timestamp=' + self.timestamp_str(10)) + + # Set the stable timestamp before the data. + conn.set_timestamp('stable_timestamp=' + self.timestamp_str(9)) + + # Run recovery. + conn.close() + conn = self.wiredtiger_open(self.home, verbose_config) + + output = self.readStdout(self.nlines) + self.assertTrue('DEBUG_4' in output) + self.assertTrue('DEBUG_5' in output) + conn.close() + self.cleanStdout() + +if __name__ == '__main__': + wttest.run() |