diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index fcf4ae99d2f..e1545b66d72 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -1978,6 +1978,10 @@ PerformWalRecovery(void) pfree(buf.data); } #endif + /* Check replay progress */ + if (ReportXLOGRecoveryProgress_hook != NULL) + ReportXLOGRecoveryProgress_hook(); + /* Handle interrupt signals of startup process */ ProcessStartupProcInterrupts(); diff --git a/src/backend/postmaster/startup.c b/src/backend/postmaster/startup.c index 27e86cf393f..1d41ea0540f 100644 --- a/src/backend/postmaster/startup.c +++ b/src/backend/postmaster/startup.c @@ -75,6 +75,8 @@ static volatile sig_atomic_t startup_progress_timer_expired = false; */ int log_startup_progress_interval = 10000; /* 10 sec */ +ReportXLOGRecoveryProgress_hook_type ReportXLOGRecoveryProgress_hook = NULL; + /* Signal handlers */ static void StartupProcTriggerHandler(SIGNAL_ARGS); static void StartupProcSigHupHandler(SIGNAL_ARGS); diff --git a/src/include/postmaster/startup.h b/src/include/postmaster/startup.h index ec2c8d3bff5..8d235d7b6a9 100644 --- a/src/include/postmaster/startup.h +++ b/src/include/postmaster/startup.h @@ -37,5 +37,7 @@ extern void disable_startup_progress_timeout(void); extern void begin_startup_progress_phase(void); extern void startup_progress_timeout_handler(void); extern bool has_startup_progress_timeout_expired(long *secs, int *usecs); +typedef void (*ReportXLOGRecoveryProgress_hook_type) (void); +extern PGDLLIMPORT ReportXLOGRecoveryProgress_hook_type ReportXLOGRecoveryProgress_hook; #endif /* _STARTUP_H */