Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAGJt-0005rT-Km for pgsql-admin@arkaria.postgresql.org; Wed, 10 Oct 2018 15:22:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gAGJs-0008Cp-0X for pgsql-admin@arkaria.postgresql.org; Wed, 10 Oct 2018 15:22:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAGJr-0008Ci-Pm for pgsql-admin@lists.postgresql.org; Wed, 10 Oct 2018 15:22:39 +0000 Received: from mtaout003-public.msg.strl.va.charter.net ([68.114.190.28]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gAGJo-0008U2-46 for pgsql-admin@postgresql.org; Wed, 10 Oct 2018 15:22:39 +0000 Received: from impout002 ([68.114.189.17]) by mtaout003.msg.strl.va.charter.net (InterMail vM.9.00.023.01 201-2473-194) with ESMTP id <20181010152232.YKBY7355.mtaout003.msg.strl.va.charter.net@impout002>; Wed, 10 Oct 2018 10:22:32 -0500 Received: from cerberus.crazybean.net ([24.151.10.150]) by impout002 with charter.net id lrNY1y0043EE3TL01rNY3b; Wed, 10 Oct 2018 10:22:32 -0500 X-Authority-Analysis: v=2.2 cv=C6eZ8UH+ c=1 sm=1 tr=0 a=D2HTw/M6/8MmcHighGO7rg==:117 a=D2HTw/M6/8MmcHighGO7rg==:17 a=IkcTkHD0fZMA:10 a=xqWC_Br6kY4A:10 a=smKx5t2vBNcA:10 a=pGLkceISAAAA:8 a=SLQQfoqIi0kRXDcwaGIA:9 a=7eHgzw9yk47SPY-5:21 a=toKRBLfANpO2-LuF:21 a=QEXdDO2ut3YA:10 Received: from [IPv6:2001:470:e117:4:ecb0:7846:7e32:cb25] (2001:470:e117:4:ecb0:7846:7e32:cb25 [IPv6:2001:470:e117:4:ecb0:7846:7e32:cb25]) by cerberus.crazybean.net (OpenSMTPD) with ESMTPSA id 42f27211 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Wed, 10 Oct 2018 11:22:31 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\)) Subject: Re: root cause of corruption in hot standby From: Rui DeSousa In-Reply-To: Date: Wed, 10 Oct 2018 11:22:31 -0400 Cc: pgsql-admin@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <8303E556-079F-440A-BE2A-00A0E92EB2C7@crazybean.net> To: Mike Broers X-Mailer: Apple Mail (2.3445.100.39) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Oct 10, 2018, at 10:15 AM, Mike Broers wrote: >=20 >=20 > I'll look into rsync checksums, but this corruption presented itself = during a time when streaming replication was working fine and it wasnt = restoring archived rsynced transaction logs, and hadnt done so for = around 30 hours. The table it complained about it is accessed every = minute with updates and monitoring so I dont think it would have taken = so long if it was due to the application of a corrupted wal.=20 >=20 I think you missed my point. If you are dealing with some sort of bit = rot and/or data corruption on your storage device you need to sort of = prove it which is very difficult to do. You have WAL files on primary and the same WAL files on the replica via = your rsync copy job. If you check and recheck all the WALs daily to see = if any of the files are changing and find a difference than proves that = there is some sort of corruption/bit rot occurring as the WAL files are = static files. I=E2=80=99ve seen this type of corruption before with RAID controllers = that are over taxed; where they would corrupt over time periodically. I = ended up changing from a RAID configuration to a JBOD and managing the = disks via ZFS instead and never again experience data corruption using = the exact same hardware. ZFS also detects bit rot and correct for it as = well as the ability to scrub the pool to ensure the disks are not slowly = rotting away. What storage system is being used? Does it have any measures to prevent = bit rot? What is the RAID configuration? I would not recommend RAID 5 = for a database; under heavy load the performance degradation and = increase likelihood of data corruption is not worth it. It sounds like you have some sort of environmental issues which is = corrupting your data and it is not a Postgres issue. The problem you = face is that without some sort of definitive poof you=E2=80=99ll enter = the realm of finger pointing=E2=80=A6 it=E2=80=99s a database issue, no = is storage issue, etc. You have two replicas; one periodically fails and the other does not =E2=80= =94 the only difference is the environment in which they operate.=