RemovePromoteSignalFiles函式強制刪除signaling standby promotion所要求的檔案。如果不刪除,這些檔案的存在會過早觸發promotion。刪除這些檔案通常是沒有必要的,因為它們僅在standby promotion過程中存在。然而會存在競態情況:
如果pg_ctl promote被執行並在提升過程中創建了這些文件,這些文件會存在,即使資料庫已經是新的master了。然後,新的standby使用該master產生的備份啟動,這些檔案會在資料庫啟動過程中存在,因此必須在這裡刪除以避免產生沒有必要的promotion。
void RemovePromoteSignalFiles(void){
unlink(PROMOTE_SIGNAL_FILE);
unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
}
同樣,對於日誌回捲的訊號檔案也需要操作
void RemoveLogrotateSignalFiles(void) {
unlink(LOGROTATE_SIGNAL_FILE);
}
文章為用戶上傳,僅供非商業瀏覽。發布者:Lomu,轉轉請註明出處: https://www.daogebangong.com/zh-Hant/articles/detail/PostgreSQL-shu-ju-ku-shou-hu-jin-cheng-Postmaster-shan-chu-ti-sheng-wen-jian.html
评论列表(196条)
测试