diff options
author | Ramon Fernandez <ramon@mongodb.com> | 2015-11-03 10:38:17 -0500 |
---|---|---|
committer | Ramon Fernandez <ramon@mongodb.com> | 2015-11-03 10:38:17 -0500 |
commit | 26be64f75efd0e1de560bb2ac8c23c33c536ad0e (patch) | |
tree | 51812f9d8d0d8f16051df4bf597c454dfb4cf275 /src/third_party/wiredtiger | |
parent | 0899ba98f6311df0db8499cc7e0d56f563daea5f (diff) | |
download | mongo-26be64f75efd0e1de560bb2ac8c23c33c536ad0e.tar.gz |
Import wiredtiger-wiredtiger-mongodb-3.2.0-rc1-215-g465dca8.tar.gz from wiredtiger branch mongodb-3.2
Diffstat (limited to 'src/third_party/wiredtiger')
-rw-r--r-- | src/third_party/wiredtiger/src/block/block_open.c | 6 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/extern.h | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/lsm/lsm_tree.c | 5 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/meta/meta_track.c | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/os_posix/os_filesize.c | 15 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/os_win/os_filesize.c | 20 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/schema/schema_stat.c | 16 |
7 files changed, 38 insertions, 28 deletions
diff --git a/src/third_party/wiredtiger/src/block/block_open.c b/src/third_party/wiredtiger/src/block/block_open.c index e97e86d9aaa..7cf12d36066 100644 --- a/src/third_party/wiredtiger/src/block/block_open.c +++ b/src/third_party/wiredtiger/src/block/block_open.c @@ -422,13 +422,9 @@ int __wt_block_manager_size( WT_SESSION_IMPL *session, const char *filename, WT_DSRC_STATS *stats) { - WT_DECL_RET; wt_off_t filesize; - ret = __wt_filesize_name(session, filename, &filesize); - if (ret != 0) - WT_RET_MSG(session, ret, "%s: file size", filename); - + WT_RET(__wt_filesize_name(session, filename, false, &filesize)); stats->block_size = filesize; return (0); diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index 4c934f95c2b..75064c56334 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -477,7 +477,7 @@ extern int __wt_exist(WT_SESSION_IMPL *session, const char *filename, bool *exis extern void __wt_fallocate_config(WT_SESSION_IMPL *session, WT_FH *fh); extern int __wt_fallocate( WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset, wt_off_t len); extern int __wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t *sizep); -extern int __wt_filesize_name( WT_SESSION_IMPL *session, const char *filename, wt_off_t *sizep); +extern int __wt_filesize_name(WT_SESSION_IMPL *session, const char *filename, bool silent, wt_off_t *sizep); extern int __wt_bytelock(WT_FH *fhp, wt_off_t byte, bool lock); extern int __wt_directory_sync_fh(WT_SESSION_IMPL *session, WT_FH *fh); extern int __wt_directory_sync(WT_SESSION_IMPL *session, char *path); diff --git a/src/third_party/wiredtiger/src/lsm/lsm_tree.c b/src/third_party/wiredtiger/src/lsm/lsm_tree.c index 7371f3a407c..30af051bbcf 100644 --- a/src/third_party/wiredtiger/src/lsm/lsm_tree.c +++ b/src/third_party/wiredtiger/src/lsm/lsm_tree.c @@ -213,7 +213,6 @@ int __wt_lsm_tree_set_chunk_size( WT_SESSION_IMPL *session, WT_LSM_CHUNK *chunk) { - WT_DECL_RET; wt_off_t size; const char *filename; @@ -221,9 +220,7 @@ __wt_lsm_tree_set_chunk_size( if (!WT_PREFIX_SKIP(filename, "file:")) WT_RET_MSG(session, EINVAL, "Expected a 'file:' URI: %s", chunk->uri); - ret = __wt_filesize_name(session, filename, &size); - if (ret != 0) - WT_RET_MSG(session, ret, "%s: file size", filename); + WT_RET(__wt_filesize_name(session, filename, false, &size)); chunk->size = (uint64_t)size; diff --git a/src/third_party/wiredtiger/src/meta/meta_track.c b/src/third_party/wiredtiger/src/meta/meta_track.c index 1a773ef67c4..ea1757129c5 100644 --- a/src/third_party/wiredtiger/src/meta/meta_track.c +++ b/src/third_party/wiredtiger/src/meta/meta_track.c @@ -471,7 +471,7 @@ __wt_meta_track_handle_lock(WT_SESSION_IMPL *session, bool created) /* * __wt_meta_track_init -- - * Intialize metadata tracking. + * Initialize metadata tracking. */ int __wt_meta_track_init(WT_SESSION_IMPL *session) diff --git a/src/third_party/wiredtiger/src/os_posix/os_filesize.c b/src/third_party/wiredtiger/src/os_posix/os_filesize.c index 09174ffcd90..c58f73b0665 100644 --- a/src/third_party/wiredtiger/src/os_posix/os_filesize.c +++ b/src/third_party/wiredtiger/src/os_posix/os_filesize.c @@ -34,8 +34,8 @@ __wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t *sizep) * Return the size of a file in bytes, given a file name. */ int -__wt_filesize_name( - WT_SESSION_IMPL *session, const char *filename, wt_off_t *sizep) +__wt_filesize_name(WT_SESSION_IMPL *session, + const char *filename, bool silent, wt_off_t *sizep) { struct stat sb; WT_DECL_RET; @@ -47,9 +47,16 @@ __wt_filesize_name( __wt_free(session, path); - if (ret == 0) + if (ret == 0) { *sizep = sb.st_size; + return (0); + } - /* Some callers expect failure, so don't log an error message. */ + /* + * Some callers of this function expect failure if the file doesn't + * exist, and don't want an error message logged. + */ + if (!silent) + WT_RET_MSG(session, ret, "%s: fstat", filename); return (ret); } diff --git a/src/third_party/wiredtiger/src/os_win/os_filesize.c b/src/third_party/wiredtiger/src/os_win/os_filesize.c index c51303d7215..7f231b5ba9a 100644 --- a/src/third_party/wiredtiger/src/os_win/os_filesize.c +++ b/src/third_party/wiredtiger/src/os_win/os_filesize.c @@ -15,8 +15,8 @@ int __wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t *sizep) { - WT_DECL_RET; LARGE_INTEGER size; + WT_DECL_RET; WT_RET(__wt_verbose( session, WT_VERB_FILEOPS, "%s: GetFileSizeEx", fh->name)); @@ -34,11 +34,11 @@ __wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t *sizep) * Return the size of a file in bytes, given a file name. */ int -__wt_filesize_name( - WT_SESSION_IMPL *session, const char *filename, wt_off_t *sizep) +__wt_filesize_name(WT_SESSION_IMPL *session, + const char *filename, bool silent, wt_off_t *sizep) { - WT_DECL_RET; WIN32_FILE_ATTRIBUTE_DATA data; + WT_DECL_RET; char *path; WT_RET(__wt_filename(session, filename, &path)); @@ -47,10 +47,18 @@ __wt_filesize_name( __wt_free(session, path); - if (ret != 0) + if (ret != 0) { *sizep = ((int64_t)data.nFileSizeHigh << 32) | data.nFileSizeLow; + return (0); + } - /* Some callers expect failure, so don't log an error message. */ + /* + * Some callers of this function expect failure if the file doesn't + * exist, and don't want an error message logged. + */ + ret = __wt_errno(); + if (!silent) + WT_RET_MSG(session, ret, "%s: GetFileAttributesEx", filename); return (ret); } diff --git a/src/third_party/wiredtiger/src/schema/schema_stat.c b/src/third_party/wiredtiger/src/schema/schema_stat.c index 355abf8f343..88f92b71599 100644 --- a/src/third_party/wiredtiger/src/schema/schema_stat.c +++ b/src/third_party/wiredtiger/src/schema/schema_stat.c @@ -89,6 +89,7 @@ __curstat_size_only(WT_SESSION_IMPL *session, /* Build up the file name from the table URI. */ WT_ERR(__wt_buf_fmt( session, &namebuf, "%s.wt", uri + strlen("table:"))); + /* * Get the size of the underlying file. This will fail for anything * other than simple tables (LSM for example) and will fail if there @@ -96,13 +97,14 @@ __curstat_size_only(WT_SESSION_IMPL *session, * fine - failing here results in falling back to the slow path of * opening the handle. */ - if (__wt_filesize_name(session, namebuf.data, &filesize) == 0) { - /* Setup and populate the statistics structure */ - __wt_stat_dsrc_init_single(&cst->u.dsrc_stats); - cst->u.dsrc_stats.block_size = filesize; - __wt_curstat_dsrc_final(cst); - *was_fast = true; - } + WT_ERR(__wt_filesize_name(session, namebuf.data, true, &filesize)); + + /* Setup and populate the statistics structure */ + __wt_stat_dsrc_init_single(&cst->u.dsrc_stats); + cst->u.dsrc_stats.block_size = filesize; + __wt_curstat_dsrc_final(cst); + + *was_fast = true; err: __wt_free(session, tableconf); __wt_buf_free(session, &namebuf); |