@@ -95,7 +95,6 @@ int recovery_min_apply_delay = 0;
95
95
/* options formerly taken from recovery.conf for XLOG */
96
96
char * PrimaryConnInfo = NULL ;
97
97
char * PrimarySlotName = NULL ;
98
- char * PromoteTriggerFile = NULL ;
99
98
bool wal_receiver_create_temp_slot = false;
100
99
101
100
/*
@@ -318,8 +317,8 @@ typedef struct XLogRecoveryCtlData
318
317
319
318
/*
320
319
* recoveryWakeupLatch is used to wake up the startup process to continue
321
- * WAL replay, if it is waiting for WAL to arrive or failover trigger file
322
- * to appear .
320
+ * WAL replay, if it is waiting for WAL to arrive or promotion to be
321
+ * requested .
323
322
*
324
323
* Note that the startup process also uses another latch, its procLatch,
325
324
* to wait for recovery conflict. If we get rid of recoveryWakeupLatch for
@@ -2906,10 +2905,7 @@ recoveryApplyDelay(XLogReaderState *record)
2906
2905
{
2907
2906
ResetLatch (& XLogRecoveryCtl -> recoveryWakeupLatch );
2908
2907
2909
- /*
2910
- * This might change recovery_min_apply_delay or the trigger file's
2911
- * location.
2912
- */
2908
+ /* This might change recovery_min_apply_delay. */
2913
2909
HandleStartupProcInterrupts ();
2914
2910
2915
2911
if (CheckForStandbyTrigger ())
@@ -3155,8 +3151,8 @@ ReadRecord(XLogPrefetcher *xlogprefetcher, int emode,
3155
3151
* as for waiting for the requested WAL record to arrive in standby mode.
3156
3152
*
3157
3153
* 'emode' specifies the log level used for reporting "file not found" or
3158
- * "end of WAL" situations in archive recovery, or in standby mode when a
3159
- * trigger file is found . If set to WARNING or below, XLogPageRead() returns
3154
+ * "end of WAL" situations in archive recovery, or in standby mode when
3155
+ * promotion is triggered . If set to WARNING or below, XLogPageRead() returns
3160
3156
* XLREAD_FAIL in those situations, on higher log levels the ereport() won't
3161
3157
* return.
3162
3158
*
@@ -3424,7 +3420,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
3424
3420
*
3425
3421
* 1. Read from either archive or pg_wal (XLOG_FROM_ARCHIVE), or just
3426
3422
* pg_wal (XLOG_FROM_PG_WAL)
3427
- * 2. Check trigger file
3423
+ * 2. Check for promotion trigger request
3428
3424
* 3. Read from primary server via walreceiver (XLOG_FROM_STREAM)
3429
3425
* 4. Rescan timelines
3430
3426
* 5. Sleep wal_retrieve_retry_interval milliseconds, and loop back to 1.
@@ -3481,10 +3477,10 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
3481
3477
case XLOG_FROM_PG_WAL :
3482
3478
3483
3479
/*
3484
- * Check to see if the trigger file exists . Note that we
3485
- * do this only after failure, so when you create the
3486
- * trigger file, we still finish replaying as much as we
3487
- * can from archive and pg_wal before failover.
3480
+ * Check to see if promotion is requested . Note that we do
3481
+ * this only after failure, so when you promote, we still
3482
+ * finish replaying as much as we can from archive and
3483
+ * pg_wal before failover.
3488
3484
*/
3489
3485
if (StandbyMode && CheckForStandbyTrigger ())
3490
3486
{
@@ -3840,14 +3836,13 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
3840
3836
XLogPrefetcherComputeStats (xlogprefetcher );
3841
3837
3842
3838
/*
3843
- * Wait for more WAL to arrive. Time out after 5 seconds
3844
- * to react to a trigger file promptly and to check if the
3845
- * WAL receiver is still active.
3839
+ * Wait for more WAL to arrive, when we will be woken
3840
+ * immediately by the WAL receiver.
3846
3841
*/
3847
3842
(void ) WaitLatch (& XLogRecoveryCtl -> recoveryWakeupLatch ,
3848
- WL_LATCH_SET | WL_TIMEOUT |
3849
- WL_EXIT_ON_PM_DEATH ,
3850
- 5000L , WAIT_EVENT_RECOVERY_WAL_STREAM );
3843
+ WL_LATCH_SET | WL_EXIT_ON_PM_DEATH ,
3844
+ -1L ,
3845
+ WAIT_EVENT_RECOVERY_WAL_STREAM );
3851
3846
ResetLatch (& XLogRecoveryCtl -> recoveryWakeupLatch );
3852
3847
break ;
3853
3848
}
@@ -4294,14 +4289,11 @@ SetPromoteIsTriggered(void)
4294
4289
}
4295
4290
4296
4291
/*
4297
- * Check to see whether the user-specified trigger file exists and whether a
4298
- * promote request has arrived. If either condition holds, return true.
4292
+ * Check whether a promote request has arrived.
4299
4293
*/
4300
4294
static bool
4301
4295
CheckForStandbyTrigger (void )
4302
4296
{
4303
- struct stat stat_buf ;
4304
-
4305
4297
if (LocalPromoteIsTriggered )
4306
4298
return true;
4307
4299
@@ -4314,23 +4306,6 @@ CheckForStandbyTrigger(void)
4314
4306
return true;
4315
4307
}
4316
4308
4317
- if (PromoteTriggerFile == NULL || strcmp (PromoteTriggerFile , "" ) == 0 )
4318
- return false;
4319
-
4320
- if (stat (PromoteTriggerFile , & stat_buf ) == 0 )
4321
- {
4322
- ereport (LOG ,
4323
- (errmsg ("promote trigger file found: %s" , PromoteTriggerFile )));
4324
- unlink (PromoteTriggerFile );
4325
- SetPromoteIsTriggered ();
4326
- return true;
4327
- }
4328
- else if (errno != ENOENT )
4329
- ereport (ERROR ,
4330
- (errcode_for_file_access (),
4331
- errmsg ("could not stat promote trigger file \"%s\": %m" ,
4332
- PromoteTriggerFile )));
4333
-
4334
4309
return false;
4335
4310
}
4336
4311
0 commit comments