summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dist/api_data.py1
-rw-r--r--dist/flags.py1
-rw-r--r--dist/s_string.ok1
-rw-r--r--src/config/config_def.c30
-rw-r--r--src/conn/conn_api.c1
-rw-r--r--src/include/extern.h2
-rw-r--r--src/include/flags.h37
-rw-r--r--src/include/misc.i224
-rw-r--r--src/include/wiredtiger.in12
-rw-r--r--src/os_posix/os_dir.c9
-rw-r--r--src/os_posix/os_fallocate.c6
-rw-r--r--src/os_posix/os_open.c82
-rw-r--r--src/os_win/os_dir.c7
13 files changed, 261 insertions, 152 deletions
diff --git a/dist/api_data.py b/dist/api_data.py
index 02aee1e8825..5ca294a5d60 100644
--- a/dist/api_data.py
+++ b/dist/api_data.py
@@ -569,6 +569,7 @@ connection_runtime_config = [
'evict',
'evictserver',
'fileops',
+ 'handleops',
'log',
'lsm',
'lsm_manager',
diff --git a/dist/flags.py b/dist/flags.py
index 3e9d8cd890c..8f7827ad160 100644
--- a/dist/flags.py
+++ b/dist/flags.py
@@ -65,6 +65,7 @@ flags = {
'VERB_EVICT',
'VERB_EVICTSERVER',
'VERB_FILEOPS',
+ 'VERB_HANDLEOPS',
'VERB_LOG',
'VERB_LSM',
'VERB_LSM_MANAGER',
diff --git a/dist/s_string.ok b/dist/s_string.ok
index 127ae7fd2eb..6f9be4e6141 100644
--- a/dist/s_string.ok
+++ b/dist/s_string.ok
@@ -661,6 +661,7 @@ gostring
gostruct
goutf
gt
+handleops
hashval
havesize
hdr
diff --git a/src/config/config_def.c b/src/config/config_def.c
index c752e5eb265..5b6f0bac323 100644
--- a/src/config/config_def.c
+++ b/src/config/config_def.c
@@ -150,9 +150,9 @@ static const WT_CONFIG_CHECK confchk_WT_CONNECTION_reconfigure[] = {
confchk_wiredtiger_open_statistics_log_subconfigs, 6 },
{ "verbose", "list",
NULL, "choices=[\"api\",\"block\",\"checkpoint\",\"compact\","
- "\"evict\",\"evictserver\",\"fileops\",\"log\",\"lsm\","
- "\"lsm_manager\",\"metadata\",\"mutex\",\"overflow\",\"read\","
- "\"rebalance\",\"reconcile\",\"recovery\",\"salvage\","
+ "\"evict\",\"evictserver\",\"fileops\",\"handleops\",\"log\","
+ "\"lsm\",\"lsm_manager\",\"metadata\",\"mutex\",\"overflow\","
+ "\"read\",\"rebalance\",\"reconcile\",\"recovery\",\"salvage\","
"\"shared_cache\",\"split\",\"temporary\",\"transaction\","
"\"verify\",\"version\",\"write\"]",
NULL, 0 },
@@ -680,9 +680,9 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open[] = {
{ "use_environment_priv", "boolean", NULL, NULL, NULL, 0 },
{ "verbose", "list",
NULL, "choices=[\"api\",\"block\",\"checkpoint\",\"compact\","
- "\"evict\",\"evictserver\",\"fileops\",\"log\",\"lsm\","
- "\"lsm_manager\",\"metadata\",\"mutex\",\"overflow\",\"read\","
- "\"rebalance\",\"reconcile\",\"recovery\",\"salvage\","
+ "\"evict\",\"evictserver\",\"fileops\",\"handleops\",\"log\","
+ "\"lsm\",\"lsm_manager\",\"metadata\",\"mutex\",\"overflow\","
+ "\"read\",\"rebalance\",\"reconcile\",\"recovery\",\"salvage\","
"\"shared_cache\",\"split\",\"temporary\",\"transaction\","
"\"verify\",\"version\",\"write\"]",
NULL, 0 },
@@ -761,9 +761,9 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_all[] = {
{ "use_environment_priv", "boolean", NULL, NULL, NULL, 0 },
{ "verbose", "list",
NULL, "choices=[\"api\",\"block\",\"checkpoint\",\"compact\","
- "\"evict\",\"evictserver\",\"fileops\",\"log\",\"lsm\","
- "\"lsm_manager\",\"metadata\",\"mutex\",\"overflow\",\"read\","
- "\"rebalance\",\"reconcile\",\"recovery\",\"salvage\","
+ "\"evict\",\"evictserver\",\"fileops\",\"handleops\",\"log\","
+ "\"lsm\",\"lsm_manager\",\"metadata\",\"mutex\",\"overflow\","
+ "\"read\",\"rebalance\",\"reconcile\",\"recovery\",\"salvage\","
"\"shared_cache\",\"split\",\"temporary\",\"transaction\","
"\"verify\",\"version\",\"write\"]",
NULL, 0 },
@@ -837,9 +837,9 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_basecfg[] = {
confchk_wiredtiger_open_transaction_sync_subconfigs, 2 },
{ "verbose", "list",
NULL, "choices=[\"api\",\"block\",\"checkpoint\",\"compact\","
- "\"evict\",\"evictserver\",\"fileops\",\"log\",\"lsm\","
- "\"lsm_manager\",\"metadata\",\"mutex\",\"overflow\",\"read\","
- "\"rebalance\",\"reconcile\",\"recovery\",\"salvage\","
+ "\"evict\",\"evictserver\",\"fileops\",\"handleops\",\"log\","
+ "\"lsm\",\"lsm_manager\",\"metadata\",\"mutex\",\"overflow\","
+ "\"read\",\"rebalance\",\"reconcile\",\"recovery\",\"salvage\","
"\"shared_cache\",\"split\",\"temporary\",\"transaction\","
"\"verify\",\"version\",\"write\"]",
NULL, 0 },
@@ -913,9 +913,9 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_usercfg[] = {
confchk_wiredtiger_open_transaction_sync_subconfigs, 2 },
{ "verbose", "list",
NULL, "choices=[\"api\",\"block\",\"checkpoint\",\"compact\","
- "\"evict\",\"evictserver\",\"fileops\",\"log\",\"lsm\","
- "\"lsm_manager\",\"metadata\",\"mutex\",\"overflow\",\"read\","
- "\"rebalance\",\"reconcile\",\"recovery\",\"salvage\","
+ "\"evict\",\"evictserver\",\"fileops\",\"handleops\",\"log\","
+ "\"lsm\",\"lsm_manager\",\"metadata\",\"mutex\",\"overflow\","
+ "\"read\",\"rebalance\",\"reconcile\",\"recovery\",\"salvage\","
"\"shared_cache\",\"split\",\"temporary\",\"transaction\","
"\"verify\",\"version\",\"write\"]",
NULL, 0 },
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index f3db3931cfc..9ac77d3540e 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -1694,6 +1694,7 @@ __wt_verbose_config(WT_SESSION_IMPL *session, const char *cfg[])
{ "evict", WT_VERB_EVICT },
{ "evictserver", WT_VERB_EVICTSERVER },
{ "fileops", WT_VERB_FILEOPS },
+ { "handleops", WT_VERB_HANDLEOPS },
{ "log", WT_VERB_LOG },
{ "lsm", WT_VERB_LSM },
{ "lsm_manager", WT_VERB_LSM_MANAGER },
diff --git a/src/include/extern.h b/src/include/extern.h
index a1f70c4340b..7a56d7ef242 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -745,7 +745,7 @@ extern int __wt_mmap_discard(WT_SESSION_IMPL *session, void *p, size_t size);
extern int __wt_mmap_preload(WT_SESSION_IMPL *session, const void *p, size_t size);
extern int __wt_munmap(WT_SESSION_IMPL *session, WT_FH *fh, void *map, size_t len, void **mappingcookie);
extern int __wt_once(void (*init_routine)(void));
-extern int __wt_open(WT_SESSION_IMPL *session, const char *name, int dio_type, u_int flags, WT_FH **fhp);
+extern int __wt_open(WT_SESSION_IMPL *session, const char *name, int dio_type, uint32_t flags, WT_FH **fhp);
extern int __wt_os_cleanup(WT_SESSION_IMPL *session);
extern int __wt_os_init(WT_SESSION_IMPL *session);
extern int __wt_os_inmemory(WT_SESSION_IMPL *session);
diff --git a/src/include/flags.h b/src/include/flags.h
index ac2d1f20ce5..3d9b0ed716b 100644
--- a/src/include/flags.h
+++ b/src/include/flags.h
@@ -83,24 +83,25 @@
#define WT_VERB_EVICT 0x00000010
#define WT_VERB_EVICTSERVER 0x00000020
#define WT_VERB_FILEOPS 0x00000040
-#define WT_VERB_LOG 0x00000080
-#define WT_VERB_LSM 0x00000100
-#define WT_VERB_LSM_MANAGER 0x00000200
-#define WT_VERB_METADATA 0x00000400
-#define WT_VERB_MUTEX 0x00000800
-#define WT_VERB_OVERFLOW 0x00001000
-#define WT_VERB_READ 0x00002000
-#define WT_VERB_REBALANCE 0x00004000
-#define WT_VERB_RECONCILE 0x00008000
-#define WT_VERB_RECOVERY 0x00010000
-#define WT_VERB_SALVAGE 0x00020000
-#define WT_VERB_SHARED_CACHE 0x00040000
-#define WT_VERB_SPLIT 0x00080000
-#define WT_VERB_TEMPORARY 0x00100000
-#define WT_VERB_TRANSACTION 0x00200000
-#define WT_VERB_VERIFY 0x00400000
-#define WT_VERB_VERSION 0x00800000
-#define WT_VERB_WRITE 0x01000000
+#define WT_VERB_HANDLEOPS 0x00000080
+#define WT_VERB_LOG 0x00000100
+#define WT_VERB_LSM 0x00000200
+#define WT_VERB_LSM_MANAGER 0x00000400
+#define WT_VERB_METADATA 0x00000800
+#define WT_VERB_MUTEX 0x00001000
+#define WT_VERB_OVERFLOW 0x00002000
+#define WT_VERB_READ 0x00004000
+#define WT_VERB_REBALANCE 0x00008000
+#define WT_VERB_RECONCILE 0x00010000
+#define WT_VERB_RECOVERY 0x00020000
+#define WT_VERB_SALVAGE 0x00040000
+#define WT_VERB_SHARED_CACHE 0x00080000
+#define WT_VERB_SPLIT 0x00100000
+#define WT_VERB_TEMPORARY 0x00200000
+#define WT_VERB_TRANSACTION 0x00400000
+#define WT_VERB_VERIFY 0x00800000
+#define WT_VERB_VERSION 0x01000000
+#define WT_VERB_WRITE 0x02000000
#define WT_VISIBILITY_ERR 0x00000010
/*
* flags section: END
diff --git a/src/include/misc.i b/src/include/misc.i
index 755a22df977..8ac0451b6ef 100644
--- a/src/include/misc.i
+++ b/src/include/misc.i
@@ -79,6 +79,11 @@ static inline int
__wt_dirlist(WT_SESSION_IMPL *session, const char *dir,
const char *prefix, uint32_t flags, char ***dirlist, u_int *countp)
{
+ WT_RET(__wt_verbose(session, WT_VERB_FILEOPS,
+ "%s: directory-list: %s prefix %s",
+ dir, LF_ISSET(WT_DIRLIST_INCLUDE) ? "include" : "exclude",
+ prefix == NULL ? "all" : prefix));
+
return (S2C(session)->file_directory_list(
session, dir, prefix, flags, dirlist, countp));
}
@@ -88,55 +93,88 @@ __wt_dirlist(WT_SESSION_IMPL *session, const char *dir,
* Flush a directory to ensure file creation is durable.
*/
static inline int
-__wt_directory_sync(WT_SESSION_IMPL *session, const char *path)
+__wt_directory_sync(WT_SESSION_IMPL *session, const char *name)
{
WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY));
- return (S2C(session)->file_directory_sync(session, path));
+ WT_RET(__wt_verbose(
+ session, WT_VERB_FILEOPS, "%s: directory-sync", name));
+
+ return (S2C(session)->file_directory_sync(session, name));
}
/*
- * __wt_directory_sync_fh --
- * Flush a directory file handle to ensure file creation is durable.
- *
- * We don't use the normal sync path because many file systems don't require
- * this step and we don't want to penalize them.
+ * __wt_exist --
+ * Return if the file exists.
*/
static inline int
-__wt_directory_sync_fh(WT_SESSION_IMPL *session, WT_FH *fh)
+__wt_exist(WT_SESSION_IMPL *session, const char *name, bool *existp)
+{
+ WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: file-exist", name));
+
+ return (S2C(session)->file_exist(session, name, existp));
+}
+
+/*
+ * __wt_remove --
+ * POSIX remove.
+ */
+static inline int
+__wt_remove(WT_SESSION_IMPL *session, const char *name)
{
WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY));
-#ifdef __linux__
- return (fh->fh_sync(session, fh, true));
-#else
- WT_UNUSED(fh);
- return (0);
-#endif
+ WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: file-remove", name));
+
+ return (S2C(session)->file_remove(session, name));
}
/*
- * __wt_exist --
- * Return if the file exists.
+ * __wt_rename --
+ * POSIX rename.
*/
static inline int
-__wt_exist(WT_SESSION_IMPL *session, const char *name, bool *existp)
+__wt_rename(WT_SESSION_IMPL *session, const char *from, const char *to)
{
- return (S2C(session)->file_exist(session, name, existp));
+ WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY));
+
+ WT_RET(__wt_verbose(
+ session, WT_VERB_FILEOPS, "%s to %s: file-rename", from, to));
+
+ return (S2C(session)->file_rename(session, from, to));
}
/*
- * __wt_fallocate --
- * Extend a file.
+ * __wt_filesize_name --
+ * Get the size of a file in bytes, by file name.
*/
static inline int
-__wt_fallocate(
- WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset, wt_off_t len)
+__wt_filesize_name(
+ WT_SESSION_IMPL *session, const char *name, bool silent, wt_off_t *sizep)
+{
+ WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: file-size", name));
+
+ return (S2C(session)->file_size(session, name, silent, sizep));
+}
+
+/*
+ * __wt_directory_sync_fh --
+ * Flush a directory file handle to ensure file creation is durable.
+ *
+ * We don't use the normal sync path because many file systems don't require
+ * this step and we don't want to penalize them.
+ */
+static inline int
+__wt_directory_sync_fh(WT_SESSION_IMPL *session, WT_FH *fh)
{
WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY));
- WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_IN_MEMORY));
- return (fh->fh_allocate(session, fh, offset, len));
+#ifdef __linux__
+ return (fh->fh_sync(session, fh, true));
+#else
+ WT_UNUSED(fh);
+ return (0);
+#endif
}
/*
@@ -148,6 +186,9 @@ __wt_posix_fadvise(WT_SESSION_IMPL *session,
WT_FH *fh, wt_off_t offset, wt_off_t len, int advice)
{
#if defined(HAVE_POSIX_FADVISE)
+ WT_RET(__wt_verbose(
+ session, WT_VERB_HANDLEOPS, "%s: handle-advise", fh->name));
+
return (fh->fh_advise(session, fh, offset, len, advice));
#else
WT_UNUSED(session);
@@ -160,58 +201,65 @@ __wt_posix_fadvise(WT_SESSION_IMPL *session,
}
/*
- * __wt_file_lock --
- * Lock/unlock a file.
+ * __wt_fallocate --
+ * Extend a file.
*/
static inline int
-__wt_file_lock(WT_SESSION_IMPL * session, WT_FH *fh, bool lock)
+__wt_fallocate(
+ WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset, wt_off_t len)
{
- return (fh->fh_lock(session, fh, lock));
-}
+ WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY));
+ WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_IN_MEMORY));
-/*
- * __wt_filesize --
- * Get the size of a file in bytes, by file handle.
- */
-static inline int
-__wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t *sizep)
-{
- return (fh->fh_size(session, fh, sizep));
+ WT_RET(__wt_verbose(session, WT_VERB_HANDLEOPS,
+ "%s: handle-allocate: %" PRIuMAX " at %" PRIuMAX,
+ fh->name, (uintmax_t)len, (uintmax_t)offset));
+
+ return (fh->fh_allocate(session, fh, offset, len));
}
/*
- * __wt_filesize_name --
- * Get the size of a file in bytes, by file name.
+ * __wt_file_lock --
+ * Lock/unlock a file.
*/
static inline int
-__wt_filesize_name(
- WT_SESSION_IMPL *session, const char *name, bool silent, wt_off_t *sizep)
+__wt_file_lock(WT_SESSION_IMPL * session, WT_FH *fh, bool lock)
{
- return (S2C(session)->file_size(session, name, silent, sizep));
+ WT_RET(__wt_verbose(session, WT_VERB_HANDLEOPS,
+ "%s: handle-lock: %s", fh->name, lock ? "lock" : "unlock"));
+
+ return (fh->fh_lock(session, fh, lock));
}
/*
- * __wt_fsync --
- * POSIX fflush/fsync.
+ * __wt_vfprintf --
+ * ANSI C vfprintf.
*/
static inline int
-__wt_fsync(WT_SESSION_IMPL *session, WT_FH *fh, bool block)
+__wt_vfprintf(WT_SESSION_IMPL *session, WT_FH *fh, const char *fmt, va_list ap)
{
- WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY));
+ WT_RET(__wt_verbose(
+ session, WT_VERB_HANDLEOPS, "%s: handle-printf", fh->name));
- return (fh->fh_sync(session, fh, block));
+ return (fh->fh_printf(session, fh, fmt, ap));
}
/*
- * __wt_ftruncate --
- * POSIX ftruncate.
+ * __wt_fprintf --
+ * ANSI C fprintf.
*/
static inline int
-__wt_ftruncate(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t len)
+__wt_fprintf(WT_SESSION_IMPL *session, WT_FH *fh, const char *fmt, ...)
+ WT_GCC_FUNC_ATTRIBUTE((format (printf, 3, 4)))
{
- WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY));
+ WT_DECL_RET;
+ va_list ap;
- return (fh->fh_truncate(session, fh, len));
+ va_start(ap, fmt);
+ ret = __wt_vfprintf(session, fh, fmt, ap);
+ va_end(ap);
+
+ return (ret);
}
/*
@@ -222,33 +270,57 @@ static inline int
__wt_read(
WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset, size_t len, void *buf)
{
+ WT_RET(__wt_verbose(session, WT_VERB_HANDLEOPS,
+ "%s: handle-read: %" WT_SIZET_FMT " at %" PRIuMAX,
+ fh->name, len, (uintmax_t)offset));
+
WT_STAT_FAST_CONN_INCR(session, read_io);
return (fh->fh_read(session, fh, offset, len, buf));
}
/*
- * __wt_remove --
- * POSIX remove.
+ * __wt_filesize --
+ * Get the size of a file in bytes, by file handle.
*/
static inline int
-__wt_remove(WT_SESSION_IMPL *session, const char *name)
+__wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t *sizep)
+{
+ WT_RET(__wt_verbose(
+ session, WT_VERB_HANDLEOPS, "%s: handle-size", fh->name));
+
+ return (fh->fh_size(session, fh, sizep));
+}
+
+/*
+ * __wt_fsync --
+ * POSIX fflush/fsync.
+ */
+static inline int
+__wt_fsync(WT_SESSION_IMPL *session, WT_FH *fh, bool block)
{
WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY));
- return (S2C(session)->file_remove(session, name));
+ WT_RET(__wt_verbose(
+ session, WT_VERB_HANDLEOPS, "%s: handle-sync", fh->name));
+
+ return (fh->fh_sync(session, fh, block));
}
/*
- * __wt_rename --
- * POSIX rename.
+ * __wt_ftruncate --
+ * POSIX ftruncate.
*/
static inline int
-__wt_rename(WT_SESSION_IMPL *session, const char *from, const char *to)
+__wt_ftruncate(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t len)
{
WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY));
- return (S2C(session)->file_rename(session, from, to));
+ WT_RET(__wt_verbose(session, WT_VERB_HANDLEOPS,
+ "%s: handle-truncate: %" PRIuMAX,
+ fh->name, (uintmax_t)len));
+
+ return (fh->fh_truncate(session, fh, len));
}
/*
@@ -263,35 +335,11 @@ __wt_write(WT_SESSION_IMPL *session,
WT_STRING_MATCH(fh->name,
WT_SINGLETHREAD, strlen(WT_SINGLETHREAD)));
+ WT_RET(__wt_verbose(session, WT_VERB_HANDLEOPS,
+ "%s: handle-write: %" WT_SIZET_FMT " at %" PRIuMAX,
+ fh->name, len, (uintmax_t)offset));
+
WT_STAT_FAST_CONN_INCR(session, write_io);
return (fh->fh_write(session, fh, offset, len, buf));
}
-
-/*
- * __wt_vfprintf --
- * ANSI C vfprintf.
- */
-static inline int
-__wt_vfprintf(WT_SESSION_IMPL *session, WT_FH *fh, const char *fmt, va_list ap)
-{
- return (fh->fh_printf(session, fh, fmt, ap));
-}
-
-/*
- * __wt_fprintf --
- * ANSI C fprintf.
- */
-static inline int
-__wt_fprintf(WT_SESSION_IMPL *session, WT_FH *fh, const char *fmt, ...)
- WT_GCC_FUNC_ATTRIBUTE((format (printf, 3, 4)))
-{
- WT_DECL_RET;
- va_list ap;
-
- va_start(ap, fmt);
- ret = __wt_vfprintf(session, fh, fmt, ap);
- va_end(ap);
-
- return (ret);
-}
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 1e263f22880..279858a808e 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -1922,8 +1922,8 @@ struct __wt_connection {
* as a list\, such as <code>"verbose=[evictserver\,read]"</code>., a
* list\, with values chosen from the following options: \c "api"\, \c
* "block"\, \c "checkpoint"\, \c "compact"\, \c "evict"\, \c
- * "evictserver"\, \c "fileops"\, \c "log"\, \c "lsm"\, \c
- * "lsm_manager"\, \c "metadata"\, \c "mutex"\, \c "overflow"\, \c
+ * "evictserver"\, \c "fileops"\, \c "handleops"\, \c "log"\, \c "lsm"\,
+ * \c "lsm_manager"\, \c "metadata"\, \c "mutex"\, \c "overflow"\, \c
* "read"\, \c "rebalance"\, \c "reconcile"\, \c "recovery"\, \c
* "salvage"\, \c "shared_cache"\, \c "split"\, \c "temporary"\, \c
* "transaction"\, \c "verify"\, \c "version"\, \c "write"; default
@@ -2417,10 +2417,10 @@ struct __wt_connection {
* list\, such as <code>"verbose=[evictserver\,read]"</code>., a list\, with
* values chosen from the following options: \c "api"\, \c "block"\, \c
* "checkpoint"\, \c "compact"\, \c "evict"\, \c "evictserver"\, \c "fileops"\,
- * \c "log"\, \c "lsm"\, \c "lsm_manager"\, \c "metadata"\, \c "mutex"\, \c
- * "overflow"\, \c "read"\, \c "rebalance"\, \c "reconcile"\, \c "recovery"\, \c
- * "salvage"\, \c "shared_cache"\, \c "split"\, \c "temporary"\, \c
- * "transaction"\, \c "verify"\, \c "version"\, \c "write"; default empty.}
+ * \c "handleops"\, \c "log"\, \c "lsm"\, \c "lsm_manager"\, \c "metadata"\, \c
+ * "mutex"\, \c "overflow"\, \c "read"\, \c "rebalance"\, \c "reconcile"\, \c
+ * "recovery"\, \c "salvage"\, \c "shared_cache"\, \c "split"\, \c "temporary"\,
+ * \c "transaction"\, \c "verify"\, \c "version"\, \c "write"; default empty.}
* @config{write_through, Use \c FILE_FLAG_WRITE_THROUGH on Windows to write to
* files. Ignored on non-Windows systems. Options are given as a list\, such
* as <code>"write_through=[data]"</code>. Configuring \c write_through requires
diff --git a/src/os_posix/os_dir.c b/src/os_posix/os_dir.c
index d38cc58d132..0fc27b947f1 100644
--- a/src/os_posix/os_dir.c
+++ b/src/os_posix/os_dir.c
@@ -37,13 +37,6 @@ __wt_posix_directory_list(WT_SESSION_IMPL *session, const char *dir,
dirallocsz = 0;
dirsz = 0;
entries = NULL;
- if (flags == 0)
- LF_SET(WT_DIRLIST_INCLUDE);
-
- WT_ERR(__wt_verbose(session, WT_VERB_FILEOPS,
- "wt_dirlist of %s %s prefix %s",
- path, LF_ISSET(WT_DIRLIST_INCLUDE) ? "include" : "exclude",
- prefix == NULL ? "all" : prefix));
WT_SYSCALL_RETRY(((dirp = opendir(path)) == NULL ? 1 : 0), ret);
if (ret != 0)
@@ -55,9 +48,9 @@ __wt_posix_directory_list(WT_SESSION_IMPL *session, const char *dir,
if (strcmp(dp->d_name, ".") == 0 ||
strcmp(dp->d_name, "..") == 0)
continue;
- match = false;
/* The list of files is optionally filtered by a prefix. */
+ match = false;
if (prefix != NULL &&
((LF_ISSET(WT_DIRLIST_INCLUDE) &&
WT_PREFIX_MATCH(dp->d_name, prefix)) ||
diff --git a/src/os_posix/os_fallocate.c b/src/os_posix/os_fallocate.c
index df4d76c3b3a..22879d36182 100644
--- a/src/os_posix/os_fallocate.c
+++ b/src/os_posix/os_fallocate.c
@@ -120,20 +120,14 @@ __wt_posix_handle_allocate(
* Check for already configured handles and make the configured call.
*/
case WT_FALLOCATE_POSIX:
- WT_RET(__wt_verbose(
- session, WT_VERB_FILEOPS, "%s: posix_fallocate", fh->name));
if ((ret = __posix_posix_fallocate(fh, offset, len)) == 0)
return (0);
WT_RET_MSG(session, ret, "%s: posix_fallocate", fh->name);
case WT_FALLOCATE_STD:
- WT_RET(__wt_verbose(
- session, WT_VERB_FILEOPS, "%s: fallocate", fh->name));
if ((ret = __posix_std_fallocate(fh, offset, len)) == 0)
return (0);
WT_RET_MSG(session, ret, "%s: fallocate", fh->name);
case WT_FALLOCATE_SYS:
- WT_RET(__wt_verbose(
- session, WT_VERB_FILEOPS, "%s: sys_fallocate", fh->name));
if ((ret = __posix_sys_fallocate(fh, offset, len)) == 0)
return (0);
WT_RET_MSG(session, ret, "%s: sys_fallocate", fh->name);
diff --git a/src/os_posix/os_open.c b/src/os_posix/os_open.c
index b98532afc02..69390039353 100644
--- a/src/os_posix/os_open.c
+++ b/src/os_posix/os_open.c
@@ -79,12 +79,86 @@ __wt_handle_search_unlock(WT_SESSION_IMPL *session)
}
/*
+ * __open_verbose --
+ * Optionally output a verbose message on handle open.
+ */
+static inline int
+__open_verbose(
+ WT_SESSION_IMPL *session, const char *name, int dio_type, uint32_t flags)
+{
+#ifdef HAVE_VERBOSE
+ if (!WT_VERBOSE_ISSET(session, WT_VERB_FILEOPS))
+ return (0);
+
+ /*
+ * It's useful to track file opens when debugging platforms, take some
+ * effort to output good tracking information.
+ */
+ WT_DECL_RET;
+ WT_DECL_ITEM(tmp);
+ const char *dio_type_tag, *sep;
+
+ switch (dio_type) {
+ case WT_FILE_TYPE_CHECKPOINT:
+ dio_type_tag = "checkpoint";
+ break;
+ case WT_FILE_TYPE_DATA:
+ dio_type_tag = "data";
+ break;
+ case WT_FILE_TYPE_DIRECTORY:
+ dio_type_tag = "directory";
+ break;
+ case WT_FILE_TYPE_LOG:
+ dio_type_tag = "log";
+ break;
+ case WT_FILE_TYPE_REGULAR:
+ dio_type_tag = "regular";
+ break;
+ default:
+ dio_type_tag = "unknown open type";
+ break;
+ }
+
+ sep = "";
+ WT_RET(__wt_scr_alloc(session, 0, &tmp));
+
+#define WT_OPEN_VERBOSE_FLAG(f, name) \
+ if (LF_ISSET(f)) { \
+ WT_ERR(__wt_buf_catfmt( \
+ session, tmp, "%s%s", sep, name)); \
+ sep = ","; \
+ }
+
+ WT_OPEN_VERBOSE_FLAG(WT_OPEN_CREATE, "create");
+ WT_OPEN_VERBOSE_FLAG(WT_OPEN_EXCLUSIVE, "exclusive");
+ WT_OPEN_VERBOSE_FLAG(WT_OPEN_FIXED, "fixed");
+ WT_OPEN_VERBOSE_FLAG(WT_OPEN_READONLY, "readonly");
+ WT_OPEN_VERBOSE_FLAG(WT_STREAM_APPEND, "stream-append");
+ WT_OPEN_VERBOSE_FLAG(WT_STREAM_READ, "stream-read");
+ WT_OPEN_VERBOSE_FLAG(WT_STREAM_WRITE, "stream-write");
+
+ ret = __wt_verbose(session, WT_VERB_FILEOPS,
+ "%s: handle-open: type %s, flags %s",
+ name, dio_type_tag, (char *)tmp->data);
+
+err: __wt_scr_free(session, &tmp);
+ return (ret);
+#else
+ WT_UNUSED(session);
+ WT_UNUSED(name);
+ WT_UNUSED(dio_type);
+ WT_UNUSED(flags);
+ return (0);
+#endif
+}
+
+/*
* __wt_open --
* Open a file handle.
*/
int
__wt_open(WT_SESSION_IMPL *session,
- const char *name, int dio_type, u_int flags, WT_FH **fhp)
+ const char *name, int dio_type, uint32_t flags, WT_FH **fhp)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
@@ -96,7 +170,7 @@ __wt_open(WT_SESSION_IMPL *session,
fh = NULL;
open_called = false;
- WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: open", name));
+ WT_RET(__open_verbose(session, name, dio_type, flags));
/* Check if the handle is already open. */
if (__wt_handle_search(session, name, true, true, NULL, &fh)) {
@@ -175,7 +249,9 @@ __wt_close(WT_SESSION_IMPL *session, WT_FH **fhp)
fh = *fhp;
*fhp = NULL;
- WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: close", fh->name));
+ /* Track handle-close as a file operation, so open and close match. */
+ WT_RET(__wt_verbose(
+ session, WT_VERB_FILEOPS, "%s: handle-close", fh->name));
/*
* If the reference count hasn't gone to 0, or if it's an in-memory
diff --git a/src/os_win/os_dir.c b/src/os_win/os_dir.c
index 083fbce97fc..4b538ca418d 100644
--- a/src/os_win/os_dir.c
+++ b/src/os_win/os_dir.c
@@ -44,13 +44,6 @@ __wt_win_directory_list(WT_SESSION_IMPL *session, const char *dir,
dirallocsz = 0;
dirsz = 0;
entries = NULL;
- if (flags == 0)
- LF_SET(WT_DIRLIST_INCLUDE);
-
- WT_ERR(__wt_verbose(session, WT_VERB_FILEOPS,
- "wt_dirlist of %s %s prefix %s",
- pathbuf->data, LF_ISSET(WT_DIRLIST_INCLUDE) ? "include" : "exclude",
- prefix == NULL ? "all" : prefix));
findhandle = FindFirstFileA(pathbuf->data, &finddata);
if (findhandle == INVALID_HANDLE_VALUE)