Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ju3NA-0002e3-01 for pgsql-general@arkaria.postgresql.org; Sat, 11 Jul 2020 00:28:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ju3N8-0006Sm-Pd for pgsql-general@arkaria.postgresql.org; Sat, 11 Jul 2020 00:28:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ju3N8-0006Sf-IB for pgsql-general@lists.postgresql.org; Sat, 11 Jul 2020 00:28:06 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ju3N5-0005YW-J6 for pgsql-general@lists.postgresql.org; Sat, 11 Jul 2020 00:28:05 +0000 Received: by mail-ed1-x531.google.com with SMTP id e22so5914112edq.8 for ; Fri, 10 Jul 2020 17:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=mXEyWPx5I6u9vrARqPZmMk5/Sb5Jm4KVMtsMgplpXaw=; b=RgO5XUXhE02OZ3PjVLnqt/ldWW88vkp62+kGYZkxAyWe58Q05+iWsMjYLuyW9nYXsM K2cscUcak5Bridsb35SnTkAtSOg3SBABM9KVSTc/wfWNWyTPlY0mvXY7cJVJTP5KcTZi 77tDZLSmTX9Wh9D077TELJFCkWMiUMjOQ9Al2UhEIRZNAV1rI39TWhDOiHIxy9RgV5Qb EoDVPJTJc1BzNicm49miabRqEdMwBecYgOazUMTyRjplOOEzAQebOMcmfO+eJj2SLCGl zbA4E/z0eZgkeijqlZZOqQNhW9jGrP8jrN5mu8cbMgOwP2s4mSNcVhgYfNa/7UTnaSA1 DJxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=mXEyWPx5I6u9vrARqPZmMk5/Sb5Jm4KVMtsMgplpXaw=; b=rnVvEoYHnAdAUTdn/FmHu3Zvz37vTsoeOz34GWBSLOuFOpv3SZSOp9XhBGrXPI08kq 88zB2lz/uxDHAljATTF9WR00cy4OVMvGVZHYJRimMG1vB56G7ivEBWtuc3CM15DxZViD gfGEw6RZY6jYUAMaj1YNh2pLHXDsPghJUn7V2oQEi20B9bOfgjlzvuvEaSOX5sYPCmBq PKIhh8l9JEHJiIUWHG+mKFULY7wx7qQBoxptJ/kagVF967RsjeSqKc3J+C+Su7VzQZA5 jBR7a/QQLAg4hGQRqHs6ol6q0AvJFiwkzDVUTQhbvdhhcfX+0jM8zOWMlDzntlTBRtbf LxDQ== X-Gm-Message-State: AOAM533S4mQNqD8Jp0fG/gqyZxKDWYeEZPeVFBp1HcATBjDQ/erTXzzX IYickYzIdBCsL4OdCGY7QgRwAFRz X-Google-Smtp-Source: ABdhPJwibW8eZ9FNQOsu7zuwIxBOfLA7QCuASaqq9/k96TyLOUjum2KiT4PMVra6CC0ChQh/BNNHeA== X-Received: by 2002:a50:e801:: with SMTP id e1mr78390022edn.251.1594427280905; Fri, 10 Jul 2020 17:28:00 -0700 (PDT) Received: from [192.168.1.8] (241-57-239-77.dyn.cable.fcom.ch. [77.239.57.241]) by smtp.gmail.com with ESMTPSA id lm22sm4537798ejb.109.2020.07.10.17.28.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jul 2020 17:28:00 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Safe switchover From: =?utf-8?Q?Paul_F=C3=B6rster?= In-Reply-To: <20200710154556.GL12375@tamriel.snowman.net> Date: Sat, 11 Jul 2020 02:27:59 +0200 Cc: James Sewell , "pgsql-generallists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <7E43945E-4571-4D30-9E8F-B940B9277DEF@gmail.com> <20200710152959.GK12375@tamriel.snowman.net> <01BE6868-6920-4E5D-9A4D-838E3036DCD2@gmail.com> <20200710154556.GL12375@tamriel.snowman.net> To: Stephen Frost X-Mailer: Apple Mail (2.3608.80.23.2.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Stephen, > On 10. Jul, 2020, at 17:45, Stephen Frost wrote: >=20 > Sure, if you know exactly why the former primary failed and have > confidence that nothing actually bad happened then pg_rewind can work > (though it's still not what I'd generally recommend). >=20 > If you don't actually know what happened to the former primary to = cause > it to fail then I definitely wouldn't use pg_rewind on it since it > doesn't have any checks to make sure that the data is actually > generally consistent. These days you could get a bit of a better > feeling by running pg_checksums against the data dir, but that's not > going to be as good as doing a pgbackrest delta restore when it comes = to > making sure that everything is valid. we use Netapp plus continuous archiving. To protect agains block = corruption, all our database clusters have been created with initdb -k. = So they should report block corruptions in the log. The usual reason why a database cluster goes down is because the server = is shut down which initiates a switchover and is not problematic. If the = server goes down by a power outage, system crash or similar, then an = automatic failover is initiated, which, according to our experience, is = also not problematic. Patroni seems to handle both situations well. The worst case is, that both servers crash, which is pretty unlikely. = So, the worst case is that we have to perform a volume restore with = Netapp and replay the WAL files since that last snapshot. Should the = replica database cluster be damaged too, then we may need to reinit it = with Patroni. This is acceptable even for large database clusters = because replication runs fast. But the possibility is very, very small. Why the -k option of initdb isn't default anyway, is beyond me. Yes, I = know the argument about pg_upgrade messages, which people can't seem to = cope with for some reason, but I can't see the reasoning. If I wanted to = do a pg_upgrade from an older non-checksummed database cluster to a new = major version with checksums, then I'd do initdb explicitly without = checksums and perform the upgrade. Then I would enable checksums and = that's it from then on. It's a one time only simple command for each = affected database cluster. So, in my opinion, -k should be default and if one wanted to create a = non-checksummed database cluster, it would have to be stated on the = command line explicitly. This IMHO is a reasonable way to make people = migrate to checksums over time as database clusters are migrated. But then, that's only my opinion. There is no absolute truth. Cheers, Paul=