Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a4Wbz-0008EH-LN for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Dec 2015 16:20:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a4Wbz-0007mT-7z for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Dec 2015 16:20:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a4Wbx-0007jj-42 for pgsql-hackers@postgresql.org; Thu, 03 Dec 2015 16:20:01 +0000 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1a4Wbu-00019n-1P for pgsql-hackers@postgresql.org; Thu, 03 Dec 2015 16:19:59 +0000 Received: by wmww144 with SMTP id w144so28088894wmw.1 for ; Thu, 03 Dec 2015 08:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type; bh=0zWCjSDNeNgJyJ0s9aiQfKKv+2EVDPPEqKuarG4uOY8=; b=NWX6csE8O18JtrGzZzHgeqN409i5l2HR29U/DCyRCxu9LHKkwJwk8RBzEaQ3HCzIp3 rTh/sXVtgYivE/sv4raHDKK9AOSOzkdk3cvwV/WFberLh5UPdSk6ZSOjWRK1IR2og5v8 5E9fwJQm6pRkYjwK1NiIMmp3TByu1zktSOn1/lnqlklPVpPk8LRGOcHlaQ8rv2rRY10j KaITzEym3EFOTKdPozSwo8jETUev8O388H4CRUXaWKoRWuuoJz0Q1oOJAYYZwonPRpO4 CV9spiCp0jHOCGpeLmpRZyI9U77+Tu4hhTnlM5+5pVUpCtDJH5v4/MzAGMadC+w+vYXQ 6OYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type; bh=0zWCjSDNeNgJyJ0s9aiQfKKv+2EVDPPEqKuarG4uOY8=; b=WceIaFjJumq/QLErYY6Lms/yX5F4QbM6WnNG+YEXRlzawgD3F4Sp/UDu+1pK6J5oD4 +CDmY7TGE4LjHZrdUFHNarsQ22221wbMUopApWJEY9OvBUjPL5f7sqIfQShG22eQ74LR +nX020Aw+c/++rPprPf88EvFC8cVwhDmOyd3oBDKtHE7oaAIcjWlb6sv9/H7bwSYO3pk p2900VCU+Qxym1yzcqIWnbaF79TCcM3YhmvvZG6AXliHKt/gQqa5wDABOG0dqHDxKeK6 WQ7kA02uwljyesJKWq+11eF+KOGnyFSOTEdr/GAQPRp0jSxkhts0EhR9pSV1HSQOvh2H d2zw== X-Gm-Message-State: ALoCoQlXNnuQ01JZj709iiBdbceZ0I1vwMUkWU98Qwlu4R6Ppt+XWwAlRMOq3EE1fyclHbdKY/5TGuT0HvSXUZqLlqiE+W4h4BRgPcZkISqwBGd1qPyRW3YCk+8W0tjR7+Yyib/RScmKcIrN47/Bej7D+jV4RMctVKHC0eyPd3iBnRwKfpoPbNrBKt6iiSNtpL3DC5yeRLnk X-Received: by 10.28.73.11 with SMTP id w11mr49477334wma.44.1449159596406; Thu, 03 Dec 2015 08:19:56 -0800 (PST) Received: from ?IPv6:2a00:1028:96c9:ee5a:b02f:e053:ba51:f004? (dynamic-2a00-1028-96c9-ee5a-b02f-e053-ba51-f004.ipv6.broadband.iol.cz. [2a00:1028:96c9:ee5a:b02f:e053:ba51:f004]) by smtp.gmail.com with ESMTPSA id gj2sm8222340wjb.40.2015.12.03.08.19.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Dec 2015 08:19:55 -0800 (PST) Subject: Re: [DOCS] max_worker_processes on the standby To: Alvaro Herrera , Fujii Masao References: <20151002145839.GZ2573@alvherre.pgsql> <20151002185941.GE2573@alvherre.pgsql> <5622BF9D.2010409@2ndquadrant.com> <20151020190522.GT3391@alvherre.pgsql> <20151027180759.GG240637@alvherre.pgsql> <20151116214338.GD614468@alvherre.pgsql> Cc: Robert Haas , oonishitk@nttdata.co.jp, pgsql-docs , PostgreSQL-development From: Petr Jelinek Message-ID: <56606BA9.1050606@2ndquadrant.com> Date: Thu, 3 Dec 2015 17:19:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151116214338.GD614468@alvherre.pgsql> Content-Type: multipart/mixed; boundary="------------030508000800050700000501" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------030508000800050700000501 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 2015-11-16 22:43, Alvaro Herrera wrote: > I paraphrase Fujii Masao, who wrote: > >> 1. Start the master and standby servers with track_commit_timestamp enabled. >> 2. Disable track_commit_timestamp in the master and restart the master server. >> 3. Run checkpoint in the master. >> 4. Run restartpoint in the standby after the checkpoint WAL record generated >> 5. Restart the standby server. >> 6. Enable track_commit_timestamp in the master and restart the master server. >> 7. Disable track_commit_timestamp in the master and restart the master server. > >> What I think strange is that pg_last_committed_xact() behaves differently >> in #2, #5, and #7 though the settings of track_commit_timestamp are same >> in both servers, i.e., it's disabled in the master but enabled in the standby. > > Interesting, thanks. You're right that this behaves oddly. > > I think in order to fix these two points (#5 and #7), we need to make > the standby not honour the GUC at all, i.e. only heed what the master > setting is. > >> 8. Promote the standby server to new master. >> Since committs is still inactive even after the promotion, >> pg_last_committed_xact() keeps causing an ERROR though >> track_commit_timestamp is on. >> >> I was thinking that whether committs is active or not should depend on >> the setting of track_commit_timestamp *after* the promotion. >> The behavior in #8 looked strange. > > To fix this problem, we can re-run StartupCommitTs() after recovery is > done, this time making sure to honour the GUC setting. > > I haven't tried the scenarios we fixed with the previous round of > patching, but this patch seems to close the problems just reported. > (My next step will be looking over the recovery test framework by > Michael et al, so that I can apply a few tests for this stuff.) > In the meantime, if you can look this over I would appreciate it. > While this seems good, I'd code it slightly differently. I didn't like the addition of new bool when it's not really needed. This brings the question if we actually need the BootStrapCommitTs and StartupCommitTs functions which really don't do much though. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services --------------030508000800050700000501 Content-Type: binary/octet-stream; name="committs-activation-fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="committs-activation-fix.patch" diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c index 349228d..edb0d2b 100644 --- a/src/backend/access/transam/commit_ts.c +++ b/src/backend/access/transam/commit_ts.c @@ -510,7 +510,7 @@ BootStrapCommitTs(void) /* * Nothing to do here at present, unlike most other SLRU modules; segments * are created when the server is started with this module enabled. See - * StartupCommitTs. + * ActivateCommitTs. */ } @@ -544,13 +544,13 @@ ZeroCommitTsPage(int pageno, bool writeXlog) * configuration. */ void -StartupCommitTs(bool force_enable) +StartupCommitTs(bool enabled) { /* * If the module is not enabled, there's nothing to do here. The module * could still be activated from elsewhere. */ - if (track_commit_timestamp || force_enable) + if (enabled) ActivateCommitTs(); } diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index f17f834..ee0b959 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7339,7 +7339,7 @@ StartupXLOG(void) if (standbyState == STANDBY_DISABLED) { StartupCLOG(); - StartupCommitTs(false); + StartupCommitTs(track_commit_timestamp); StartupSUBTRANS(oldestActiveXID); } diff --git a/src/include/access/commit_ts.h b/src/include/access/commit_ts.h index 3844bb3..f5b3969 100644 --- a/src/include/access/commit_ts.h +++ b/src/include/access/commit_ts.h @@ -34,7 +34,7 @@ extern Size CommitTsShmemBuffers(void); extern Size CommitTsShmemSize(void); extern void CommitTsShmemInit(void); extern void BootStrapCommitTs(void); -extern void StartupCommitTs(bool force_enable); +extern void StartupCommitTs(bool enabled); extern void CommitTsParameterChange(bool xlrecvalue, bool pgcontrolvalue); extern void CompleteCommitTsInitialization(void); extern void ShutdownCommitTs(void); --------------030508000800050700000501 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------030508000800050700000501--