Re: Logging conflicted queries on deadlocks

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Logging conflicted queries on deadlocks
Date: 2008-03-23 02:42:08
Message-ID: 26736.1206240128@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> I think we should report to the client where it is not a security
> breach, and to the server log otherwise.

Well, the point of my original comment is that it's not always so
obvious what might be a security breach or not.

> I'm not sure about warts. A separate server-only context field perhaps?
> Or a separate flag in ErrorData elements saying whether each particular
> one should go to server only.

Yeah, one or the other. I was actually thinking about a server-only
addition to the detail field, because using CONTEXT for this doesn't
really seem like quite the right thing --- if the deadlock occurs inside
a function or some other place where lines will get appended to CONTEXT,
it could be confusing. If we're going to add features to elog.c to
support this specific case, what I'd rather have is

DETAIL: Process A waits for ...
Process B waits for ...
Process A: <query text>
Process B: <query text>

where the second group of lines only appears in the server log.

> If we add that, perhaps we could clean up the stuff in
> checkSharedDependency with it, too.

Hmm, hadn't realized there were other use-cases already. That makes me
a little more willing to spend effort here. Not sure that the above
design quite works for pg_shdepend though. Do we need two independent
strings for client and log details?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Guillaume Smet 2008-03-23 07:56:10 Re: Logging conflicted queries on deadlocks
Previous Message Alvaro Herrera 2008-03-23 02:29:44 Re: Logging conflicted queries on deadlocks

Browse pgsql-patches by date

  From Date Subject
Next Message Guillaume Smet 2008-03-23 07:56:10 Re: Logging conflicted queries on deadlocks
Previous Message Alvaro Herrera 2008-03-23 02:29:44 Re: Logging conflicted queries on deadlocks