Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a4rca-00042Y-Rq for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Dec 2015 14:46:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a4rcZ-0002kX-KF for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Dec 2015 14:46: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 1a4rcY-0002jW-8J; Fri, 04 Dec 2015 14:46:02 +0000 Received: from mail-qg0-x22a.google.com ([2607:f8b0:400d:c04::22a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1a4rcV-0003me-Ep; Fri, 04 Dec 2015 14:46:00 +0000 Received: by qgea14 with SMTP id a14so89172546qge.0; Fri, 04 Dec 2015 06:45:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=OEAWHWScY4kN/VN1wiY2CYjZvmz6gqu+0x/gUzdWVR4=; b=MxhYcA+D9WuMnleOOsPVOFMjmAMckQHmEc8+DWNyO0cnoN8uE6Q6QWooXkAWfQBTFD vyGzKB9AWyCUjiC15IoUI7DgGZBmh0jVoVApbfZ4ZhYfwCrDjkwU3fmG2BkCJ12URdXm /qUlJLR6FRAg//tKhUQUCnI8M4i1Iwqjc5SGcEekU4k51sg4DJhrKkj5hG8vILzYQSxR blQ2adujVfUHssLLs0q/+Qqy2W/zpJIND1EVa5IjXsKYlWUhyeky30U84zc1DPoPQWbX 0Y6VmFZtdD+2JrgAwRaisqo/eqldb8NQo04fGQcHaoow1KiPsu266MEHYwQL6RnyqIZ/ lw5A== MIME-Version: 1.0 X-Received: by 10.140.254.69 with SMTP id z66mr19861700qhc.5.1449240358452; Fri, 04 Dec 2015 06:45:58 -0800 (PST) Received: by 10.55.170.142 with HTTP; Fri, 4 Dec 2015 06:45:58 -0800 (PST) In-Reply-To: <20151116214338.GD614468@alvherre.pgsql> 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> Date: Fri, 4 Dec 2015 23:45:58 +0900 Message-ID: Subject: Re: [DOCS] max_worker_processes on the standby From: Fujii Masao To: Alvaro Herrera Cc: Robert Haas , Petr Jelinek , oonishitk@nttdata.co.jp, pgsql-docs , PostgreSQL-development Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) 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 On Tue, Nov 17, 2015 at 6:43 AM, 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. Sorry for not reviewing the patch before you push it... In HEAD, I ran very simple test case: 1. enable track_commit_timestamp 2. start the server 3. run some transactions 4. execute pg_last_committed_xact() -- returns non-null values 5. shutdown the server with immdiate mode 6. restart the server -- crash recovery happens 7. execute pg_last_committed_xact() The last call of pg_last_committed_xact() returns NULL values, which means that the xid and timestamp information of the last committed transaction disappeared by crash recovery. Isn't this a bug? Regards, -- Fujii Masao -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers