diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-02-17 17:25:57 +0000 |
|---|---|---|
| committer | <> | 2015-03-17 16:26:24 +0000 |
| commit | 780b92ada9afcf1d58085a83a0b9e6bc982203d1 (patch) | |
| tree | 598f8b9fa431b228d29897e798de4ac0c1d3d970 /src/rep/rep_log.c | |
| parent | 7a2660ba9cc2dc03a69ddfcfd95369395cc87444 (diff) | |
| download | berkeleydb-master.tar.gz | |
Diffstat (limited to 'src/rep/rep_log.c')
| -rw-r--r-- | src/rep/rep_log.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/rep/rep_log.c b/src/rep/rep_log.c index 42300685..bf72db9e 100644 --- a/src/rep/rep_log.c +++ b/src/rep/rep_log.c @@ -1,7 +1,7 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 2004, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved. * * $Id$ */ @@ -110,7 +110,7 @@ __rep_allreq(env, rp, eid) */ if (ret == 0 && repth.lsn.file != 1 && flags == DB_FIRST) { if (F_ISSET(rep, REP_F_CLIENT)) - ret = DB_NOTFOUND; + ret = USR_ERR(env, DB_NOTFOUND); else (void)__rep_send_message(env, eid, REP_VERIFY_FAIL, &repth.lsn, NULL, 0, 0); @@ -466,8 +466,8 @@ __rep_log_split(env, ip, rp, rec, ret_lsnp, last_lsnp) if (p >= ep && save_flags) F_SET(&tmprp, save_flags); /* - * A previous call to __rep_apply indicated an earlier - * record is a dup and the next_new_lsn we are waiting for. + * A previous call to __rep_apply indicated an earlier record + * is a past dup and the next_new_lsn for which we are waiting. * Skip log records until we catch up with next_new_lsn. */ if (is_dup && LOG_COMPARE(&tmprp.lsn, &next_new_lsn) < 0) { @@ -482,7 +482,20 @@ __rep_log_split(env, ip, rp, rec, ret_lsnp, last_lsnp) VPRINT(env, (env, DB_VERB_REP_MISC, "log_split: rep_apply ret %d, dup %d, tmp_lsn [%lu][%lu]", ret, is_dup, (u_long)tmp_lsn.file, (u_long)tmp_lsn.offset)); - if (is_dup) + /* + * We can skip log records between a past dup and tmp_lsn + * returned by rep_apply() because we know we have all + * those log records. For a past dup, this log record is + * less than or equal to tmp_lsn (which is either ready_lsn + * or max_perm_lsn) and we only have records to skip when + * it is less than tmp_lsn. + * + * We cannot skip log records for a future dup because we + * may not have all of them. In this case, this log record + * is greater than or equal to tmp_lsn (which is either + * ready_lsn or this log record). + */ + if (is_dup && LOG_COMPARE(&tmprp.lsn, &tmp_lsn) < 0) next_new_lsn = tmp_lsn; switch (ret) { /* @@ -637,7 +650,7 @@ __rep_logreq(env, rp, rec, eid) if (LOG_COMPARE(&firstlsn, &rp->lsn) > 0) { /* Case 3 */ if (F_ISSET(rep, REP_F_CLIENT)) { - ret = DB_NOTFOUND; + ret = USR_ERR(env, DB_NOTFOUND); goto err; } (void)__rep_send_message(env, eid, @@ -662,7 +675,7 @@ __rep_logreq(env, rp, rec, eid) ret = 0; goto err; } else - ret = DB_NOTFOUND; + ret = USR_ERR(env, DB_NOTFOUND); } } @@ -812,6 +825,14 @@ __rep_loggap_req(env, rep, lsnp, gapflags) ret = 0; /* + * If we are in SYNC_LOG and have all the log we need (i.e. + * rep->last_lsn is ZERO_LSN), just return, as there is nothing + * to do while recovery is running. + */ + if (rep->sync_state == SYNC_LOG && IS_ZERO_LSN(rep->last_lsn)) + return (0); + + /* * Check if we need to ask for the gap. * We ask for the gap if: * We are forced to with gapflags. @@ -1030,7 +1051,7 @@ __rep_chk_newfile(env, logc, rep, rp, eid) REP_VERIFY_FAIL, &rp->lsn, NULL, 0, 0); } else - ret = DB_NOTFOUND; + ret = USR_ERR(env, DB_NOTFOUND); } else { endlsn.offset += logc->len; if ((ret = __logc_version(logc, @@ -1054,7 +1075,7 @@ __rep_chk_newfile(env, logc, rep, rp, eid) } } } else - ret = DB_NOTFOUND; + ret = USR_ERR(env, DB_NOTFOUND); return (ret); } |
