Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f5rpD-0004E1-Am for pgsql-general@arkaria.postgresql.org; Tue, 10 Apr 2018 11:52:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f5rpC-0005Ex-1h for pgsql-general@arkaria.postgresql.org; Tue, 10 Apr 2018 11:52:34 +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 1f5rpB-0005En-Pt for pgsql-general@lists.postgresql.org; Tue, 10 Apr 2018 11:52:33 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f5rp8-0004Dr-2q for pgsql-general@postgresql.org; Tue, 10 Apr 2018 11:52:33 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1f5rn0-00073k-DV for pgsql-general@postgresql.org; Tue, 10 Apr 2018 13:50:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-general@postgresql.org From: adsj@novozymes.com (Adam =?utf-8?Q?Sj=C3=B8gren?=) Subject: Re: ERROR: unexpected chunk number 0 (expected 1) for toast value 76753264 in pg_toast_10920100 Date: Tue, 10 Apr 2018 13:52:20 +0200 Lines: 49 Message-ID: <87efjnp9cb.fsf@tullinup.koldfront.dk> References: <7pefuv53dl.fsf@novozymes.com> <871siqcdjh.fsf@tullinup.koldfront.dk> <87efmpllwg.fsf@tullinup.koldfront.dk> <20180117025021.GA39977@paquier.xyz> <874lnlc6ja.fsf@tullinup.koldfront.dk> <7632.1516209379@sss.pgh.pa.us> <87k1tlel41.fsf@tullinup.koldfront.dk> <17892.1522942621@sss.pgh.pa.us> <877eplej3o.fsf@tullinup.koldfront.dk> <87y3i1flgn.fsf@tullinup.koldfront.dk> <25544.1522962278@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) X-Face: )qY&CseJ?.:=8F#^~GcSA?F=9eu'{KAFfL1C3/A&:nE?PW\i65"ba0NS)97,Q(^@xk}n4Ou rPuR#V8I(J_@~H($[ym:`K_+]*kjvW>xH5jbgLBVFGXY:(#4P>zVBklLbdL&XxL\M)%T}3S/IS9lMJ ^St'=VZBR List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Pavan writes: >> FWIW one of our support customers reported a very similar TOAST table >> corruption issue last week which nearly caused an outage. After a lot of >> analysis, I think I've now fully understood the reasons behind the >> corruption, the underlying bug(s) and possible remedy. I am currently >> working on writing a reproducible test case to demonstrate the problem and >> writing the fix. More details on that soon. > > I've posted a reproducer and a proposed fix to -hackers [1] > > In the particular case that I investigated, a database crash/recovery was > involved. But I think we should be able to create a scenario where OID > wrap-around or a standby promotion triggers the problem. I don't know if > any of that was involved in the cases reported on this thread, but I've a > strong suspicion that the underlying bug is probably the same. In our case there was no crash+recovery, but we do have a high write load (and the problem occurring quite seldom), so it sounds like it fits. > [1] https://www.postgresql.org/message-id/CABOikdOgWT2hHkYG3Wwo2cyZJq2zfs1FH0FgX-%3Dh4OLosXHf9w%40mail.gmail.com Impressive investigation! Just a couple of data points: your script to reproduce the problem does so for all three versions of PostgreSQL we have in use: 9.3.22, 9.6.8 and 10.3. And I specifically tested on our production machine which exhibits the problem, running 9.3.22, and your script reproduced the problem there as well. I.e. ending with: ERROR: unexpected chunk number 0 (expected 1) for toast value 16396 in pg_toast_16384 REINDEX ERROR: unexpected chunk number 0 (expected 1) for toast value 16396 in pg_toast_16384 VACUUM ERROR: unexpected chunk number 0 (expected 1) for toast value 16396 in pg_toast_16384 Best regards, Adam -- "No more than that, but very powerful all the Adam Sjøgren same; simple things are good." adsj@novozymes.com