Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb5310e4

Browse files
committed
Remove non-fast promotion.
When fast promotion was supported in 9.3, non-fast promotion becameundocumented feature and it's basically not available for ordinary users.However we decided not to remove non-fast promotion at that moment,to leave it for a release or two for debugging purpose or as an emergencymethod because fast promotion might have some issues, and then toremove it later. Now, several versions were released since that decisionand there is no longer reason to keep supporting non-fast promotion.Therefore this commit removes non-fast promotion.Author: Fujii MasaoReviewed-by: Hamid Akhtar, Kyotaro HoriguchiDiscussion:https://postgr.es/m/76066434-648f-f567-437b-54853b43398f@oss.nttdata.com
1 parent9878b64 commitb5310e4

File tree

4 files changed

+17
-44
lines changed

4 files changed

+17
-44
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,6 @@ boolwal_receiver_create_temp_slot = false;
299299
/* are we currently in standby mode? */
300300
boolStandbyMode= false;
301301

302-
/* whether request for fast promotion has been made yet */
303-
staticboolfast_promote= false;
304-
305302
/*
306303
* if recoveryStopsBefore/After returns true, it saves information of the stop
307304
* point here
@@ -6322,7 +6319,7 @@ StartupXLOG(void)
63226319
DBStatedbstate_at_startup;
63236320
XLogReaderState*xlogreader;
63246321
XLogPageReadPrivateprivate;
6325-
boolfast_promoted= false;
6322+
boolpromoted= false;
63266323
structstatst;
63276324

63286325
/*
@@ -7727,14 +7724,14 @@ StartupXLOG(void)
77277724
* the rule that TLI only changes in shutdown checkpoints, which
77287725
* allows some extra error checking in xlog_redo.
77297726
*
7730-
* Infastpromotion, only create a lightweight end-of-recovery record
7727+
* In promotion, only create a lightweight end-of-recovery record
77317728
* instead of a full checkpoint. A checkpoint is requested later,
77327729
* after we're fully out of recovery mode and already accepting
77337730
* queries.
77347731
*/
77357732
if (bgwriterLaunched)
77367733
{
7737-
if (fast_promote)
7734+
if (LocalPromoteIsTriggered)
77387735
{
77397736
checkPointLoc=ControlFile->checkPoint;
77407737

@@ -7745,7 +7742,7 @@ StartupXLOG(void)
77457742
record=ReadCheckpointRecord(xlogreader,checkPointLoc,1, false);
77467743
if (record!=NULL)
77477744
{
7748-
fast_promoted= true;
7745+
promoted= true;
77497746

77507747
/*
77517748
* Insert a special WAL record to mark the end of
@@ -7762,7 +7759,7 @@ StartupXLOG(void)
77627759
}
77637760
}
77647761

7765-
if (!fast_promoted)
7762+
if (!promoted)
77667763
RequestCheckpoint(CHECKPOINT_END_OF_RECOVERY |
77677764
CHECKPOINT_IMMEDIATE |
77687765
CHECKPOINT_WAIT);
@@ -7953,12 +7950,12 @@ StartupXLOG(void)
79537950
WalSndWakeup();
79547951

79557952
/*
7956-
* If this was afastpromotion, request an (online) checkpoint now. This
7953+
* If this was a promotion, request an (online) checkpoint now. This
79577954
* isn't required for consistency, but the last restartpoint might be far
79587955
* back, and in case of a crash, recovering from it might take a longer
79597956
* than is appropriate now that we're not in standby mode anymore.
79607957
*/
7961-
if (fast_promoted)
7958+
if (promoted)
79627959
RequestCheckpoint(CHECKPOINT_FORCE);
79637960
}
79647961

@@ -12592,29 +12589,10 @@ CheckForStandbyTrigger(void)
1259212589
if (LocalPromoteIsTriggered)
1259312590
return true;
1259412591

12595-
if (IsPromoteSignaled())
12592+
if (IsPromoteSignaled()&&CheckPromoteSignal())
1259612593
{
12597-
/*
12598-
* In 9.1 and 9.2 the postmaster unlinked the promote file inside the
12599-
* signal handler. It now leaves the file in place and lets the
12600-
* Startup process do the unlink. This allows Startup to know whether
12601-
* it should create a full checkpoint before starting up (fallback
12602-
* mode). Fast promotion takes precedence.
12603-
*/
12604-
if (stat(PROMOTE_SIGNAL_FILE,&stat_buf)==0)
12605-
{
12606-
unlink(PROMOTE_SIGNAL_FILE);
12607-
unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
12608-
fast_promote= true;
12609-
}
12610-
elseif (stat(FALLBACK_PROMOTE_SIGNAL_FILE,&stat_buf)==0)
12611-
{
12612-
unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
12613-
fast_promote= false;
12614-
}
12615-
1261612594
ereport(LOG, (errmsg("received promote request")));
12617-
12595+
RemovePromoteSignalFiles();
1261812596
ResetPromoteSignaled();
1261912597
SetPromoteIsTriggered();
1262012598
return true;
@@ -12629,7 +12607,6 @@ CheckForStandbyTrigger(void)
1262912607
(errmsg("promote trigger file found: %s",PromoteTriggerFile)));
1263012608
unlink(PromoteTriggerFile);
1263112609
SetPromoteIsTriggered();
12632-
fast_promote= true;
1263312610
return true;
1263412611
}
1263512612
elseif (errno!=ENOENT)
@@ -12648,20 +12625,17 @@ void
1264812625
RemovePromoteSignalFiles(void)
1264912626
{
1265012627
unlink(PROMOTE_SIGNAL_FILE);
12651-
unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
1265212628
}
1265312629

1265412630
/*
12655-
* Check to see if a promote request has arrived. Should be
12656-
* called by postmaster after receiving SIGUSR1.
12631+
* Check to see if a promote request has arrived.
1265712632
*/
1265812633
bool
1265912634
CheckPromoteSignal(void)
1266012635
{
1266112636
structstatstat_buf;
1266212637

12663-
if (stat(PROMOTE_SIGNAL_FILE,&stat_buf)==0||
12664-
stat(FALLBACK_PROMOTE_SIGNAL_FILE,&stat_buf)==0)
12638+
if (stat(PROMOTE_SIGNAL_FILE,&stat_buf)==0)
1266512639
return true;
1266612640

1266712641
return false;

‎src/backend/postmaster/postmaster.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5333,7 +5333,12 @@ sigusr1_handler(SIGNAL_ARGS)
53335333
pmState==PM_HOT_STANDBY||pmState==PM_WAIT_READONLY)&&
53345334
CheckPromoteSignal())
53355335
{
5336-
/* Tell startup process to finish recovery */
5336+
/*
5337+
* Tell startup process to finish recovery.
5338+
*
5339+
* Leave the promote signal file in place and let the Startup
5340+
* process do the unlink.
5341+
*/
53375342
signal_child(StartupPID,SIGUSR2);
53385343
}
53395344

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,11 +1195,6 @@ do_promote(void)
11951195
exit(1);
11961196
}
11971197

1198-
/*
1199-
* For 9.3 onwards, "fast" promotion is performed. Promotion with a full
1200-
* checkpoint is still possible by writing a file called
1201-
* "fallback_promote" instead of "promote"
1202-
*/
12031198
snprintf(promote_file,MAXPGPATH,"%s/promote",pg_data);
12041199

12051200
if ((prmfile=fopen(promote_file,"w"))==NULL)

‎src/include/access/xlog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,5 @@ extern SessionBackupState get_backup_status(void);
394394

395395
/* files to signal promotion to primary */
396396
#definePROMOTE_SIGNAL_FILE"promote"
397-
#defineFALLBACK_PROMOTE_SIGNAL_FILE "fallback_promote"
398397

399398
#endif/* XLOG_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp