Skip to content
Snippets Groups Projects
  • Vladimir Davydov's avatar
    2fbafbf5
    recovery: refactor recover_remaining_wals · 2fbafbf5
    Vladimir Davydov authored
     - 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().
    2fbafbf5
    History
    recovery: refactor recover_remaining_wals
    Vladimir Davydov authored
     - 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().