中文字幕日韩精品一区二区免费_精品一区二区三区国产精品无卡在_国精品无码专区一区二区三区_国产αv三级中文在线

PostgreSQLcheckpoint--shutdown

PostgreSQL在shutdown時(shí)會(huì)進(jìn)行checkpoint。其流程如下。

成都創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),察隅企業(yè)網(wǎng)站建設(shè),察隅品牌網(wǎng)站建設(shè),網(wǎng)站定制,察隅網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷(xiāo),網(wǎng)絡(luò)優(yōu)化,察隅網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專(zhuān)業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

1、在主進(jìn)程中,會(huì)首先注冊(cè)一個(gè)信號(hào)處理函數(shù)reaper,用于向checkpoint等子進(jìn)程發(fā)送信號(hào)。向checkpoint進(jìn)程發(fā)送SIGUSR2信號(hào)

PostmasterMain(int argc, char argv[])
pqsignal_no_restart(SIGCHLD, reaper); /
handle child termination */
reaper:
while ((pid = waitpid(-1, &exitstatus, WNOHANG)) > 0){
...
if (pid == CheckpointerPID){
...
SignalChildren(SIGUSR2);
}
...
}
...
PostmasterStateMachine();//向checkpoint進(jìn)程發(fā)送SIGUSR2信號(hào)
|-----------------------
| if (pmState == PM_WAIT_BACKENDS){
| if (CountChildren(BACKEND_TYPE_NORMAL | BACKEND_TYPE_WORKER) == 0 &&
| StartupPID == 0 &&
| WalReceiverPID == 0 &&
| BgWriterPID == 0 &&
| (CheckpointerPID == 0 ||(!FatalError && Shutdown < ImmediateShutdown)) &&
| WalWriterPID == 0 &&
| AutoVacPID == 0){
| //pg_ctl stop -m immediate不會(huì)向checkpoint進(jìn)程發(fā)送信號(hào),即不會(huì)做checkpoint
| if (Shutdown >= ImmediateShutdown || FatalError){
| pmState = PM_WAIT_DEAD_END;
| }else{
| if (CheckpointerPID != 0){
| signal_child(CheckpointerPID, SIGUSR2);
| pmState = PM_SHUTDOWN;
| }
}
| }
|-------}
2、checkpoint進(jìn)程,也會(huì)注冊(cè)一個(gè)信號(hào)處理函數(shù)ReqShutdownHandler,用于處理主進(jìn)程發(fā)送過(guò)來(lái)的SIGUSR2信號(hào)。接收到該信號(hào)后將shutdown_requested置為T(mén)RUE。在checkpoint進(jìn)程的for循環(huán)中,如果shutdown_requested為T(mén)RUE,則進(jìn)入shutdown流程:stop每個(gè)sender進(jìn)程,所有sender進(jìn)程stop后,根據(jù)條件進(jìn)行checkpoint:CreateRestartPoint后者CreateCheckPoint

CheckpointerMain(void)->
//為信號(hào)SIGUSR2安裝信號(hào)處理函數(shù)ReqShutdownHandler
pqsignal(SIGUSR2, ReqShutdownHandler); / request shutdown /
...
for (;;){
if (shutdown_requested){
/ Close down the database /
ShutdownXLOG(0, 0);
|-- WalSndInitStopping();//向每個(gè)sender進(jìn)程發(fā)送信號(hào)修改到stopping狀態(tài)
| WalSndWaitStopping();
| if (RecoveryInProgress())
| CreateRestartPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE);
| else{
| if (XLogArchivingActive() && XLogArchiveCommandSet())
| RequestXLogSwitch(false);
| CreateCheckPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE);
| }
|-- ...
proc_exit(0);
}
...
checkpoint
}
3、ReqShutdownHandler函數(shù)將shutdown_requested置為T(mén)RUE

ReqShutdownHandler(SIGNAL_ARGS)
{
shutdown_requested = true;
SetLatch(MyLatch);
}
?

名稱(chēng)欄目:PostgreSQLcheckpoint--shutdown
網(wǎng)站網(wǎng)址:http://www.rwnh.cn/article44/gdiphe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站維護(hù)、云服務(wù)器、全網(wǎng)營(yíng)銷(xiāo)推廣、域名注冊(cè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)
阳信县| 红安县| 两当县| 康平县| 修水县| 乡城县| 米易县| 平安县| 乌兰察布市| 丹江口市| 淮滨县| 长海县| 平武县| 新乡市| 十堰市| 嘉祥县| 集安市| 湘西| 宁国市| 平罗县| 册亨县| 乃东县| 古交市| 扎赉特旗| 阜南县| 新营市| 防城港市| 台州市| 贺兰县| 新郑市| 巴马| 和林格尔县| 唐河县| 辽宁省| 舒兰市| 中宁县| 铁岭县| 利津县| 甘孜县| 连州市| 宜宾县|