summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2021-12-20 13:30:32 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-20 02:57:43 +0000
commitd4395b9801ed6c9e27120595b83cbcbc21746694 (patch)
tree4f99baae4d736e8b75395816dc09150a9d214cc2 /src/third_party/wiredtiger/src
parent38abbf63ef4129b715adff857e64964b8384b986 (diff)
downloadmongo-d4395b9801ed6c9e27120595b83cbcbc21746694.tar.gz
Import wiredtiger: bd9148d45bc5f7b8e2a9b59f96d4785d0db30f13 from branch mongodb-master
ref: 7d2c1389a4..bd9148d45b for: 5.3.0 WT-8479 Expose verbose category identifiers in public WiredTiger API
Diffstat (limited to 'src/third_party/wiredtiger/src')
-rw-r--r--src/third_party/wiredtiger/src/include/verbose.h121
-rw-r--r--src/third_party/wiredtiger/src/include/wiredtiger.in97
-rw-r--r--src/third_party/wiredtiger/src/support/err.c7
3 files changed, 150 insertions, 75 deletions
diff --git a/src/third_party/wiredtiger/src/include/verbose.h b/src/third_party/wiredtiger/src/include/verbose.h
index 96f2995ca23..1102e47db4f 100644
--- a/src/third_party/wiredtiger/src/include/verbose.h
+++ b/src/third_party/wiredtiger/src/include/verbose.h
@@ -6,82 +6,57 @@
* See the file LICENSE for redistribution information.
*/
-#define WT_GEN_VERBOSE_ENUM(value) value,
-#define WT_GEN_VERBOSE_ENUM_STR(value_str) #value_str,
-
-/* Disable clang format for the following macro to keep the categories formatted on a new line. */
/* clang-format off */
-#define WT_GEN_VERBOSE_CATEGORIES(gen) \
- gen(WT_VERB_API) \
- gen(WT_VERB_BACKUP) \
- gen(WT_VERB_BLKCACHE) \
- gen(WT_VERB_BLOCK) \
- gen(WT_VERB_CHECKPOINT) \
- gen(WT_VERB_CHECKPOINT_CLEANUP) \
- gen(WT_VERB_CHECKPOINT_PROGRESS) \
- gen(WT_VERB_COMPACT) \
- gen(WT_VERB_COMPACT_PROGRESS) \
- gen(WT_VERB_DEFAULT) \
- gen(WT_VERB_ERROR_RETURNS) \
- gen(WT_VERB_EVICT) \
- gen(WT_VERB_EVICTSERVER) \
- gen(WT_VERB_EVICT_STUCK) \
- gen(WT_VERB_EXTENSION) \
- gen(WT_VERB_FILEOPS) \
- gen(WT_VERB_GENERATION) \
- gen(WT_VERB_HANDLEOPS) \
- gen(WT_VERB_HS) \
- gen(WT_VERB_HS_ACTIVITY) \
- gen(WT_VERB_LOG) \
- gen(WT_VERB_LSM) \
- gen(WT_VERB_LSM_MANAGER) \
- gen(WT_VERB_METADATA) \
- gen(WT_VERB_MUTEX) \
- gen(WT_VERB_OUT_OF_ORDER) \
- gen(WT_VERB_OVERFLOW) \
- gen(WT_VERB_READ) \
- gen(WT_VERB_RECONCILE) \
- gen(WT_VERB_RECOVERY) \
- gen(WT_VERB_RECOVERY_PROGRESS) \
- gen(WT_VERB_RTS) \
- gen(WT_VERB_SALVAGE) \
- gen(WT_VERB_SHARED_CACHE) \
- gen(WT_VERB_SPLIT) \
- gen(WT_VERB_TEMPORARY) \
- gen(WT_VERB_THREAD_GROUP) \
- gen(WT_VERB_TIERED) \
- gen(WT_VERB_TIMESTAMP) \
- gen(WT_VERB_TRANSACTION) \
- gen(WT_VERB_VERIFY) \
- gen(WT_VERB_VERSION) \
- gen(WT_VERB_WRITE)
+#define WT_VERBOSE_CATEGORY_STR_INIT \
+ { \
+ /* AUTOMATIC VERBOSE ENUM STRING GENERATION START */ \
+ "WT_VERB_API", \
+ "WT_VERB_BACKUP", \
+ "WT_VERB_BLKCACHE", \
+ "WT_VERB_BLOCK", \
+ "WT_VERB_CHECKPOINT", \
+ "WT_VERB_CHECKPOINT_CLEANUP", \
+ "WT_VERB_CHECKPOINT_PROGRESS", \
+ "WT_VERB_COMPACT", \
+ "WT_VERB_COMPACT_PROGRESS", \
+ "WT_VERB_DEFAULT", \
+ "WT_VERB_ERROR_RETURNS", \
+ "WT_VERB_EVICT", \
+ "WT_VERB_EVICTSERVER", \
+ "WT_VERB_EVICT_STUCK", \
+ "WT_VERB_EXTENSION", \
+ "WT_VERB_FILEOPS", \
+ "WT_VERB_GENERATION", \
+ "WT_VERB_HANDLEOPS", \
+ "WT_VERB_HS", \
+ "WT_VERB_HS_ACTIVITY", \
+ "WT_VERB_LOG", \
+ "WT_VERB_LSM", \
+ "WT_VERB_LSM_MANAGER", \
+ "WT_VERB_MUTEX", \
+ "WT_VERB_METADATA", \
+ "WT_VERB_OUT_OF_ORDER", \
+ "WT_VERB_OVERFLOW", \
+ "WT_VERB_READ", \
+ "WT_VERB_RECONCILE", \
+ "WT_VERB_RECOVERY", \
+ "WT_VERB_RECOVERY_PROGRESS", \
+ "WT_VERB_RTS", \
+ "WT_VERB_SALVAGE", \
+ "WT_VERB_SHARED_CACHE", \
+ "WT_VERB_SPLIT", \
+ "WT_VERB_TEMPORARY", \
+ "WT_VERB_THREAD_GROUP", \
+ "WT_VERB_TIERED", \
+ "WT_VERB_TIMESTAMP", \
+ "WT_VERB_TRANSACTION", \
+ "WT_VERB_VERIFY", \
+ "WT_VERB_VERSION", \
+ "WT_VERB_WRITE", \
+ /* AUTOMATIC VERBOSE ENUM STRING GENERATION STOP */ \
+ }
/* clang-format on */
-/* Permitted verbose event categories that can be used when defining a verbose message. */
-typedef enum {
- WT_GEN_VERBOSE_CATEGORIES(WT_GEN_VERBOSE_ENUM)
- /* This entry needs to be the last in order to track the number of category items. */
- WT_VERB_NUM_CATEGORIES,
-} WT_VERBOSE_CATEGORY;
-
-/* Convert a category to its string representation. */
-#define WT_VERBOSE_CATEGORY_STR(category) \
- (const char *[]){WT_GEN_VERBOSE_CATEGORIES(WT_GEN_VERBOSE_ENUM_STR)}[category]
-
-/*
- * Permitted verbosity levels; to be used when defining verbose messages. The levels define a range
- * of severity categories, with WT_VERBOSE_ERROR being the lowest, most critical level (used by
- * messages on critical error paths) and WT_VERBOSE_DEBUG being the highest verbosity/informational
- * level (mostly adopted for debugging).
- */
-typedef enum {
- WT_VERBOSE_ERROR = -3,
- WT_VERBOSE_WARNING,
- WT_VERBOSE_NOTICE,
- WT_VERBOSE_INFO,
- WT_VERBOSE_DEBUG
-} WT_VERBOSE_LEVEL;
-
/* Convert a verbose level to its string representation. */
#define WT_VERBOSE_LEVEL_STR(level, level_str) \
do { \
diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in
index aa33185db64..ac031ba0dc9 100644
--- a/src/third_party/wiredtiger/src/include/wiredtiger.in
+++ b/src/third_party/wiredtiger/src/include/wiredtiger.in
@@ -7090,6 +7090,103 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection);
*/
/*! @} */
+/*******************************************
+ * Verbose categories
+ *******************************************/
+/*!
+ * @addtogroup wt
+ * @{
+ */
+/*!
+ * @name Verbose categories
+ * @anchor verbose_categories
+ * @{
+ */
+/*!
+ * WiredTiger verbose event categories.
+ * Note that the verbose categories cover a wide set of sub-systems and operations
+ * within WiredTiger. As such, the categories are subject to change and evolve
+ * between different WiredTiger releases.
+ */
+typedef enum {
+/* VERBOSE ENUM START */
+ WT_VERB_API, /*!< API messages. */
+ WT_VERB_BACKUP, /*!< Backup messages. */
+ WT_VERB_BLKCACHE,
+ WT_VERB_BLOCK, /*!< Block manager messages. */
+ WT_VERB_CHECKPOINT, /*!< Checkpoint messages. */
+ WT_VERB_CHECKPOINT_CLEANUP,
+ WT_VERB_CHECKPOINT_PROGRESS, /*!< Checkpoint progress messages. */
+ WT_VERB_COMPACT, /*!< Compact messages. */
+ WT_VERB_COMPACT_PROGRESS, /*!< Compact progress messages. */
+ WT_VERB_DEFAULT,
+ WT_VERB_ERROR_RETURNS,
+ WT_VERB_EVICT, /*!< Eviction messages. */
+ WT_VERB_EVICTSERVER, /*!< Eviction server messages. */
+ WT_VERB_EVICT_STUCK,
+ WT_VERB_EXTENSION, /*!< Extension messages. */
+ WT_VERB_FILEOPS,
+ WT_VERB_GENERATION,
+ WT_VERB_HANDLEOPS,
+ WT_VERB_HS, /*!< History store messages. */
+ WT_VERB_HS_ACTIVITY, /*!< History store activity messages. */
+ WT_VERB_LOG, /*!< Log messages. */
+ WT_VERB_LSM, /*!< LSM messages. */
+ WT_VERB_LSM_MANAGER,
+ WT_VERB_MUTEX,
+ WT_VERB_METADATA, /*!< Metadata messages. */
+ WT_VERB_OUT_OF_ORDER,
+ WT_VERB_OVERFLOW,
+ WT_VERB_READ,
+ WT_VERB_RECONCILE, /*!< Reconcile messages. */
+ WT_VERB_RECOVERY, /*!< Recovery messages. */
+ WT_VERB_RECOVERY_PROGRESS, /*!< Recovery progress messages. */
+ WT_VERB_RTS, /*!< RTS messages. */
+ WT_VERB_SALVAGE, /*!< Salvage messages. */
+ WT_VERB_SHARED_CACHE,
+ WT_VERB_SPLIT,
+ WT_VERB_TEMPORARY,
+ WT_VERB_THREAD_GROUP,
+ WT_VERB_TIERED, /*!< Tiered messages. */
+ WT_VERB_TIMESTAMP, /*!< Timestamp messages. */
+ WT_VERB_TRANSACTION, /*!< Transaction messages. */
+ WT_VERB_VERIFY, /*!< Verify messages. */
+ WT_VERB_VERSION, /*!< Version messages. */
+ WT_VERB_WRITE,
+/* VERBOSE ENUM STOP */
+ WT_VERB_NUM_CATEGORIES
+} WT_VERBOSE_CATEGORY;
+/*! @} */
+
+/*******************************************
+ * Verbose levels
+ *******************************************/
+/*!
+ * @name Verbose levels
+ * @anchor verbose_levels
+ * @{
+ */
+/*!
+ * 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
+ * for debugging).
+ */
+typedef enum {
+ WT_VERBOSE_ERROR = -3, /*!< Error conditions triggered in WiredTiger. */
+ WT_VERBOSE_WARNING, /*!< Warning conditions potentially signaling non-imminent errors and
+ behaviors. */
+ 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_LEVEL;
+/*! @} */
+/*
+ * Verbose section: END
+ */
+/*! @} */
+
#undef __F
#if defined(__cplusplus)
diff --git a/src/third_party/wiredtiger/src/support/err.c b/src/third_party/wiredtiger/src/support/err.c
index a03bb4f30c1..869652ea75c 100644
--- a/src/third_party/wiredtiger/src/support/err.c
+++ b/src/third_party/wiredtiger/src/support/err.c
@@ -8,6 +8,9 @@
#include "wt_internal.h"
+/* Define the string representation of each verbose category. */
+static const char *verbose_category_strings[] = WT_VERBOSE_CATEGORY_STR_INIT;
+
/*
* __handle_error_default --
* Default WT_EVENT_HANDLER->handle_error implementation: send to stderr.
@@ -295,7 +298,7 @@ __eventv(WT_SESSION_IMPL *session, bool is_json, int error, const char *func, in
err = error == 0 ? NULL : __wt_strerror(session, error, NULL, 0);
if (is_json) {
/* Category and verbosity level. */
- WT_ERROR_APPEND(p, remain, "\"category\":\"%s\",", WT_VERBOSE_CATEGORY_STR(category));
+ WT_ERROR_APPEND(p, remain, "\"category\":\"%s\",", verbose_category_strings[category]);
WT_ERROR_APPEND(p, remain, "\"category_id\":%" PRIu32 ",", category);
WT_ERROR_APPEND(p, remain, "\"verbose_level\":\"%s\",", verbosity_level_tag);
WT_ERROR_APPEND(p, remain, "\"verbose_level_id\":%d,", level);
@@ -361,7 +364,7 @@ __eventv(WT_SESSION_IMPL *session, bool is_json, int error, const char *func, in
} else {
/* Category and verbosity level. */
WT_ERROR_APPEND(
- p, remain, ": [%s][%s]", WT_VERBOSE_CATEGORY_STR(category), verbosity_level_tag);
+ p, remain, ": [%s][%s]", verbose_category_strings[category], verbosity_level_tag);
if (func != NULL)
WT_ERROR_APPEND(p, remain, ": %s, %d", func, line);