database not enforcing unqiue constriant

Lists: pgsql-general
From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "PgSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: database not enforcing unqiue constriant
Date: 2006-10-27 02:00:13
Message-ID: b42b73150610261900g73725e25m15f018397eb83b5a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

My previous employer contacted me today. Apparently they are having
an increasing frequency of occurances where they disocover violations
of the primary key constraint not being caught by the database. This
system is an ISAM emulation system, and it relies heavily on the
database throwing unique constraint violations to approximately
provide a cobol rewrite statement.

These errors are never caught when they occur. One way they are
caught is during a dump/reload, the record fails to reinsert.

I brought this up around a year ago, and the issue was never
successfully resolved. These are windows systems running PostgreSQL
8.0.x.

any thoughts?

merlin


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: PgSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: database not enforcing unqiue constriant
Date: 2006-10-27 02:11:59
Message-ID: 45416AEF.9010301@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Merlin Moncure wrote:
> My previous employer contacted me today. Apparently they are having
> an increasing frequency of occurances where they disocover violations
> of the primary key constraint not being caught by the database. This
> system is an ISAM emulation system, and it relies heavily on the
> database throwing unique constraint violations to approximately
> provide a cobol rewrite statement.
>
> These errors are never caught when they occur. One way they are
> caught is during a dump/reload, the record fails to reinsert.
>
> I brought this up around a year ago, and the issue was never
> successfully resolved. These are windows systems running PostgreSQL
> 8.0.x.
>
> any thoughts?

Do they vacuum enough? I have seen problems with PostgreSQL (albeit not
since 7.3) where a unique constraint would not enforce because of index
bloat.

Sincerely,

Joshua D. Drake

>
> merlin
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: "PgSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: database not enforcing unqiue constriant
Date: 2006-10-27 02:14:34
Message-ID: b42b73150610261914l6b3625dev404922ca8837a356@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 10/27/06, Joshua D. Drake <jd(at)commandprompt(dot)com> wrote:
> Merlin Moncure wrote:
> > My previous employer contacted me today. Apparently they are having
> > an increasing frequency of occurances where they disocover violations
> > of the primary key constraint not being caught by the database. This
> > system is an ISAM emulation system, and it relies heavily on the
> > database throwing unique constraint violations to approximately
> > provide a cobol rewrite statement.
> >
> > These errors are never caught when they occur. One way they are
> > caught is during a dump/reload, the record fails to reinsert.
> >
> > I brought this up around a year ago, and the issue was never
> > successfully resolved. These are windows systems running PostgreSQL
> > 8.0.x.
> >
> > any thoughts?
>
> Do they vacuum enough? I have seen problems with PostgreSQL (albeit not
> since 7.3) where a unique constraint would not enforce because of index
> bloat.

iirc vacuum was set up to run weekly on cron. based on turnover which
was high but not super high that seemed appropriate.

merlin


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, PgSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: database not enforcing unqiue constriant
Date: 2006-10-27 13:22:43
Message-ID: 20061027132243.GL31183@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Joshua D. Drake wrote:
> Merlin Moncure wrote:
> > My previous employer contacted me today. Apparently they are having
> > an increasing frequency of occurances where they disocover violations
> > of the primary key constraint not being caught by the database. This
> > system is an ISAM emulation system, and it relies heavily on the
> > database throwing unique constraint violations to approximately
> > provide a cobol rewrite statement.
> >
> > These errors are never caught when they occur. One way they are
> > caught is during a dump/reload, the record fails to reinsert.
> >
> > I brought this up around a year ago, and the issue was never
> > successfully resolved. These are windows systems running PostgreSQL
> > 8.0.x.
> >
> > any thoughts?
>
> Do they vacuum enough? I have seen problems with PostgreSQL (albeit not
> since 7.3) where a unique constraint would not enforce because of index
> bloat.

Huh?? This would qualify as a serious bug. Failure to vacuum should
bring performance loss, but not functionality loss (modulo the Xid
wraparound issue).

I do remember vaguely the failure Merlin alludes to, and IIRC it has
been reported a couple of times by other people but has never been
resolved because it was awfully difficult to reproduce. Maybe it has
something to do with the btree bug that Tom diagnosed on Wednesday? The
uniqueness-checking code is ... weird.

I guess if it was the same bug, you could not vacuum the table, which I
assume you do regularly.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, "Merlin Moncure" <mmoncure(at)gmail(dot)com>, "PgSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: database not enforcing unqiue constriant
Date: 2006-10-27 13:38:22
Message-ID: b42b73150610270638p5cde5f6fm98a4b9aaf579bcbb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 10/27/06, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
> > Do they vacuum enough? I have seen problems with PostgreSQL (albeit not
> > since 7.3) where a unique constraint would not enforce because of index
> > bloat.
>
> Huh?? This would qualify as a serious bug. Failure to vacuum should
> bring performance loss, but not functionality loss (modulo the Xid
> wraparound issue).

right, i think he was talking about the wraparound issue. definately
does not apply here.

> I do remember vaguely the failure Merlin alludes to, and IIRC it has
> been reported a couple of times by other people but has never been
> resolved because it was awfully difficult to reproduce. Maybe it has
> something to do with the btree bug that Tom diagnosed on Wednesday? The
> uniqueness-checking code is ... weird.

I'm hoping this is the case. When 8.2 comes out I'm going to upgrade
their servers to that version and hope for the best.

> I guess if it was the same bug, you could not vacuum the table, which I
> assume you do regularly.

right. Since these are gererally not 24 hour operations, vacuum is
performed regularly on a schedule. Also, I am going to implement a
sweep which checks each table for duplicates on each constraint.

Since this is a converted ISAM system, the query volume is enormous
but the data turnover is not. Pessimistic locks are enforced with the
userlock module. Statements executed over ExecPrepared 100% of the
time.

merlin