pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mikheev, Vadim <vmikheev@SECTORBASE.COM>
To: 'Hiroshi Inoue' <Inoue@tpf.co.jp>
To: Philip Warner <pjw@rhyme.com.au>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: RE: [HACKERS] Re: possible row locking bug in 7.0.3 & 7.1
Date: Thu, 29 Mar 2001 21:17:50 -0800
Message-ID: <8F4C99C66D04D4118F580090272A7A234D335E@sectorbase1.sectorbase.com> (raw)

> > >> I assume this is not possible in 7.1?
> > >
> > >Just looked in heapam.c - I can fix it in two hours.
> > >The question is - should we do this now?
> > >Comments?
> > 
> > It's a bug; how confident are you of the fix?

95% -:)

> I doubt if it's a bug of SELECT. Well what
> 'concurrent UPDATE then SELECT FOR UPDATE +
> SELECT' return ?

I'm going to add additional check to heapgettup and
heap_fetch:

HeapTupleSatisfies(T) is TRUE:

IF XactIsoLevel is READ_COMMITTED
and snapshot != SnapshotDirty
and !(T->t_data->t_infomask & HEAP_XMAX_INVALID)
and T->t_data->t_infomask & HEAP_XMAX_COMMITTED
and T->t_self != T->t_data->t_ctid
{
  FOR ( ; ; )
  {
    fetch tuple->t_data->t_ctid tuple
    IF t_infomask & (HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE)
      break; -- and return T
    IF t_infomask & HEAP_XMAX_COMMITTED
    {
      IF t_self != ctid	-- updated
        continue;
      break; -- deleted, return T
    }
    -- uncommitted update/delete
    IF t_xmax != CurrentTransactionID
      break; -- and return T
    -- changed by current TX!
    IF changed *BEFORE* this query began
    {
      -- DELETE + SELECT: nothing to return
      -- UPDATE + SELECT: newer tuple version
      -- will be/was returned by query
      return NULL;
    }
    continue;
  }
}

Vadim



view thread (21+ messages)  latest in thread

Message-ID: <8F4C99C66D04D4118F580090272A7A234D335E@sectorbase1.sectorbase.com>
Permalink:  ../8F4C99C66D04D4118F580090272A7A234D335E@sectorbase1.sectorbase.com/
Also on:    postgresql.org/message-id/8F4C99C66D04D4118F580090272A7A234D335E@sectorbase1.sectorbase.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: vmikheev@SECTORBASE.COM, Inoue@tpf.co.jp, pjw@rhyme.com.au, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] Re: possible row locking bug in 7.0.3 & 7.1
  In-Reply-To: <8F4C99C66D04D4118F580090272A7A234D335E@sectorbase1.sectorbase.com>
  References: <8F4C99C66D04D4118F580090272A7A234D335E@sectorbase1.sectorbase.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox