From 4f3924d9cd438ba4e6fd639460f8c859c65d45a3 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 9 Mar 2015 17:44:00 -0300 Subject: Keep CommitTs module in sync in standby and master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We allow this module to be turned off on restarts, so a restart time check is enough to activate or deactivate the module; however, if there is a standby replaying WAL emitted from a master which is restarted, but the standby isn't, the state in the standby becomes inconsistent and can easily be crashed. Fix by activating and deactivating the module during WAL replay on parameter change as well as on system start. Problem reported by Fujii Masao in http://www.postgresql.org/message-id/CAHGQGwFhJ3CnHo1CELEfay18yg_RA-XZT-7D8NuWUoYSZ90r4Q@mail.gmail.com Author: Petr JelĂ­nek --- src/include/access/commit_ts.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/include/access/commit_ts.h') diff --git a/src/include/access/commit_ts.h b/src/include/access/commit_ts.h index ed3976c32df..93d1217f766 100644 --- a/src/include/access/commit_ts.h +++ b/src/include/access/commit_ts.h @@ -39,11 +39,13 @@ extern Size CommitTsShmemSize(void); extern void CommitTsShmemInit(void); extern void BootStrapCommitTs(void); extern void StartupCommitTs(void); +extern void ActivateCommitTs(void); +extern void DeactivateCommitTs(bool do_wal); extern void CompleteCommitTsInitialization(void); extern void ShutdownCommitTs(void); extern void CheckPointCommitTs(void); extern void ExtendCommitTs(TransactionId newestXact); -extern void TruncateCommitTs(TransactionId oldestXact); +extern void TruncateCommitTs(TransactionId oldestXact, bool do_wal); extern void SetCommitTsLimit(TransactionId oldestXact, TransactionId newestXact); extern void AdvanceOldestCommitTs(TransactionId oldestXact); -- cgit v1.2.3