diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index a860563c1dd..825e5604ff3 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -153,6 +153,7 @@ restore_running_xacts_callback_t restore_running_xacts_callback; set_lwlsn_db_hook_type set_lwlsn_db_hook = NULL; set_lwlsn_relation_hook_type set_lwlsn_relation_hook = NULL; set_max_lwlsn_hook_type set_max_lwlsn_hook = NULL; +flush_dirty_buffers_hook_type flush_dirty_buffers_hook = NULL; /* * Number of WAL insertion locks to use. A higher value allows more insertions @@ -7222,10 +7223,19 @@ CreateRestartPoint(int flags) ControlFile->state = DB_SHUTDOWNED_IN_RECOVERY; UpdateControlFile(); LWLockRelease(ControlFileLock); + if (flush_dirty_buffers_hook) + { + flush_dirty_buffers_hook(flags); + } } return false; } + if (flush_dirty_buffers_hook) + { + flush_dirty_buffers_hook(flags); + } + /* * Update the shared RedoRecPtr so that the startup process can calculate * the number of segments replayed since last restartpoint, and request a diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index dae5e665eb9..8ecf727f4e3 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -270,6 +270,9 @@ extern set_lwlsn_db_hook_type set_lwlsn_db_hook; extern set_lwlsn_relation_hook_type set_lwlsn_relation_hook; extern set_max_lwlsn_hook_type set_max_lwlsn_hook; +typedef void (*flush_dirty_buffers_hook_type)(int flags); +extern flush_dirty_buffers_hook_type flush_dirty_buffers_hook; + extern void SetRedoStartLsn(XLogRecPtr RedoStartLSN); extern XLogRecPtr GetRedoStartLsn(void);