mbox series

[0/5] Prevent database error logs on duplicate mail

Message ID 20200416012928.23893-1-jk@ozlabs.org
Headers show
Series Prevent database error logs on duplicate mail | expand

Message

Jeremy Kerr April 16, 2020, 1:29 a.m. UTC
On patchwork.ozlabs.org, we see a lot of noise in the postgres logs, due
to INSERTs with duplicate values for (project,msgid) keys. Patchwork's
strategy for catching the resulting IntegrityError means that each of
these is logged.

Instead, this change moves to an atomic select -> insert for the Patch,
Comment and Coverletter parsing.

Jeremy Kerr (5):
  tests: Add duplicate mail test
  tests: ensure we don't see database errors during duplicate insert
  parser: prevent IntegrityErrors
  parser: don't trigger database IntegrityErrors on duplicate comments
  parser: don't trigger database IntegrityErrors on duplicate
    coverletters

 patchwork/parser.py            | 20 ++++++-----
 patchwork/tests/test_parser.py | 64 ++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 9 deletions(-)

Comments

Stephen Finucane April 18, 2020, 12:09 p.m. UTC | #1
On Thu, 2020-04-16 at 09:29 +0800, Jeremy Kerr wrote:
> On patchwork.ozlabs.org, we see a lot of noise in the postgres logs, due
> to INSERTs with duplicate values for (project,msgid) keys. Patchwork's
> strategy for catching the resulting IntegrityError means that each of
> these is logged.
> 
> Instead, this change moves to an atomic select -> insert for the Patch,
> Comment and Coverletter parsing.

These all looked sane and have been applied and backported to
stable/2.2. Note however that we rely on integerity error checking to
handle races when creating a new series [1]. I imagine this might also
be the source of some noise. I don't have any clever ideas here so if
you do, I'm all ears.

Stephen

[1] https://github.com/getpatchwork/patchwork/blob/55fb26bf5/patchwork/parser.py#L1091-L1174

> Jeremy Kerr (5):
>   tests: Add duplicate mail test
>   tests: ensure we don't see database errors during duplicate insert
>   parser: prevent IntegrityErrors
>   parser: don't trigger database IntegrityErrors on duplicate comments
>   parser: don't trigger database IntegrityErrors on duplicate
>     coverletters
> 
>  patchwork/parser.py            | 20 ++++++-----
>  patchwork/tests/test_parser.py | 64 ++++++++++++++++++++++++++++++++++
>  2 files changed, 75 insertions(+), 9 deletions(-)
>