From: | Henri KY <sideuxb-ky(dot)consultant(at)dgfip(dot)finances(dot)gouv(dot)fr> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Geoghegan <pg(at)bowt(dot)ie> |
Cc: | CONCHY Elisabeth <elisabeth(dot)conchy(at)dgfip(dot)finances(dot)gouv(dot)fr>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #14874: Dublicate values in primary key |
Date: | 2017-10-31 15:52:27 |
Message-ID: | 29253_1509465149_59F89C3D_29253_317_1_5d173abc-79ff-6bdf-f786-997490f8d620@dgfip.finances.gouv.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hello again,
With the uncleaned files left in the tablespaces after database restore
operation, this let us perform few futher tests.
We tried to duplicate manually data files used by one table and restart
the cluster, the reindex of the table has failed with duplicate key error.
As a conclusion, PostgreSQL does not check data integrity during cluster
restart, and if data files are altered, the database is corrupted
without any notice.
It would be better that PostgreSQL would report error related to data
integrity issue during database lifetime in the futur versions (this is
not implemented in version 9.6).
Here below the tests we have perfomed in detail:
[postgres] $ ls -lh
/u05/pgsql/9.4/data/mydb001/tbs_ges_dat/PG_9.4_201409291/17273
total 1,1G
-rw------- 1 postgres postgres 1,0G 31 oct. 13:48 17274
-rw------- 1 postgres postgres 11M 31 oct. 13:48 17274.1
-rw------- 1 postgres postgres 280K 31 oct. 13:46 17274_fsm
[postgres] mydb=# select count(*) from anomalie;
count
----------
18000000
[postgres] mydb=# \d+
Liste des relations
Schéma | Nom | Type | Propriétaire | Taille |
Description
------------+--------------------+----------+--------------+------------+-------------
public | anomalie | table | postgres | 1034 MB |
public | anomalie_id_seq | séquence | postgres | 8192 bytes |
public | pg_buffercache | vue | postgres | 0 bytes |
public | pg_stat_statements | vue | postgres | 0 bytes |
[postgres] mydb=# reindex table anomalie;
REINDEX
[postgres] $ pg_ctl stop ...
[postgres] $ cd
/u05/pgsql/9.4/data/mydb001/tbs_ges_dat/PG_9.4_201409291/17273
[postgres] $ cp 17274.1 17274.2
[postgres] $ cp 17274 17274.1
[postgres] $ pg_ctl start ...
[postgres] $ ls -lh
/u05/pgsql/9.4/data/mydb001/tbs_ges_dat/PG_9.4_201409291/17273
total 2,1G
-rw------- 1 postgres postgres 1,0G 31 oct. 13:58 17274
-rw------- 1 postgres postgres 1,0G 31 oct. 13:59 17274.1
-rw------- 1 postgres postgres 11M 31 oct. 13:59 17274.2
-rw------- 1 postgres postgres 280K 31 oct. 13:46 17274_fsm
[postgres] mydb=# select count(*) from anomalie;
count
----------
35825792
[postgres] mydb=# \d+
Liste des relations
Schéma | Nom | Type | Propriétaire | Taille |
Description
--------+--------------------+----------+--------------+------------+-------------
public | anomalie | table | postgres | 2058 MB |
public | anomalie_id_seq | séquence | postgres | 8192 bytes |
public | pg_buffercache | vue | postgres | 0 bytes |
public | pg_stat_statements | vue | postgres | 0 bytes |
[postgres] mydb=# reindex table anomalie;
ERROR: could not create unique index "anomalie_pk"
DÉTAIL : Key (id_anomalie)=(1) is duplicated.
Regards
Henri
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2017-11-01 13:36:12 | Re: BUG #14866: The generated constraint in the typed table causes the server to crash |
Previous Message | Alexander Korotkov | 2017-10-31 15:25:03 | Re: pg_trgm word_similarity inconsistencies or bug |