From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Сергей А. Фролов <sergey.frolov@smetarik.ru>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14940: Duplicated records inspite of primary key and unique constraint
Date: Mon, 4 Dec 2017 15:36:23 +0100
Message-ID: <2e9f0483-f084-53e9-e80b-bf112f9a6053@2ndquadrant.com> (raw)
In-Reply-To: <023c1715-3a10-1a4d-6efd-ccb8823fdfb8@smetarik.ru>
References: <20171201171513.if4pd67kh5sl7u53@alvherre.pgsql>
<023c1715-3a10-1a4d-6efd-ccb8823fdfb8@smetarik.ru>
On 12/04/2017 09:22 AM, Сергей А. Фролов wrote:
> 1. I'll try amcheck after I get system on Debian and if the problem
> will remain after dump/restore.
>
> 2. Switthing off enable_indexscan enable_bitmapscan has no effect:
>
> set enable_indexscan = off;
> set enable_bitmapscan = off;
>
> select ctid,xmin,xmax, id, base_id, norm_id from nb.nb_basedtl where id =
> 11658502;
>
> (0,49);364507;0;11658502;269;46203
> (0,49);370881;0;11658502;269;46203
> (0,49);370882;0;11658502;269;46203
>
>
> select ctid,xmin,xmax,id, base_id, norm_id from nb.nb_basedtl where id
> in (select
> id from nb.nb_basedtl group by id having count(1) > 1 ) order by ctid,id
> (0,1);364507;0;16101774;321;1239643
> (0,1);370881;0;16101774;321;1239643
> (0,1);370882;0;16101774;321;1239643
> (0,2);370882;0;20365934;425;2
> (0,2);370881;0;20365934;425;2
> (0,2);364507;0;20365934;425;2
> (0,3);370881;0;20365935;425;3
> (0,3);364507;0;20365935;425;3
> (0,3);370882;0;20365935;425;3
> (0,4);370881;0;20365936;425;4
> (0,4);364507;0;20365936;425;4
> ...
> (0,49);370882;0;11658502;269;46203
> (0,49);370881;0;11658502;269;46203
> (0,49);364507;0;11658502;269;46203
> (0,50);364507;0;11658508;269;46204
> (0,50);370882;0;11658508;269;46204
> (0,50);370881;0;11658508;269;46204
>
Interesting. All the duplicate records seem to be on the first page, and
there are always three of them ... I wonder if those records are part of
the same HOT chain, or something like that.
Can you look at the page using pageinspect? Something like
SELECT * FROM heap_page_items(get_raw_page('nb.nb_basedtl', 0));
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tomas.vondra@2ndquadrant.com, sergey.frolov@smetarik.ru, alvherre@alvh.no-ip.org
Subject: Re: BUG #14940: Duplicated records inspite of primary key and unique constraint
In-Reply-To: <2e9f0483-f084-53e9-e80b-bf112f9a6053@2ndquadrant.com>
References: <20171201171513.if4pd67kh5sl7u53@alvherre.pgsql> <023c1715-3a10-1a4d-6efd-ccb8823fdfb8@smetarik.ru> <2e9f0483-f084-53e9-e80b-bf112f9a6053@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox