diff options
| author | David Hows <david.hows@mongodb.com> | 2017-01-06 12:12:50 +1100 |
|---|---|---|
| committer | David Hows <david.hows@mongodb.com> | 2017-01-06 12:12:50 +1100 |
| commit | d48181f6f4db08761ed7b80b0332908b272ad0d0 (patch) | |
| tree | 38929fdcc5415ee7b001b6f1a406bd5bd777b737 /src/log | |
| parent | 040e3d6f764c0fb626cb47fede54469f57d0c6e0 (diff) | |
| parent | 8d2324943364286056ae399043f70b8a937de312 (diff) | |
Merge branch 'mongodb-3.6' into mongodb-3.2mongodb-3.2.12
Diffstat (limited to 'src/log')
| -rw-r--r-- | src/log/log.c | 6 | ||||
| -rw-r--r-- | src/log/log_slot.c | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/log/log.c b/src/log/log.c index 8b6c8b2c490..413df312a15 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -159,6 +159,7 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn) uint64_t fsync_duration_usecs; log = S2C(session)->log; + log_fh = NULL; /* * We need to wait for the previous log file to get written @@ -214,11 +215,12 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn) WT_STAT_CONN_INCR(session, log_sync); WT_STAT_CONN_INCRV(session, log_sync_duration, fsync_duration_usecs); - WT_ERR(__wt_close(session, &log_fh)); __wt_cond_signal(session, log->log_sync_cond); } err: __wt_spin_unlock(session, &log->log_sync_lock); + if (log_fh != NULL) + WT_TRET(__wt_close(session, &log_fh)); return (ret); } @@ -1274,7 +1276,7 @@ __wt_log_open(WT_SESSION_IMPL *session) * where the previous log file ends. */ if (!F_ISSET(conn, WT_CONN_READONLY)) { - WT_WITH_SLOT_LOCK(session, log, ret, + WT_WITH_SLOT_LOCK(session, log, ret = __log_newfile(session, true, NULL)); WT_ERR(ret); } diff --git a/src/log/log_slot.c b/src/log/log_slot.c index c79805f5371..a29a34e5652 100644 --- a/src/log/log_slot.c +++ b/src/log/log_slot.c @@ -197,7 +197,7 @@ __wt_log_slot_switch( * because we are responsible for setting up the new slot. */ do { - WT_WITH_SLOT_LOCK(session, log, ret, + WT_WITH_SLOT_LOCK(session, log, ret = __log_slot_switch_internal(session, myslot, forced)); if (ret == EBUSY) { WT_STAT_CONN_INCR(session, log_slot_switch_busy); @@ -283,7 +283,6 @@ __wt_log_slot_init(WT_SESSION_IMPL *session) conn = S2C(session); log = conn->log; - WT_CACHE_LINE_ALIGNMENT_VERIFY(session, log->slot_pool); for (i = 0; i < WT_SLOT_POOL; i++) log->slot_pool[i].slot_state = WT_LOG_SLOT_FREE; @@ -360,8 +359,7 @@ __wt_log_slot_destroy(WT_SESSION_IMPL *session) /* * __wt_log_slot_join -- - * Join a consolidated logging slot. Must be called with - * the read lock held. + * Join a consolidated logging slot. */ void __wt_log_slot_join(WT_SESSION_IMPL *session, uint64_t mysize, @@ -379,11 +377,6 @@ __wt_log_slot_join(WT_SESSION_IMPL *session, uint64_t mysize, conn = S2C(session); log = conn->log; - /* - * Make sure the length cannot overflow. The caller should not - * even call this function if it doesn't fit but use direct - * writes. - */ WT_ASSERT(session, !F_ISSET(session, WT_SESSION_LOCKED_SLOT)); /* @@ -469,6 +462,11 @@ __wt_log_slot_release(WT_SESSION_IMPL *session, WT_MYSLOT *myslot, int64_t size) WT_UNUSED(session); slot = myslot->slot; my_start = slot->slot_start_offset + myslot->offset; + /* + * We maintain the last starting offset within this slot. + * This is used to know the offset of the last record that + * was written rather than the beginning record of the slot. + */ while ((cur_offset = slot->slot_last_offset) < my_start) { /* * Set our offset if we are larger. |
