diff options
Diffstat (limited to 'src/third_party/wiredtiger/src/log/log.c')
-rw-r--r-- | src/third_party/wiredtiger/src/log/log.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/third_party/wiredtiger/src/log/log.c b/src/third_party/wiredtiger/src/log/log.c index 118e081c3ec..3bf04d025d8 100644 --- a/src/third_party/wiredtiger/src/log/log.c +++ b/src/third_party/wiredtiger/src/log/log.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * @@ -47,7 +47,7 @@ __wt_log_flush_lsn(WT_SESSION_IMPL *session, WT_LSN *lsn, bool start) conn = S2C(session); log = conn->log; WT_RET(__wt_log_force_write(session, 1)); - WT_RET(__wt_log_wrlsn(session)); + WT_RET(__wt_log_wrlsn(session, NULL)); if (start) *lsn = log->write_start_lsn; else @@ -669,8 +669,7 @@ __log_openfile(WT_SESSION_IMPL *session, * check that the magic number and versions are correct. */ if (!ok_create) { - __wt_scr_free(session, &buf); - WT_ERR(__wt_scr_alloc(session, allocsize, &buf)); + WT_ERR(__wt_buf_grow(session, buf, allocsize)); memset(buf->mem, 0, allocsize); WT_ERR(__wt_read(session, *fh, 0, allocsize, buf->mem)); logrec = (WT_LOG_RECORD *)buf->mem; @@ -771,7 +770,7 @@ __log_newfile(WT_SESSION_IMPL *session, bool conn_open, bool *created) WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SLOT)); while (log->log_close_fh != NULL) { WT_STAT_FAST_CONN_INCR(session, log_close_yields); - WT_RET(__wt_log_wrlsn(session)); + WT_RET(__wt_log_wrlsn(session, NULL)); if (++yield_cnt > 10000) return (EBUSY); __wt_yield(); @@ -791,9 +790,10 @@ __log_newfile(WT_SESSION_IMPL *session, bool conn_open, bool *created) WT_FULL_BARRIER(); /* * If we're pre-allocating log files, look for one. If there aren't any - * or we're not pre-allocating, then create one. + * or we're not pre-allocating, or a backup cursor is open, then + * create one. */ - if (conn->log_prealloc > 0) { + if (conn->log_prealloc > 0 && !conn->hot_backup) { ret = __log_alloc_prealloc(session, log->fileid); /* * If ret is 0 it means we found a pre-allocated file. @@ -1120,7 +1120,7 @@ __wt_log_open(WT_SESSION_IMPL *session) * Start logging at the beginning of the next log file, no matter * where the previous log file ends. */ - WT_WITH_SLOT_LOCK(session, log, + WT_WITH_SLOT_LOCK(session, log, ret, ret = __log_newfile(session, true, NULL)); WT_ERR(ret); @@ -1970,6 +1970,14 @@ err: myslot.slot != NULL) ret = myslot.slot->slot_error; + /* + * If one of the sync flags is set, assert the proper LSN has moved to + * match. + */ + WT_ASSERT(session, !LF_ISSET(WT_LOG_FLUSH) || + __wt_log_cmp(&log->write_lsn, &lsn) >= 0); + WT_ASSERT(session, + !LF_ISSET(WT_LOG_FSYNC) || __wt_log_cmp(&log->sync_lsn, &lsn) >= 0); return (ret); } |