Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNJKr-0000XY-Lj for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jun 2017 13:36:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dNJKp-0001y8-N0 for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jun 2017 13:36:47 +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_2) (envelope-from ) id 1dNJJF-0007Xx-E5 for pgsql-hackers@postgresql.org; Tue, 20 Jun 2017 13:35:09 +0000 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dNJJC-00060u-04 for pgsql-hackers@postgresql.org; Tue, 20 Jun 2017 13:35:08 +0000 Received: by mail-lf0-x241.google.com with SMTP id x81so14587188lfb.3 for ; Tue, 20 Jun 2017 06:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=ksfekspoGJwFnAYKdbTI2Px4+JR2jEO1DvZYDMEc7iA=; b=QWFE/qOCFFU0cRYc7yCY4wq1FJAMPIERY0AJRt3U83Y9kzodrLdvPfYSes/qHuuWWb 0Z7F15FCGbcgLoJWP1aoD+rC0gQA9Q0R3EA85Fr81pk3Ulm0LnBLu23tEvY4A14o9zsi SUhInSk+5E0AmeXYszfEw/6wIBs5rf3E6GGbh5B10nM56TiX2pZ/k3OIpdhjga8OiFPo b1bo9lgmYohG4fISdvQ3VDc+s5yHWXWMCkb8lP2N/hPQCgObdyNdDa6we8Q/UXlELVXX yzdtEHXjiv1db+qqclbU4L5yY6ENqYGH+X4CuCfAgoR4WxxERVdaC6aeTRV6f66tuJc1 iUuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:message-id :user-agent:mime-version:content-transfer-encoding; bh=ksfekspoGJwFnAYKdbTI2Px4+JR2jEO1DvZYDMEc7iA=; b=AQFcKPby0LtVmqtwrWn7EO6MeUldyzrPLzPCM6e1A/eAn4IGWQkBLpUePthx2fdNtZ RW6PDH37cLoKHCUlfRjuYuTFZviWxIDU+crkYfO4VQjXHr2mYMy9lWfSJMpWf53FNvok TpJkOpIaelctkO59vDPYArIpxffnk9y7gpakIcJNsEvgMrPs/DsbjJjETu3zHiHUcCCt +ZZS9F9qWlUWq2qm6XCTfNBF4d3m1QYdYP0YNcDenFsF4zzxya1r+rNmqFQr6iC++0I+ 1c5X1O7uPqXlpeCXuxfyUMYfuTwEeLrSMitLcPoDSE3EX10YYJ20W+7SH99lr3lusevP /JUw== X-Gm-Message-State: AKS2vOysmtV9UJ1ZiRSRSurx+dcUGXh7m0J6p2nm/PoUATED9PsguuzE I5anO96Z42VNVw== X-Received: by 10.46.21.72 with SMTP id 8mr7234017ljv.118.1497965704060; Tue, 20 Jun 2017 06:35:04 -0700 (PDT) Received: from seb.koffice.internal (koffice.avito.ru. [195.151.206.25]) by smtp.gmail.com with ESMTPSA id 186sm2998220ljj.4.2017.06.20.06.35.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 06:35:02 -0700 (PDT) From: Sergey Burladyan To: Amit Kapila Cc: Bruce Momjian , PostgreSQL-development , Dmitriy Sarafannikov , Vladimir Borodin Subject: Re: Broken hint bits (freeze) References: <20170613193124.GQ13873@momjian.us> <87mv98af8j.fsf@seb.koffice.internal> <20170616164641.GP11450@momjian.us> <87fuezalc3.fsf@seb.koffice.internal> <20170619222113.GF3180@momjian.us> <20170620025919.GA28277@momjian.us> <20170620033726.GB28277@momjian.us> <87h8zb6kbx.fsf@seb.koffice.internal> Date: Tue, 20 Jun 2017 16:35:01 +0300 Message-ID: <8760fq7pfe.fsf@seb.koffice.internal> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 Amit Kapila writes: > On Tue, Jun 20, 2017 at 3:40 PM, Sergey Burladyan w= rote: > > Bruce Momjian writes: > > > >> On Mon, Jun 19, 2017 at 10:59:19PM -0400, Bruce Momjian wrote: > >> > On Tue, Jun 20, 2017 at 03:50:29AM +0300, Sergey Burladyan wrote: > >> > > 20 =D0=B8=D1=8E=D0=BD. 2017 =D0=B3. 1:21 =D0=BF=D0=BE=D0=BB=D1=8C= =D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C "Bruce Momjian" =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > >> > > > >> > > > >> > > We are saying that Log-Shipping should match "Latest checkpoint > >> > > location", but the WAL for that will not be sent to the standb= y, so it > >> > > will not match, but that is OK since the only thing in the non= -shipped > >> > > WAL file is the checkpoint record. How should we modify the w= ording on > >> > > this? > >> > > > >> > > > >> > > I am afraid that without this checkpoint record standby cannot make > >> > > restartpoint > >> > > and without restartpoint it does not sync shared buffers into disk= at > >> > > shutdown. > >> > > > It seems to me at shutdown time on standby servers we specifically > make restart points. See below code in ShutdownXLOG() > > .. > if (RecoveryInProgress()) > CreateRestartPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE); > .. > > Do you have something else in mind? What buffers this restartpoint will save into disk? I think what it can save only buffers with LSN lower or equal to "Latest checkpoint location". Buffers with LSN between "Minimum recovery ending location" and "Latest checkpoint location" will not saved at all. I set log_min_messages=3Ddebug2 and it is more clearly what happened here: 2017-06-20 13:18:32 GMT LOG: restartpoint starting: xlog ... 2017-06-20 13:18:33 GMT DEBUG: postmaster received signal 15 2017-06-20 13:18:33 GMT LOG: received smart shutdown request 2017-06-20 13:18:33 GMT DEBUG: updated min recovery point to 0/12000000 2017-06-20 13:18:33 GMT CONTEXT: writing block 2967 of relation base/16384= /16385 2017-06-20 13:18:33 GMT DEBUG: checkpoint sync: number=3D1 file=3Dglobal/1= 2587 time=3D0.001 msec 2017-06-20 13:18:33 GMT DEBUG: checkpoint sync: number=3D2 file=3Dbase/163= 84/12357 time=3D0.000 msec 2017-06-20 13:18:33 GMT DEBUG: checkpoint sync: number=3D3 file=3Dbase/163= 84/16385 time=3D0.000 msec 2017-06-20 13:18:33 GMT DEBUG: attempting to remove WAL segments older tha= n log file 00000001000000000000000B 2017-06-20 13:18:33 GMT DEBUG: recycled transaction log file "000000010000= 00000000000B" 2017-06-20 13:18:33 GMT DEBUG: recycled transaction log file "000000010000= 00000000000A" 2017-06-20 13:18:33 GMT DEBUG: recycled transaction log file "000000010000= 000000000009" 2017-06-20 13:18:33 GMT DEBUG: SlruScanDirectory invoking callback on pg_s= ubtrans/0000 2017-06-20 13:18:33 GMT LOG: restartpoint complete: wrote 1824 buffers (44= .5%); 0 transaction log file(s) added, 0 removed, 3 recycled; write=3D1.389= s, sync=3D0.000 s, total=3D1.389 s; sync files=3D3, longest=3D0.000 s, ave= rage=3D0.000 s 2017-06-20 13:18:33 GMT LOG: recovery restart point at 0/F008D28 2017-06-20 13:18:33 GMT DETAIL: last completed transaction was at log time= 2017-06-20 13:18:29.282645+00 2017-06-20 13:18:33 GMT LOG: shutting down 2017-06-20 13:18:33 GMT DEBUG: skipping restartpoint, already performed at= 0/F008D28 2017-06-20 13:18:33 GMT LOG: database system is shut down =3D=3D=3D=3D=3D=3D=3D=3D I use pg 9.2 and "skipping restartpoint, already performed at" is from src/backend/access/transam/xlog.c:8643 after this statement it return from CreateRestartPoint() and do not run 8687 CheckPointGuts(lastCheckPoint.redo, flags); > >> > Uh, as I understand it the rsync is going to copy the missing WAL fi= le > >> > from the new master to the standby, right, and I think pg_controldata > >> > too, so it should be fine. Have you tested to see if it fails? > > > > It need old WAL files from old version for correct restore heap > > files. New WAL files from new version does not have this information. > > > > So in such a case can we run rsync once before pg_upgrade? I just copy last WAL from stopped old master into running old standby before it shutdown and wait till it replayed. After that standby can issue restartpoint at the same location as in stopped master. I am not sure about rsync, in my production server I have for example 111 GB in pg_xlog and if I run rsync for pg_xlog it must send ~ 40GB of new WALs I think. --=20 Sergey Burladyan --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers