Michael Cahill I have a pull request open to address the second issue. I have also put a separate commit on that branch to address the first issue. The description for the first issue is below.
Although I haven't been able to force the situation, what I think happened in the first piece of this issue (checkpoint LSN in log file 6, only log files up to 5 exist after crash) is this:
We saved the checkpoint LSN, which is 6,N (where N is pretty small, early in log file 6). Log file 6, having recently been created, is not synced. That is neither its contents nor its entry in the parent directory. The LSN gets written to the metadata file for the table(s) and the metadata itself. The metadata and turtle files are sync'ed to disk. Then, before the checkpoint log record gets written (with SYNC set), the crash happens. The metadata on disk is in log file 6, but the logging sync hasn't happened yet, so log file 6 does not exist.
My fix is to force a sync of the logging directory and log file at the beginning of the checkpoint, where we record the ckpt_lsn so that once the checkpoint starts, we're guaranteed the log file in the metadata exists.