@sueloverso, I'm confused by this code in __log_truncate:
/* * Truncate the log file to the given LSN. */ WT_ERR(__log_openfile(session, 0, &log_fh, file_prefix, lsn->file)); WT_ERR(__wt_ftruncate(session, log_fh, lsn->offset)); tmp_fh = log_fh; log_fh = NULL; WT_ERR(__wt_fsync(session, tmp_fh)); WT_ERR(__wt_close(session, &tmp_fh));
Why are we copying log_fh to tmp_fh, then closing tmp_fh?
If it's got something to do with the error path, I think it's not right, because if the *wt_fsync fails, then we won't close the file in the error path. I think it's safe to call *wt_close multiple times:
567c567 < WT_FH *log_fh, *tmp_fh; --- > WT_FH *log_fh; 584,587c584,585 < tmp_fh = log_fh; < log_fh = NULL; < WT_ERR(__wt_fsync(session, tmp_fh)); < WT_ERR(__wt_close(session, &tmp_fh)); --- > WT_ERR__wt_fsync(session, log_fh); > WT_ERR(__wt_close(session, &log_fh)); 608,611c606,607 < tmp_fh = log_fh; < log_fh = NULL; < WT_ERR(__wt_fsync(session, tmp_fh)); < WT_ERR(__wt_close(session, &tmp_fh)); --- > WT_ERR(__wt_fsync(session, log_fh); > WT_ERR(__wt_close(session, &log_fh));
- is depended on by
-
SERVER-18199 WiredTiger changes for MongoDB 3.1.2
- Closed