Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8lvM-0004U9-M8 for pgsql-general@arkaria.postgresql.org; Tue, 26 Mar 2019 13:15:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h8lvK-00038e-KS for pgsql-general@arkaria.postgresql.org; Tue, 26 Mar 2019 13:15:26 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8lvK-00032D-4Z for pgsql-general@lists.postgresql.org; Tue, 26 Mar 2019 13:15:26 +0000 Received: from sonic306-2.consmr.mail.bf2.yahoo.com ([74.6.132.41]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8lvG-0007Dn-Qn for pgsql-general@lists.postgresql.org; Tue, 26 Mar 2019 13:15:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1553606119; bh=TSHaRxra5mWUKQTqZVRt28G68SqeR3SUcE0ONYemFZI=; h=Date:From:To:In-Reply-To:References:Subject:From:Subject; b=hyPCB01P9m8mDXBfa3f4TcT9RglyaG1cKsmqtQ4zj8t3cUJcFymbqp8ZZkb4DkDCg0mytM5LKNlQLkvj3N0OEzY7Zr3rs483H/NerPnMujMaG5Pq718JGWj+3JzVVlP503ZFXsYa4U7X1ANAV5GsS4kDexTwKynpVlEsVTjBJoiHVpIh+SNEcz/mNrjD+KhZewaaD0H2/ThtuoNLbYhcp//gLKSElpqlYTmV4/GpNZaQsXfsfxF+U/sMEmOEcx2Lx/aGhXklZ2Peb/+PjNkNHksFHgPoSeEkI7XGpXtS83f6niQym0hB9ao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2CE1rOKPduLb_kTKaQ3x vRBRlb3Ruo8u2zWEEkhuPO.dNaHcCgIvPH0M1ungfVsOgnfKyEjrNzqiOKaqI9GIssSen.TIZ78. BxFlm6JGH_V2_yoL3bfUEdFGok7kGmQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.bf2.yahoo.com with HTTP; Tue, 26 Mar 2019 13:15:19 +0000 Date: Tue, 26 Mar 2019 13:15:16 +0000 (UTC) From: Thomas Tignor To: "pgsql-general@lists.postgresql.org" , Laurenz Albe Message-ID: <434931116.11194597.1553606116150@mail.yahoo.com> In-Reply-To: <36fb4cf70a723ffe5ffe9dba850357fa0bc97b18.camel@cybertec.at> References: <1080815989.10741938.1553539577631.ref@mail.yahoo.com> <1080815989.10741938.1553539577631@mail.yahoo.com> <36fb4cf70a723ffe5ffe9dba850357fa0bc97b18.camel@cybertec.at> Subject: Re: postgres 9.5 DB corruption: invalid byte sequence for encoding "UTF8" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_11194596_654929598.1553606116148" X-Mailer: WebService/1.1.13212 YMailNorrin Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36 Content-Length: 6060 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_11194596_654929598.1553606116148 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Laurenz. Thanks for writing. I can tell you that while the error message= usually identifies just one byte (though sometimes up to three), inspectio= n of the data has frequently shown several bytes impacted. It often seems t= hat the corruption begins at one point in the row and continues to the end. At this point, we've taken a few mitigating steps: we have switched all the= VARCHAR columns in the alert_instance and alert_attribute tables to use "p= lain" storage. Also, we've dropped a (name, value) index we were using for = the alert_attribute table. I looked at the checksums feature sometime earlier. This is something we co= uld try, with some effort, but it appears a sum is applied to a page leavin= g shared_buffers and then checked when the page is read back. Our Slony-I r= eplication service is pulling the latest changes into subscriber DBs every = couple seconds. Normally, when data corruption occurs, it appears very quic= kly with a Slony-I COPY failure. It seems there may not be time to write a = checksum. Tom =C2=A0 =C2=A0:-)=20 On Tuesday, March 26, 2019, 4:25:33 AM EDT, Laurenz Albe wrote: =20 =20 Thomas Tignor wrote: > We are experiencing intermittent DB corruption in postgres 9.5.14. We are= trying to > identify and eliminate all sources. We are using two independent services= for data > replication, Slony-I v2.2.6 and a custom service developed in-house. Both= are based > on COPY operations. DB corruption is observed when COPY operations fail w= ith an error > of the form: 'invalid byte sequence for encoding "UTF8"'. > This occurs with a frequency ranging between a few days and several weeks= . It might be a storage problem, but it could also be a problem with how the = data get into the database in the first place. I would consider it unlikely that there is a bug in the TOAST code that cha= nges just one byte. You could use block checksums to see if the storage is at fault, but unfort= unately it requires an "initdb", dump and restore to switch to checksums. Yours, Laurenz Albe --=20 Cybertec | https://www.cybertec-postgresql.com =20 ------=_Part_11194596_654929598.1553606116148 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Laurenz. Thanks for writing. I can tell you that while the = error message usually identifies just one byte (though sometimes up to thre= e), inspection of the data has frequently shown several bytes impacted. It = often seems that the corruption begins at one point in the row and continue= s to the end.

At this point, we've taken a few mit= igating steps: we have switched all the VARCHAR columns in the alert_instan= ce and alert_attribute tables to use "plain" storage. Also, we've dropped a= (name, value) index we were using for the alert_attribute table.

I looked at the checksums feature sometime earlier. This is= something we could try, with some effort, but it appears a sum is applied = to a page leaving shared_buffers and then checked when the page is read bac= k. Our Slony-I replication service is pulling the latest changes into subsc= riber DBs every couple seconds. Normally, when data corruption occurs, it a= ppears very quickly with a Slony-I COPY failure. It seems there may not be = time to write a checksum.

Tom    :-)


=20
=20
On Tuesday, March 26, 2019, 4:25:33 AM EDT, Laurenz Alb= e <laurenz.albe@cybertec.at> wrote:


Thomas Tignor wrote:

>= We are experiencing intermittent DB corruption in postgres 9.5.14. We are = trying to
> identify and eliminate all sources. We are= using two independent services for data
> replication= , Slony-I v2.2.6 and a custom service developed in-house. Both are based> on COPY operations. DB corruption is observed when COP= Y operations fail with an error
> of the form: 'invali= d byte sequence for encoding "UTF8"'.
> This occurs wi= th a frequency ranging between a few days and several weeks.


It might be a storage problem, but it could al= so be a problem with how the data
get into the database i= n the first place.

I would consider it= unlikely that there is a bug in the TOAST code that changes
just one byte.

You could use block= checksums to see if the storage is at fault, but unfortunately
it requires an "initdb", dump and restore to switch to checksums.
Yours,
Laurenz Albe--
Cybertec | htt= ps://www.cybertec-postgresql.com


<= /div>
------=_Part_11194596_654929598.1553606116148--