Re: Suppress 'duplicate key' at errorlog?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Scott Whitney <scott(at)journyx(dot)com>
Cc: "Rossi, Maria" <maria(dot)rossi(at)us(dot)pgds(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Suppress 'duplicate key' at errorlog?
Date: 2015-03-30 23:05:34
Message-ID: CAKFQuwZFarfPsDbHicpaugT7EA7FzrXa_WMrH47K=HCfRRW4DA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

>
>
>
> On Mon, Mar 30, 2015 at 5:45 PM, David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Mon, Mar 30, 2015 at 2:03 PM, Rossi, Maria <maria(dot)rossi(at)us(dot)pgds(dot)com>
> wrote:
>
>> Hi,
>>
>>
>>
>> Is there a way to suppress a ‘duplicate key’ msg from the errorlog? Due
>> to a bug in a 3rd party application, this keeps on appearing and I am
>> concerned that it will fill up the filesystem. I can delete the old
>> errorlog, but if there is any other meaningful msgs out there, I would
>> lose that too.
>>
>>
>>
>> Thanks.
>>
>>
>>
>> *Maria *
>>
>>
>>
>
> Not in any way that doesn't also entail the "but if there is any other
> meaningful msgs out there, I would lose that too." risk.
>
> Stop thinking about the limited problem of removing the excessive messages
> and just learn how to deal with high-volume log situations generally. At
> worse you could a simple log rotation and archive with a cleanup "sed"
> script that deletes these messages. Suggest setting "application_name" in
> order to be more targeted.
>
> David J.​
>
> ​
On Mon, Mar 30, 2015 at 3:54 PM, Scott Whitney <scott(at)journyx(dot)com> wrote:

> I _do_ want to phone in on the whole duplicate key issue.
>
> Sure, this could be a race condition. It could be bad programming. It
> could be a variety of things.
>
> You ABSOLUTELY do not want to ignore that. Ignoring and moving on will
> cause consistency problems. Catch it and add it to a log or an email.
> Continue.
>
> Do NOT silently ignore something trying to add a duplicate key.
>
The OP is "logging" the error...

A reasonably valid process would raise the error to the application which
would then retry the insert using a different key. Application works fine
but the error logs have a lot of expected errors in them. There is a
performance concern but not a data integrity one.​

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2015-03-30 23:15:29 Re: Suppress 'duplicate key' at errorlog?
Previous Message Scott Whitney 2015-03-30 22:54:21 Re: Suppress 'duplicate key' at errorlog?