Re: Deadlock possibility in _bt_check_unique?

From: Gokulakannan Somasundaram <gokul007(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Deadlock possibility in _bt_check_unique?
Date: 2010-03-23 18:56:06
Message-ID: 9362e74e1003231156g2a0b8414gf57b26e209b869a0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > T2 : session 1 releases the lock on p1 (its waiting to acquire a ex lock
> on
> > p2)
>
> That's not what we do. See _bt_findinsertloc.
>
> regards, tom lane
>

I am really confused. Please keep the cool and explain me, if i am
wrong. I could see this code in _bt_findinsertloc. There is a
_bt_relandgetbuf, which releases lock on p1 and tries to acquire a lock on
p2. I wrote ex lock in the place of BT_WRITE.
*
*

*00589 for (;;)
00590 {
00591 BlockNumber
<http://doxygen.postgresql.org/block_8h.html#0be1c1ab88d7f8120e2cd2e8ac2697a1>
rblkno = lpageop->btpo_next
<http://doxygen.postgresql.org/structBTPageOpaqueData.html#0e96302f6e2aa4203cef0e243362b692>;
00592
00593 rbuf = _bt_relandgetbuf
<http://doxygen.postgresql.org/nbtpage_8c.html#023261cd645fc5e8b4e8517fe9027bd6>(rel,
rbuf, rblkno, BT_WRITE
<http://doxygen.postgresql.org/nbtree_8h.html#e494b1ec6ecbe7251dfc412a1ec53c1b>);
00594 page = BufferGetPage
<http://doxygen.postgresql.org/bufmgr_8h.html#fb570c83a17839dabeb75dba7ea8e1a5>(rbuf);
00595 lpageop = (BTPageOpaque
<http://doxygen.postgresql.org/structBTPageOpaqueData.html>)
PageGetSpecialPointer
<http://doxygen.postgresql.org/bufpage_8h.html#3be45495654ca1ff61f6ae45805e25f6>(page);
00596 if (!P_IGNORE
<http://doxygen.postgresql.org/nbtree_8h.html#a8df35238449d00d7e14c3f1ccd3121c>(lpageop))
00597 break;
00598 if (P_RIGHTMOST
<http://doxygen.postgresql.org/nbtree_8h.html#8b5e4857926b514c0f97592bf3344293>(lpageop))
00599 elog
<http://doxygen.postgresql.org/elog_8h.html#850290250a1449fc513da20ae2ce5ec5>(ERROR
<http://doxygen.postgresql.org/elog_8h.html#8fe83ac76edc595f6b98cd4a4127aed5>,
"fell off the end of index \"%s\"",
00600 RelationGetRelationName
<http://doxygen.postgresql.org/rel_8h.html#5e9d450c92f70171110e22ffc678ed04>(rel));
00601 }*

What is that, i am missing here?

Gokul.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-03-23 18:58:49 Re: Proposal: access control jails (and introduction as aspiring GSoC student)
Previous Message Robert Haas 2010-03-23 18:55:42 Re: Repeating Append operation