Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWodn-0004ZL-Mb for pgsql-admin@arkaria.postgresql.org; Wed, 03 Jan 2018 19:23:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWodn-00077p-9R for pgsql-admin@arkaria.postgresql.org; Wed, 03 Jan 2018 19:23:55 +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 1eWodm-00077g-Vk for pgsql-admin@lists.postgresql.org; Wed, 03 Jan 2018 19:23:55 +0000 Received: from mr28p48im-tydg10101201.me.com ([17.110.88.44]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eWodk-0002DW-9V for pgsql-admin@lists.postgresql.org; Wed, 03 Jan 2018 19:23:53 +0000 Received: from process-dkim-sign-daemon.mr28p48im-tydg10101201.me.com by mr28p48im-tydg10101201.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P1Z00B00V075X00@mr28p48im-tydg10101201.me.com> for pgsql-admin@lists.postgresql.org; Wed, 03 Jan 2018 19:23:40 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=04042017; t=1515007420; bh=UwUsksL6zejhqjGkPf8VEYpn5trk26HCRVKKBx1kvA8=; h=From:Message-id:Content-type:MIME-version:Subject:Date:To; b=KvBM5NaVPH4NphnnsvIlYkfwcL4D4DIHI+rtfz5hU2j3Pyrbnvy5ClikxbFTu+A4y i1At5xuIs/QlFaHTT4G9Hn6TSL3MY26LUJXrRcEr2ltDR7jCI/EqG7kv16ho4bjlU+ f/7hkUZSujPerSqP9A0CITGmYGWuSfU2n/9Fw8U4+KY3lS7TW4pWW6a8D+Ln4QZhIz 5b1RAfpLNnsJXJlUFaoPEXt2RUaN0HwXN6fNZkX8d7gQi1ErSIsl3TEiSAN3GkSe/l 0hHnRsi9hdVFlJXAlnyRAhOHdfmmqo4hih18IZZayGfYt/uhEg7tS/t5jsVfeNoUJW HST1SHCafkykA== Received: from icloud.com ([127.0.0.1]) by mr28p48im-tydg10101201.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P1Z00HLIV7DOX10@mr28p48im-tydg10101201.me.com>; Wed, 03 Jan 2018 19:23:39 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-03_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1801030265 From: Rui DeSousa Message-id: <79C6454F-E7F3-4AB9-A329-BECB41835BD4@icloud.com> Content-type: multipart/alternative; boundary="Apple-Mail=_DB307880-1FF2-40DC-BA30-2CC767B79C3D" MIME-version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: pt_toast table seems to be Date: Wed, 03 Jan 2018 14:23:37 -0500 In-reply-to: Cc: "pgsql-admin@lists.postgresql.org" To: Jorge Daniel References: X-Mailer: Apple Mail (2.3445.5.20) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_DB307880-1FF2-40DC-BA30-2CC767B79C3D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Do you mean the Postgres instance is killed or the docker instance is = killed? For OOM, what=E2=80=99s the memory configuration and how much = swap is allocated? I would look at your disk subsystem from the prospected of Postgres; = when it issues a sync() does your setup honor it? If you docker = instance is crashing then it seems like sync() might not honored which = would lead to corruption issues you=E2=80=99re describing. > On Jan 3, 2018, at 10:25 AM, Jorge Daniel wrote: >=20 > Hi guys > This is my first post in the comunity so my apologies in advance about = the formalities.=20 >=20 >=20 > In a production db , and after several OOM killer events on the = postgres running on a docker (now fixed) we remain with a kind of = corrupted pg_toast =F0=9F=98=90: >=20 >=20 > 2017-11-29 23:46:13.147 PST rhost=3D10.149.54.5(54750) app=3DPostgreSQL = JDBC Driver:user=3Dveon:db=3Dveon:ERROR: unexpected chunk number 0 = (expected 1) for toast value 17143928 in pg_toast_77809 > 2017-11-29 23:46:13.147 PST rhost=3D10.149.54.5(54750) app=3DPostgreSQL = JDBC Driver:user=3Dveon:db=3Dveon:STATEMENT: SELECT "id", = "needs_pumping", "needs_lucene", "surveybatchid", "ip_address", = "is_open_proxy", "is_partial", "cookies", "social_media_source", = "social_media_review_id", "social_media_pull_id", = "social_media_pull_id_long", "source_config_unitid", = "source_config_source_id", "updated", "external_id_printable_coder", = "unique_reusable_id", "invite_errmsg", "reminder_errmsg", = "last_seen_pagename", "last_submitted_pagename", "has_content_fields", = "logid", "alertid", "language_name", "e_status", "e_reminder_status", = "e_lastupdated", "e_creationdate", "e_sampleddate", "e_responsedate", = "e_invitationdate", "reminderdate", "e_delivereddate", "e_remindeddate", = "e_accepteddate", "e_initialfinishdate", "e_ta_completed_date", = "e_expirationdate", "e_survey_method", "e_survey_source", = "e_survey_type", "parse_status", "tagging_attempts", "e_optout", = "e_bounce_category", "feed_fileid", "feed_file_recordid", "startdate", = "e_lastname", "e_firstname", "e_address", "e_address2", "e_city", = "e_state", "e_postalcode", "e_phone", "e_email", "is_mobile", = "is_mobile_first", "is_mobile_finished", = "is_cookie_confirmation_needed", "exclude_from_problem_tracker", = "is_invitation_error", "page_number_seen_last", = "page_number_seen_highest", "pages_submitted", = "pages_validation_failed", "last_submit_date", "user_agent", = "jsonb_fields", "thrift", "episodeid", "e_unitid", = "e_committed_survey_specid", "customer_veonid", "xmin" FROM = "survey_prior" WHERE survey_veon.surveyid =3D ANY($1)=20 >=20 > The usual fix is :=20 >=20 > REINDEX TABLE pg_toast_77809;=20 >=20 > After this we can select * from survery_prior with no problem, and we = can dump the entire table if we wish it.=20 >=20 > Then the jobs resumes and we're happy until we hit again with the same = error , this occurs randomly , we suspect on the UPDATE on certain row = is creating the corruption.=20 >=20 > We can't reproduce the ERROR because we can't do a full scan of the = table while the error is still alive () on-call guys applies the fix = inmediatly to resume production ).=20 >=20 > So how can we discover the bad-rows and expose them, or how do we = check the consistency of the pt_toast table?=20 >=20 > We need this evidence to ask for window and a complete dump/restore = that will wipe out this problem. >=20 > Thx in advance=20 >=20 > Jorge Daniel Fernandez=20 --Apple-Mail=_DB307880-1FF2-40DC-BA30-2CC767B79C3D Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Do = you mean the Postgres instance is killed or the docker instance is = killed?  For OOM, what=E2=80=99s the memory configuration and how = much swap is allocated?

I would look at your disk subsystem from the prospected of = Postgres; when it issues a sync() does your setup honor it?  If you = docker instance is crashing then it seems like sync() might not honored = which would lead to corruption issues you=E2=80=99re describing.

On Jan 3, 2018, at 10:25 AM, Jorge Daniel <elgaita@hotmail.com>= wrote:

Hi guys
This is my first post in the = comunity so my apologies in advance about the = formalities. 


In a production db , and = after several OOM killer events on the postgres running on a docker (now = fixed) we remain with a kind of corrupted pg_toast =F0=9F=98=90:


2017-11-29 23:46:13.147 PST rhost=3D10.149.54.5(54750) = app=3DPostgreSQL JDBC Driver:user=3Dveon:db=3Dveon:ERROR:  = unexpected chunk number 0 (expected 1) for toast value 17143928 in = pg_toast_77809
2017-11-29 23:46:13.147 PST = rhost=3D10.149.54.5(54750) app=3DPostgreSQL JDBC = Driver:user=3Dveon:db=3Dveon:STATEMENT:  SELECT "id", = "needs_pumping", "needs_lucene", "surveybatchid", "ip_address", = "is_open_proxy", "is_partial", "cookies", "social_media_source", = "social_media_review_id", "social_media_pull_id", = "social_media_pull_id_long", "source_config_unitid", = "source_config_source_id", "updated", "external_id_printable_coder", = "unique_reusable_id", "invite_errmsg", "reminder_errmsg", = "last_seen_pagename", "last_submitted_pagename", "has_content_fields", = "logid", "alertid", "language_name", "e_status", "e_reminder_status", = "e_lastupdated", "e_creationdate", "e_sampleddate", "e_responsedate", = "e_invitationdate", "reminderdate", "e_delivereddate", "e_remindeddate", = "e_accepteddate", "e_initialfinishdate", "e_ta_completed_date", = "e_expirationdate", "e_survey_method", "e_survey_source", = "e_survey_type", "parse_status", "tagging_attempts", "e_optout", = "e_bounce_category", "feed_fileid", "feed_file_recordid", "startdate", = "e_lastname", "e_firstname", "e_address", "e_address2", "e_city", = "e_state", "e_postalcode", "e_phone", "e_email", "is_mobile", = "is_mobile_first", "is_mobile_finished", = "is_cookie_confirmation_needed", "exclude_from_problem_tracker", = "is_invitation_error", "page_number_seen_last", = "page_number_seen_highest", "pages_submitted", = "pages_validation_failed", "last_submit_date", "user_agent", = "jsonb_fields", "thrift", "episodeid", "e_unitid", = "e_committed_survey_specid", "customer_veonid", "xmin" FROM = "survey_prior"  WHERE survey_veon.surveyid =3D = ANY($1) 

The usual fix is : 

REINDEX TABLE = pg_toast_77809; 

After this we can select * from survery_prior  with no = problem, and we can dump the entire table if we wish it. 

Then the jobs resumes = and we're happy until we hit again with the same error , this occurs = randomly , we suspect on the  UPDATE  on certain row is = creating the corruption. 

We can't reproduce the ERROR because we = can't do a full scan of the table while the error is still alive () = on-call guys applies the fix inmediatly to resume production = ). 

So = how can we discover the bad-rows and expose them, or how do we check the = consistency of the pt_toast table? 

We need this evidence to ask for window = and a complete dump/restore that will wipe out this problem.

Thx in = advance 

Jorge Daniel = Fernandez 

= --Apple-Mail=_DB307880-1FF2-40DC-BA30-2CC767B79C3D--