Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLgA8-0006df-LN for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Jun 2017 01:35:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dLgA8-0003fY-8L for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Jun 2017 01:35:00 +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 1dLg8a-0000yW-M8 for pgsql-hackers@postgresql.org; Fri, 16 Jun 2017 01:33:24 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dLg8Y-0004bh-2X for pgsql-hackers@postgresql.org; Fri, 16 Jun 2017 01:33:23 +0000 Received: by mail-lf0-x244.google.com with SMTP id u62so2604743lfg.0 for ; Thu, 15 Jun 2017 18:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=GpSCzuDGKh/nUhpDgcduiQlB1s5EqTdSTO/rQyblUd4=; b=ZqCBpXmoKHRzWTenSaN0io5ukYn/KpLPGTFYY6R3QupXmxgXRSquS03ekvDvAOgy5E nBxAZm8ZaUJ4f5R5x36PIF906yJmEAvnVuivd7AN4pE7q+OxRbxO3XIw2GbWDnMEaAWn Nej0R8cHXi0IEPJTdzJ5o0LPmL80xchDCWbBWiA82cIdMa/hOnkL6Leszn9SLpbk0Krw w1VriLReS6jzqjyCRUiZyz3wUNavvVC+pnR2RdSWc23wN40t+KdHmiYofNOtIMHbPNjk PVSRXm3rN69hs5uc1XYgCi7EmO4LeV6QRwW8L4XcwpqKS4QB/LDSBG8YInQLAOvdGu81 QONg== 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:in-reply-to :message-id:user-agent:mime-version; bh=GpSCzuDGKh/nUhpDgcduiQlB1s5EqTdSTO/rQyblUd4=; b=LxdKKx19E7J5p8lhNsNXil3FKAliyaAHp7pDcqymd24HQbK9iMx7c/nJusPmZANeby oBbNXhRusED++GRCIx6p4+QgBqxD71F+/RtmVEh1bnhlOlo9YQioejcd1svgwAtjtOPi MDK/osr9wXVdP+mN/Qg0poyRUhgWy2ZF2+5+WnncUlaCBt9fOwGaad/uOo2nOFefN/MX 9N2U4iexLG9ibiMW3sY7mQnbIaBSzfJKTMmkz1lNihhXvyYItKW0dSw7Z/I5MjKxHAs5 7LhzWsL6fKbyWNegBvvEbVrHggoDxN8KigXP67kG29AChX60khQNIYzee6h68EdWsLdS ZFBw== X-Gm-Message-State: AKS2vOwYvf5ckT1Txo0+1FdItfjsrnzlkgd8hUI/hk3j/bMyFThXRa/l r/Ot2mN6gIwzlfMDv3M= X-Received: by 10.46.74.1 with SMTP id x1mr99944lja.27.1497576799458; Thu, 15 Jun 2017 18:33:19 -0700 (PDT) Received: from seb.koffice.internal ([81.1.171.161]) by smtp.gmail.com with ESMTPSA id 19sm151459lju.69.2017.06.15.18.33.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jun 2017 18:33:17 -0700 (PDT) From: Sergey Burladyan To: Bruce Momjian Cc: Vladimir Borodin , Amit Kapila , Dmitriy Sarafannikov , pgsql-hackers Subject: Re: Broken hint bits (freeze) References: <2E86EB5F-50ED-4DE2-B14E-98EF8F62B2F2@simply.name> <4C1127FC-74AE-4544-9B22-6A32FD0C0607@yandex.ru> <948C9927-CC63-47F7-87B9-1FA5921E6D4A@yandex.ru> <0DFC2046-3025-465E-BBB8-1E55479A9B7D@simply.name> <20170613193124.GQ13873@momjian.us> Date: Fri, 16 Jun 2017 04:33:16 +0300 In-Reply-To: <20170613193124.GQ13873@momjian.us> (Bruce Momjian's message of "Tue, 13 Jun 2017 15:31:24 -0400") Message-ID: <87mv98af8j.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 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 Bruce Momjian writes: > ! against the old primary and standby clusters. Verify that the > ! Latest checkpoint location values match in all clusters. For "Log-Shipping only" standby server this cannot be satisfied, because last WAL from master (with shutdown checkpoint) never archived. For example (git master): ==== postgresql.conf === port = 5430 shared_buffers = 32MB wal_level = hot_standby archive_mode = on archive_command = 'test ! -f "$ARH/%f" && ( echo "arch %p"; cp %p "$ARH/%f"; )' max_wal_senders = 5 hot_standby = on log_line_prefix = '%t ' log_checkpoints = on lc_messages = C ======================== ==== pg_control ==== pg_control version number: 1002 Catalog version number: 201705301 Database system identifier: 6432034080221219745 Database cluster state: shut down pg_control last modified: Fri Jun 16 03:57:22 2017 Latest checkpoint location: 0/D000028 Prior checkpoint location: 0/1604878 Latest checkpoint's REDO location: 0/D000028 Latest checkpoint's REDO WAL file: 00000001000000000000000D ==================== ==== WALs archive ==== -rw------- 1 sergey users 16777216 Jun 16 03:57 000000010000000000000003 -rw------- 1 sergey users 16777216 Jun 16 03:57 000000010000000000000004 -rw------- 1 sergey users 16777216 Jun 16 03:57 000000010000000000000005 -rw------- 1 sergey users 16777216 Jun 16 03:57 000000010000000000000006 -rw------- 1 sergey users 16777216 Jun 16 03:57 000000010000000000000007 -rw------- 1 sergey users 16777216 Jun 16 03:57 000000010000000000000008 -rw------- 1 sergey users 16777216 Jun 16 03:57 000000010000000000000009 -rw------- 1 sergey users 16777216 Jun 16 03:57 00000001000000000000000A -rw------- 1 sergey users 16777216 Jun 16 03:57 00000001000000000000000B -rw------- 1 sergey users 16777216 Jun 16 03:57 00000001000000000000000C ====================== ==== logfile ==== arch pg_wal/00000001000000000000000A arch pg_wal/00000001000000000000000B 2017-06-16 00:57:21 GMT LOG: received fast shutdown request 2017-06-16 00:57:21 GMT LOG: aborting any active transactions 2017-06-16 00:57:21 GMT LOG: shutting down arch pg_wal/00000001000000000000000C 2017-06-16 00:57:21 GMT LOG: checkpoint starting: shutdown immediate 2017-06-16 00:57:22 GMT LOG: checkpoint complete: wrote 4058 buffers (99.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.033 s, sync=0.949 s, total=1.144 s; sync files=32, longest=0.598 s, average=0.029 s; distance=190445 kB, estimate=190445 kB 2017-06-16 00:57:22 GMT LOG: database system is shut down ================= There is no 00000001000000000000000D in archive and after shutdown, standby can only be at it previous restartpoint (0/1604878) because it does not receive latest checkpoint (0/D000028) from master. So, after shutdown master and "Log-Shipping only" standby, it always "one checkpoint early" then master and "Latest checkpoint location" never match for it. I think this must be mentioned somehow in documentation. > ! > ! Also, if upgrading standby servers, change wal_level > ! to replica in the postgresql.conf file on > ! the new cluster. > > I am not sure how this help. wal_level is reset by pg_resetxlog during pg_upgrade, so it does not depend on postgresql.conf. After pg_upgrade wal_level always is 'minimal', that is why you must start and stop new master before rsync: ==== output ==== $ "$bin"/pg_controldata "$ver" | grep wal_level wal_level setting: replica $ "$bin"/pg_resetwal "$ver" Write-ahead log reset $ "$bin"/pg_controldata "$ver" | grep wal_level wal_level setting: minimal ================ If you rsync standby now (without start/stop new master after pg_upgrade) you will send pg_control with wal_level=minimal into it and after that standby abort on startup: ==== standby logfile ==== 2017-06-16 01:22:14 GMT LOG: entering standby mode 2017-06-16 01:22:14 GMT WARNING: WAL was generated with wal_level=minimal, data may be missing 2017-06-16 01:22:14 GMT HINT: This happens if you temporarily set wal_level=minimal without taking a new base backup. 2017-06-16 01:22:14 GMT FATAL: hot standby is not possible because wal_level was not set to "replica" or higher on the master server 2017-06-16 01:22:14 GMT HINT: Either set wal_level to "replica" on the master, or turn off hot_standby here. 2017-06-16 01:22:14 GMT LOG: startup process (PID 27916) exited with exit code 1 ================= PS: Thank you for answer, Bruce! -- Sergey Burladyan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers