BUG #14598: Duplicate values found when reindexing unique index

From: manoj(dot)kumar(dot)mbm(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14598: Duplicate values found when reindexing unique index
Date: 2017-03-25 08:22:12
Message-ID: 20170325082212.2694.43097@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14598
Logged by: Manoj Kumar
Email address: manoj(dot)kumar(dot)mbm(at)gmail(dot)com
PostgreSQL version: Unsupported/Unknown
Operating system: RHEL 5.8
Description:

I have encountered the same bug as mentioned at
:-https://www.postgresql.org/message-id/8bca3aa10712300802h1c34ce69j1a1ab8b730c002e9@mail.gmail.com

[Version]
Red Hat Enterprise Linux 5.8 (x86_64)
PostgreSQL
8.1.18

[Occurrence]
Rarely

[Impact]
Critical, partition on which pgdata lie become full and PostgreSQL server
shut down abruptly.

[Scenario in which this bug produced]

1) Reindex statement :-

<127.0.0.1(58384)%2016-09-13 02:35:04 GMT> LOG: duration: 47606.785 ms
statement: REINDEX TABLE tb_node_performance_info;REINDEX TABLE tb_.........
(40-50 tables more)

2) Insert statement are triggering on cron basis.
##########################################
<169.254.136.51(54356)%2016-09-13 02:35:05 GMT> LOG: duration: 2274.218 ms
statement: INSERT INTO tb_node_performance_info (
node_id,timeflag,cpuusedrate,memorytotal,memoryfree,totalbandwidthread,totalbandwidthwrite
)VALUES( 'HN0801',1473733740,0.157,98806968,95408416,0.1,0 )
#############################################

#######################
<169.254.135.55(43842)%2016-09-13 02:35:06 GMT> LOG: duration: 1679.948 ms
statement: INSERT INTO tb_node_performance_info (
node_id,timeflag,cpuusedrate,memorytotal,memoryfree,totalbandwidthread,totalbandwidthwrite
)VALUES( 'HN0705',1473733980,0.146,98806968,95607020,0,0 )
###########################

3) Duplicate key violation is observed:-
###############################################################
<169.254.131.33(51484)%2016-09-13 02:35:08 GMT> ERROR: duplicate key
violates unique constraint "tb_node_performance_info_pkey"
<169.254.131.33(51484)%2016-09-13 02:35:08 GMT> CONTEXT: SQL statement
"INSERT INTO tb_node_performance_info (node_id,timeflag,cpuusedrate,
memorytotal,memoryfree)VALUES( $1 , $2 , $3 , $4 , $5 )"
###################################################################

4) suddenly the index file of tb_performance_info_pkey got deleted:-

<%2016-09-13 02:38:13 GMT> ERROR: could not open relation
1663/16385/280951: No such file or directory

5) After that reindex fails and wall size keep on increasing.

Result partition full and PostgreSQL fails.

-----------------------------------
Faced two times in past year.

-----------------------------------

[queries]
1) primary key is [Node_ID, timestamp] tb_node_performance_info.
This insert statement always trigger on every minute by cron. primary key is
ale ways unique because timestamp(epoch) + node_id is always unique.

There is no point of duplicate data, then why we get duplicate key violation
msg ?

2) Is there any way to recover the data?
(Currently I have pgdata which I cannot read because of missing relation
file. )

3) Is this bug related to BUG #11141: Duplicate primary key values
corruption.

Note:- we have analyzed complete partition and found that there is no
hardware related issue.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2017-03-26 13:11:55 Re: BUG #14598: Duplicate values found when reindexing unique index
Previous Message Michael Paquier 2017-03-24 12:59:24 Re: Backend crash on non-exclusive backup cancel