diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 643a7efc397..04a06a72d14 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -129,6 +129,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 @@ -10163,10 +10164,20 @@ CreateRestartPoint(int flags) ControlFile->time = (pg_time_t) time(NULL); 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 098dc35037b..7e46fce7c4e 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -373,6 +373,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 XLogRecPtr GetRedoStartLsn(void); extern bool PromoteIsTriggered(void);