diff options
author | Susan LoVerso <sue@wiredtiger.com> | 2015-04-17 10:49:41 -0400 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-04-25 12:50:52 +1000 |
commit | 1558eca2835e2ffa317975652a7a1c45edc56e7b (patch) | |
tree | ed02986ae1eba6fb43020e50d420a20f43bf795e | |
parent | f141e80438f151938599b0040ba272301b904fea (diff) | |
download | mongo-1558eca2835e2ffa317975652a7a1c45edc56e7b.tar.gz |
Look for any number of non-data-changing log records to determine if we
can skip recovery. WT-1892
-rw-r--r-- | src/log/log.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/log/log.c b/src/log/log.c index 876da244794..0cbeaef061e 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -63,31 +63,30 @@ __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, int *rec) return (0); /* - * The LSN is the last written log record before the checkpoint. - * See if the next record after that is a checkpoint and it is - * the last record. That is the only case where we can skip. + * See if there are any data modification records between the + * checkpoint LSN and the end of the log. If there are none then + * we can skip recovery. */ WT_RET(__wt_curlog_open(session, "log:", NULL, &c)); c->set_key(c, ckp_lsn->file, ckp_lsn->offset, 0); if ((ret = c->search(c)) == 0) { - if ((ret = c->next(c)) == 0) { + while ((ret = c->next(c)) == 0) { /* * The only thing we care about is the rectype. */ WT_ERR(c->get_value(c, &dummy_txnid, &rectype, &dummy_optype, &dummy_fileid, &dummy_key, &dummy_value)); - /* - * Only if the record is a checkpoint and it is the - * last record can we skip. - */ - if (rectype == WT_LOGREC_CHECKPOINT && - (ret = c->next(c)) == WT_NOTFOUND) { - *rec = 0; - ret = 0; - } - } else if (ret == WT_NOTFOUND) + if (rectype == WT_LOGREC_COMMIT) + break; + } + /* + * If we get to the end of the log, we can skip recovery. + */ + if (ret == WT_NOTFOUND) { + *rec = 0; ret = 0; + } } else if (ret == WT_NOTFOUND) /* * We should always find the checkpoint LSN as it now points |