Re: Serialization exception : Who else was involved? - Mailing list pgsql-hackers

From Olivier MATROT
Subject Re: Serialization exception : Who else was involved?
Date
Msg-id B67C2F6B6C7C57468D1BA9F1762371210580722D@pluton.Vepro.intra
Whole thread Raw
In response to Re: Serialization exception : Who else was involved?  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
Indeed, NOTICE is wrong because it would doom the transaction that sets the flag if it should be later PREPARED.
I think that reporting the PIDs and the current activity of each process would be nice. DeadLoackReport() is using
pgstat_get_backend_current_activity()to get the process activity. 

I'll see what I could come up with.

Thanks,
om

-----Message d'origine-----
De : Noah Misch [mailto:noah@leadboat.com]
Envoyé : samedi 27 décembre 2014 10:51
À : Olivier MATROT
Cc : pgsql-hackers@postgresql.org
Objet : Re: Serialization exception : Who else was involved?

On Tue, Dec 02, 2014 at 11:17:43AM +0100, Olivier MATROT wrote:
> Serialization conflict detection is done in
> src/backend/storage/lmgr/predicate.c, where transactions that are
> doomed to fail are marked as such with the SXACT_FLAG_DOOMED flag.
>
> I simply added elog(...) calls with the NOTIFY level, each time the
> flag is set, compiled the code and give it a try.

> I would like to see this useful and simple addition in a future
> version of PostgreSQL.
> Is it in the spirit of what is done when it comes to ease the work of
> the developer ?
> May be the level I've chosen is not appropriate ?

I would value extra logging designed to help users understand the genesis of serialization failures.  A patch the
communitywould adopt will probably have more complexity than your quick elog(NOTICE, ...) addition.  I don't have a
clearpicture of what the final patch should be, but the following are some thoughts to outline the problem space.  See
[1]for an earlier discussion. 
The logging done in DeadLockReport() is a good baseline; it would be best to consolidate a similar level of detail and
reportit all as part of the main serialization failure report.  That may prove impractical.  If transaction TA marks
transactionTB's doom, TA can be long gone by the time TB reports its serialization failure.  TA could persist the
detailsneeded for that future error report, but that may impose costs out of proportion with the benefit. 
If so, we can fall back on your original idea of emitting a message in the command that performs the flag flip.  That
wouldneed a DEBUG error level, though.  Sending a NOTICE to a client when its transaction dooms some other transaction
wouldadd noise in the wrong place. 

Thanks,
nm

[1] http://www.postgresql.org/message-id/flat/AANLkTikF-CR-52nWAo2VG_348aTsK_+0i=chBPNqdepv@mail.gmail.com



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Additional role attributes && superuser review
Next
From: Stephen Frost
Date:
Subject: Re: Additional role attributes && superuser review