Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f2UEHeK49266 for ; Fri, 30 Mar 2001 09:17:41 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from mailer.sectorbase.com (gate1.sectorbase.com [63.88.121.2]) by postgresql.org (8.11.3/8.11.1) with SMTP id f2U5HqK61229 for ; Fri, 30 Mar 2001 00:17:52 -0500 (EST) (envelope-from vmikheev@SECTORBASE.COM) Received: (qmail 46085 invoked by uid 503); 30 Mar 2001 05:17:52 -0000 Received: from sectorbase1.sectorbase.com (192.168.254.1) by gate1.sectorbase.com with SMTP; 30 Mar 2001 05:17:52 -0000 Received: by sectorbase1.sectorbase.com with Internet Mail Service (5.5.2653.19) id ; Thu, 29 Mar 2001 21:17:51 -0800 Message-ID: <8F4C99C66D04D4118F580090272A7A234D335E@sectorbase1.sectorbase.com> From: "Mikheev, Vadim" To: "'Hiroshi Inoue'" , Philip Warner Cc: Tom Lane , pgsql-sql@postgresql.org, 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 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-2022-jp" X-Archive-Number: 200103/640 X-Sequence-Number: 2312 > > >> 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