From 1e30ff33750b5a5885420654f6d39101b6cb8610 Mon Sep 17 00:00:00 2001 From: sueloverso Date: Tue, 7 Jun 2016 22:26:44 -0400 Subject: WT-2652 Remove unnecessary wt_ftruncate call. (#2786) Make file length the actual maximum set, not the maximum plus the header record. --- dist/s_string.ok | 1 + src/log/log.c | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/s_string.ok b/dist/s_string.ok index 44fd6718ed7..61bb246c59b 100644 --- a/dist/s_string.ok +++ b/dist/s_string.ok @@ -1090,6 +1090,7 @@ unescaped unicode uninstantiated unistd +unlink unlinked unmap unmarshall diff --git a/src/log/log.c b/src/log/log.c index fd2b3444398..073dc5b2025 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -447,12 +447,12 @@ __log_prealloc(WT_SESSION_IMPL *session, WT_FH *fh) * writes happening concurrently, so there are no locking issues. */ if ((ret = __wt_fallocate( - session, fh, WT_LOG_FIRST_RECORD, conn->log_file_max)) == 0) + session, fh, WT_LOG_FIRST_RECORD, + conn->log_file_max - WT_LOG_FIRST_RECORD)) == 0) return (0); WT_RET_ERROR_OK(ret, ENOTSUP); - return (__wt_ftruncate( - session, fh, WT_LOG_FIRST_RECORD + conn->log_file_max)); + return (__wt_ftruncate(session, fh, conn->log_file_max)); } /* @@ -1029,7 +1029,6 @@ __wt_log_allocfile( */ WT_ERR(__log_openfile(session, true, &log_fh, WT_LOG_TMPNAME, tmp_id)); WT_ERR(__log_file_header(session, log_fh, NULL, true)); - WT_ERR(__wt_ftruncate(session, log_fh, WT_LOG_FIRST_RECORD)); WT_ERR(__log_prealloc(session, log_fh)); WT_ERR(__wt_fsync(session, log_fh, true)); WT_ERR(__wt_close(session, &log_fh)); -- cgit v1.2.1