Hackers,

I've been briefly looking at the deadlock detection code to see what's
needed to support nested transactions.

It seems the only way to run the deadlock detection
(storage/lmgr/deadlock.c:DeadLockCheck()) is through
storage/lmgr/proc.c:CheckDeadLock(), and it's only called with MyProc as
argument.  AFAIU this means that the only transaction that can be
aborted is the transaction that's trying to acquire the lock.

If this is so, then it's obvious that there can't be subtransactions in
progress of the transaction that's going to be aborted.  This means that
there's no need for a mechanism to abort a transaction and all its
subtransactions, because they are all finished if there are any at all.

Am I right on this?

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El dia que dejes de cambiar dejaras de vivir"

Sun, 18 May 2003 21:02:52 -0400
Alvaro Herrera <alvherre@dcc.uchile.cl>
Deadlock detection
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> AFAIU this means that the only transaction that can be
> aborted is the transaction that's trying to acquire the lock.

Correct.  There's no need to treat this error as any different from any
other error.

			regards, tom lane

Mon, 19 May 2003 20:11:51 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Deadlock detection 