初步学习pg_control文件之十三

接前文,初步学习pg_control文件之十二

看这个:

    * backupStartPoint is the redo pointer of the backup start checkpoint, if
     * we are recovering from an online backup and haven't reached the end of
     * backup yet. It is reset to zero when the end of backup is reached, and
     * we mustn't start up before that. A boolean would suffice otherwise, but
     * we use the redo pointer as a cross-check when we see an end-of-backup
     * record, to make sure the end-of-backup record corresponds the base
     * backup we're recovering from.
     */
    ...
    XLogRecPtr    backupStartPoint;

是说如果处在online backup中时会使用它。只有下面一个地方进行了赋值:

/*                                    
 * This must be called ONCE during postmaster or standalone-backend startup                                    
 */                                    
void                                    
StartupXLOG(void)                                    
{                                    
    …                                
                                    
    /* REDO */                                
    if (InRecovery)                                
    {                                
        …                            
        /*                            
         * Set backupStartPoint if we're starting recovery from a base backup.                            
         * However, if there was no recovery.conf, and the backup was taken                            
         * with pg_start_backup(), we don't know if the server crashed before                            
         * the backup was finished and we're doing crash recovery on the                            
         * original server, or if we're restoring from the base backup. We                            
         * have to assume we're doing crash recovery in that case, or the                            
         * database would refuse to start up after a crash.                            
         */                            
        if ((InArchiveRecovery && haveBackupLabel) || backupEndRequired)                            
            ControlFile->backupStartPoint = checkPoint.redo;                        
                                    
        ControlFile->time = (pg_time_t) time(NULL);                            
        /* No need to hold ControlFileLock yet, we aren't up far enough */                            
        UpdateControlFile();                            
        …                            
    }                                
                                    
    …                                
}                                    

 

你可能感兴趣的:(文件)