Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 73D9AB5DC5D for ; Thu, 22 Sep 2011 11:25:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 16823-07 for ; Thu, 22 Sep 2011 14:24:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from exhub003-1.exch003intermedia.net (exhub003-1.exch003intermedia.net [207.5.74.28]) by mail.postgresql.org (Postfix) with ESMTP id 0755CB5DC22 for ; Thu, 22 Sep 2011 11:24:52 -0300 (ADT) Received: from EXVMBX003-1.exch003intermedia.net ([207.5.74.41]) by exhub003-1.exch003intermedia.net ([207.5.74.28]) with mapi; Thu, 22 Sep 2011 07:24:52 -0700 From: Linas Virbalas To: Robert Haas , Euler Taveira de Oliveira , Florian Pflug CC: "pgsql-hackers@postgresql.org" Date: Thu, 22 Sep 2011 07:24:50 -0700 Subject: Re: Hot Backup with rsync fails at pg_clog if under load Thread-Topic: Hot Backup with rsync fails at pg_clog if under load Thread-Index: Acx5M2Mc0/MY33pCMkK0PunItjMNtQ== Message-ID: In-Reply-To: Accept-Language: en-US Content-Language: en X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201109/1129 X-Sequence-Number: 195318 >>> 2.2. pg_start_backup(Obackup_under_load=B9) on the master (this will ta= ke a >>> while as master is loaded up); >>=20 >> No. if you use pg_start_backup('foo', true) it will be fast. Check the >> manual. >=20 > If the server is sufficiently heavily loaded that a checkpoint takes a > nontrivial amount of time, the OP is correct that this will be not > fast, regardless of whether you choose to force an immediate > checkpoint. In order to check more cases, I have changed the procedure to force an immediate checkpoint, i.e. pg_start_backup('backup_under_load', true). With the same load generator running, pg_start_backup returned almost instantaneously compared to how long it took previously. Most importantly, after doing this change, I cannot reproduce the pg_clog error message anymore. In other words, with immediate checkpoint hot backup succeeds under this load! >>> 2.3. rsync data/global/pg_control to the standby; >>=20 >> Why are you doing this? If ... >>=20 >>> 2.4. rsync all other data/ (without pg_xlog) to the standby; >>=20 >> you will copy it again or no? Don't understand your point. >=20 > His point is that exercising the bug depends on doing the copying in a > certain order. Any order of copying the data theoretically ought to > be OK, as long as it's all between starting the backup and stopping > the backup, but apparently it isn't. Please note that in the past I was able to reproduce the same pg_clog error even with taking a singular rsync of the whole data/ folder (i.e. without splitting it into two steps). >> The problem could be that the minimum recovery point (step 2.3) is diffe= rent >> from the end of rsync if you are under load. Do you have ideas why does the Hot Backup operation with pg_start_backup('backup_under_load', true) succeed while pg_start_backup('backup_under_load') fails under the same load? Originally, I was using pg_start_backup('backup_under_load') in order not t= o clog the master server during the I/O required for the checkpoint. Of course, now, it seems, this should be sacrificed for the sake of a successful backup under load. > It seems pretty clear that some relevant chunk of WAL isn't getting > replayed, but it's not at all clear to me why not. It seems like it > would be useful to compare the LSN returned by pg_start_backup() with If needed, I could do that, if I had the exact procedure... Currently, during the start of the backup I take the following information: pg_xlogfile_name(pg_start_backup(...)) > the location at which replay begins when you fire up the clone. As you have seen in my original message, in the pg_log I get only the restored WAL file names after starting up the standby. Can I tune the postgresql.conf to include the location at which replay begins in the log? > Could you provide us with the exact rsync version and parameters you use? rsync -azv version 2.6.8 protocol version 29 -- Sincerely, Linas Virbalas http://flyingclusters.blogspot.com/