Skip to content
Snippets Groups Projects
Commit 2fbafbf5 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Konstantin Osipov
Browse files

recovery: refactor recover_remaining_wals

 - Fold in wal dir scan. It's pretty easy to detect if we need to rescan
   wal dir - we do iff the current wal is closed (if it isn't, we need
   to recover it first), so there's no point in keeping it apart.

 - Close the last recovered wal on eof. We don't close it to avoid
   rereading it in case recover_remaining_wals() is called again before
   a new wal is added to wal dir. We can detect this case by checking if
   the signature of the last wal stored in wal dir has increased after
   rescanning the dir.

 - Don't abort recovery and print 'xlog is deleted under our feet'
   message if current wal file is removed. This is pointless, really -
   it's OK to remove an open file in Unix. Besides, the check for
   deleted file is only relevant if wal dir has been rescanned, which is
   only done when we proceed to the next wal, i.e. it doesn't really
   detect anything.

A good side effect of this rework is that now we can invoke garbage
collector right from recovery_close_log().
parent ff025349
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment