Re: running ANALYZE results in => duplicate key value violates unique constraint "pg_statistic_relid_att_inh_index"

From: Imre Samu <pella(dot)samu(at)gmail(dot)com>
To: krah(dot)tm(at)gmail(dot)com
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: running ANALYZE results in => duplicate key value violates unique constraint "pg_statistic_relid_att_inh_index"
Date: 2023-09-06 18:42:15
Message-ID: CAJnEWwmV9W1z2andsPV4O+Nfv-y2MtkHZcY0AzfyRTz57ZOf4Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> But how is that corruption happening - I mean it is a docker image,
> freshly fetched from the registry.

Hi Torsten,

Maybe you have to increase the "*--stop-timeout" value ; ( or
"*stop_grace_period"
in docker-compose )
https://github.com/docker-library/postgres/issues/544#issuecomment-455738848

*docker run: **" --stop-timeout Timeout (in seconds) to stop a container "*
https://docs.docker.com/engine/reference/commandline/run/
or
https://docs.docker.com/compose/compose-file/compose-file-v3/#stop_grace_period

And recommended in the Dockerfile:
https://github.com/docker-library/postgres/blob/master/Dockerfile-debian.template#L208

*STOPSIGNAL SIGINT## An additional setting that is recommended for all
users regardless of this# value is the runtime "--stop-timeout" (or your
orchestrator/runtime's# equivalent) for controlling how long to wait
between sending the defined# STOPSIGNAL and sending SIGKILL (which is
likely to cause data corruption).## The default in most runtimes (such as
Docker) is 10 seconds, and the# documentation at
https://www.postgresql.org/docs/12/server-start.html
<https://www.postgresql.org/docs/12/server-start.html> notes# that even 90
seconds may not be long enough in many instances.*

regards,
Imre

Torsten Krah <krah(dot)tm(at)gmail(dot)com> ezt írta (időpont: 2023. szept. 6., Sze,
14:45):

> Am Mittwoch, dem 06.09.2023 um 10:21 +0200 schrieb Laurenz Albe:
> > You are lucky that the corrupted table is one that holds data that
> > can be rebuilt.
>
> It is a test instance / container anyway which is deleted afterwards
> and can be setup again as often as I want.
>
> But how is that corruption happening - I mean it is a docker image,
> freshly fetched from the registry.
>
> After that I am starting a container from that image, (re)importing
> data (different tests => different data so the cycle of delete data /
> import data / analyze the data happens quite often) and running my
> tests.
> The OS does not report anything which would relate nor does any other
> tool / system fail nor does postgresl itself fail on any other table
> here - it always fails only on that analyze part.
>
> That happens all in about 8-10 minutes for the whole process - what is
> causing that corruption in that short timeframe here?
>
> regards
>
> Torsten
>
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Johnson, Bruce E - (bjohnson) 2023-09-06 19:23:19 listening on an address other than 'localhost'?
Previous Message Albrecht Dreß 2023-09-06 18:32:16 Re: Q: inet operators for IPv4 encapsulated in IPv6