pgsql: Insert CHECK_FOR_INTERRUPTS() calls into btree and hash index

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Insert CHECK_FOR_INTERRUPTS() calls into btree and hash index
Date: 2009-05-05 19:36:32
Message-ID: 20090505193632.E4F8175407B@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Insert CHECK_FOR_INTERRUPTS() calls into btree and hash index scans at the
points where we step right or left to the next page. This should ensure
reasonable response time to a query cancel request during an unsuccessful
index scan, as seen in recent gripe from Marc Cousin. It's a bit trickier
than it might seem at first glance, because CHECK_FOR_INTERRUPTS() is a no-op
if executed while holding a buffer lock. So we have to do it just at the
point where we've dropped one page lock and not yet acquired the next.

Remove CHECK_FOR_INTERRUPTS calls at the top level of btgetbitmap and
hashgetbitmap, since they're pointless given the added checks.

I think that GIST is okay already --- at least, there's a CHECK_FOR_INTERRUPTS
at a plausible-looking place in gistnext(). I don't claim to know GIN well
enough to try to poke it for this, if indeed it has a problem at all.

This is a pre-existing issue, but in view of the lack of prior complaints
I'm not going to risk back-patching.

Modified Files:
--------------
pgsql/src/backend/access/hash:
hash.c (r1.109 -> r1.110)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/hash/hash.c?r1=1.109&r2=1.110)
hashsearch.c (r1.55 -> r1.56)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/hash/hashsearch.c?r1=1.55&r2=1.56)
pgsql/src/backend/access/nbtree:
nbtree.c (r1.168 -> r1.169)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtree.c?r1=1.168&r2=1.169)
nbtsearch.c (r1.119 -> r1.120)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtsearch.c?r1=1.119&r2=1.120)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2009-05-05 19:59:00 pgsql: Install a "dead man switch" to allow the postmaster to detect
Previous Message User Bmomjian 2009-05-05 19:02:33 pg-migrator - pg_migrator: Change cp to use -R, not -r.