From e945e54b50cce9250d31a48cd6d22cdb89bf76f4 Mon Sep 17 00:00:00 2001 From: l00584793 Date: Sat, 19 Sep 2020 17:41:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=87DN=E5=81=9C?= =?UTF-8?q?=E6=9C=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/access/transam/xlog.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/gausskernel/storage/access/transam/xlog.cpp b/src/gausskernel/storage/access/transam/xlog.cpp index 3502d592d..21bbcf746 100755 --- a/src/gausskernel/storage/access/transam/xlog.cpp +++ b/src/gausskernel/storage/access/transam/xlog.cpp @@ -10776,6 +10776,23 @@ bool IsRestartPointSafe(const XLogRecPtr checkPoint) return true; } +void wait_all_dirty_page_flush(int flags, XLogRecPtr redo) +{ + /* need wait all dirty page finish flush */ + if (g_instance.attr.attr_storage.enableIncrementalCheckpoint) { + update_dirty_page_queue_rec_lsn(redo, true); + g_instance.ckpt_cxt_ctl->full_ckpt_redo_ptr = redo; + g_instance.ckpt_cxt_ctl->full_ckpt_expected_flush_loc = get_dirty_page_queue_tail(); + pg_write_barrier(); + if (get_dirty_page_num() > 0) { + g_instance.ckpt_cxt_ctl->flush_all_dirty_page = true; + ereport(LOG, (errmsg("CreateRestartPoint, need flush %ld pages.", get_dirty_page_num()))); + CheckPointBuffers(flags, true); + } + } + return; +} + /* * Establish a restartpoint if possible. * @@ -10848,6 +10865,7 @@ bool CreateRestartPoint(int flags) UpdateMinRecoveryPoint(InvalidXLogRecPtr, true); if ((unsigned int)flags & CHECKPOINT_IS_SHUTDOWN) { + wait_all_dirty_page_flush(flags, lastCheckPoint.redo); LWLockAcquire(ControlFileLock, LW_EXCLUSIVE); t_thrd.shemem_ptr_cxt.ControlFile->state = DB_SHUTDOWNED_IN_RECOVERY; t_thrd.shemem_ptr_cxt.ControlFile->time = (pg_time_t)time(NULL); From 1e0e44322f56c85b40897fbc12ce615d4b8a5e6f Mon Sep 17 00:00:00 2001 From: l00584793 Date: Mon, 21 Sep 2020 08:21:31 +0800 Subject: [PATCH 2/2] --- src/include/knl/knl_instance.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/include/knl/knl_instance.h b/src/include/knl/knl_instance.h index edac6dfd4..b1a2bf0e6 100644 --- a/src/include/knl/knl_instance.h +++ b/src/include/knl/knl_instance.h @@ -337,6 +337,7 @@ typedef struct knl_g_ckpt_context { volatile bool flush_all_dirty_page; volatile bool buffers_contain_hashbucket; volatile uint64 full_ckpt_expected_flush_loc; + volatile XLogRecPtr full_ckpt_redo_ptr; volatile uint32 current_page_writer_count; volatile XLogRecPtr page_writer_xlog_flush_loc; volatile LWLock *backend_wait_lock;