1N/A * See the file LICENSE for redistribution information. 1N/A * Copyright (c) 1996, 1997, 1998 1N/A * Sleepycat Software. All rights reserved. 1N/A#
endif /* not lint */ 1N/A * Looks for the most recent checkpoint that occurs before the most recent 1N/A * checkpoint LSN, subject to the constraint that there must be at least two 1N/A * checkpoints. The reason you need two checkpoints is that you might have 1N/A * crashed during the most recent one and may not have a copy of all the 1N/A * open files. This is the point from which recovery can start and the 1N/A * the log look like: 1N/A * ------------------------------------------------------------------- 1N/A * | ckp A, ckplsn 100 | .... record .... | ckp B, ckplsn 600 | ... 1N/A * ------------------------------------------------------------------- 1N/A * If we read what log returns from using the DB_CKP parameter to logput, 1N/A * we'll get the record at LSN 1000. The checkpoint LSN there is 600. 1N/A * Now we have to scan backwards looking for a checkpoint before LSN 600. 1N/A * We find one at 500. This means that we can truncate the log before 1N/A * 500 or run recovery beginning at 500. 1N/A * Returns 0 if we find a suitable checkpoint or we retrieved the 1N/A * first record in the log from which to start. 1N/A * Returns DB_NOTFOUND if there are no log records. 1N/A * Returns errno on error. 1N/A * PUBLIC: int __log_findckp __P((DB_LOG *, DB_LSN *)); 1N/A * Need to find the appropriate point from which to begin 1N/A * Keep looping until either you 1) run out of checkpoints, 1N/A * 2) you've found a checkpoint before the most recent 1N/A * checkpoint's LSN and you have at least 2 checkpoints. 1N/A * At this point, either, next_lsn is ZERO or ckp_lsn is the 1N/A * checkpoint lsn and last_ckp is the LSN of the last checkpoint 1N/A * before ckp_lsn. If the compare in the loop is still true, then 1N/A * next_lsn must be 0 and we need to roll forward from the 1N/A * beginning of the log.