RemovePromoteSignalFiles function forcibly deletes files requested by signaling standby promotion. If not deleted, the presence of these files will trigger promotion prematurely. Deleting these files is usually not necessary because they only exist during the standby promotion process. However, there will be a race condition:
If pg_ctl promote is executed and these files are created during the promotion process, these files will exist even if the database is already a new master. Then, the new standby is started using the backup generated by the master. These files will exist during the database startup process, so they must be deleted here to avoid unnecessary promotion.
void RemovePromoteSignalFiles(void){
unlink(PROMOTE_SIGNAL_FILE);
unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
}
Similarly, the signal file for log rollback also needs to be operated
void RemoveLogrotateSignalFiles(void) {
unlink(LOGROTATE_SIGNAL_FILE);
}
Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/PostgreSQL-shu-ju-ku-shou-hu-jin-cheng-Postmaster-shan-chu-ti-sheng-wen-jian.html
评论列表(196条)
测试