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

From Noah Misch
Subject Re: Serialization exception : Who else was involved?
Date
Msg-id 20141227095111.GA2037363@tornado.leadboat.com
Whole thread Raw
In response to Serialization exception : Who else was involved?  (Olivier MATROT <olivier.matrot@accelis-sir.fr>)
Responses Re: Serialization exception : Who else was involved?  (Olivier MATROT <olivier.matrot@accelis-sir.fr>)
List pgsql-hackers
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 community would adopt will probably have
more complexity than your quick elog(NOTICE, ...) addition.  I don't have a
clear picture 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 report it all as part of the main
serialization failure report.  That may prove impractical.  If transaction TA
marks transaction TB's doom, TA can be long gone by the time TB reports its
serialization failure.  TA could persist the details needed 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 would need a DEBUG error level,
though.  Sending a NOTICE to a client when its transaction dooms some other
transaction would add 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: Abhijit Menon-Sen
Date:
Subject: Re: pgaudit - an auditing extension for PostgreSQL
Next
From: Craig Ringer
Date:
Subject: Re: Serialization exception : Who else was involved?