Skip site navigation (1) Skip section navigation (2)

RE: [HACKERS] Re: possible row locking bug in 7.0.3 & 7.1

From: "Mikheev, Vadim" <vmikheev(at)SECTORBASE(dot)COM>
To: "'Hiroshi Inoue'" <Inoue(at)tpf(dot)co(dot)jp>, Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-sql(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: RE: [HACKERS] Re: possible row locking bug in 7.0.3 & 7.1
Date: 2001-03-30 05:17:50
Message-ID: 8F4C99C66D04D4118F580090272A7A234D335E@sectorbase1.sectorbase.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-sql
> > >> 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

Responses

pgsql-hackers by date

Next:From: Adriaan JoubertDate: 2001-03-30 05:36:42
Subject: Re: Unsigned int functions
Previous:From: Tom LaneDate: 2001-03-30 04:58:25
Subject: Re: Re: Call for platforms

pgsql-sql by date

Next:From: Ian HardingDate: 2001-03-30 05:47:41
Subject: Re: Untitled
Previous:From: Hiroshi InoueDate: 2001-03-30 04:16:16
Subject: Re: [HACKERS] Re: possible row locking bug in 7.0.3 & 7.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group