Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TZjoc-0006mN-Hl for pgsql-hackers@postgresql.org; Sat, 17 Nov 2012 14:56:14 +0000 Received: from mail-vb0-f46.google.com ([209.85.212.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TZjoZ-0007yN-MS for pgsql-hackers@postgresql.org; Sat, 17 Nov 2012 14:56:13 +0000 Received: by mail-vb0-f46.google.com with SMTP id ff1so3812316vbb.19 for ; Sat, 17 Nov 2012 06:56:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=ybub4FxcS04qcbQ0HhRl6lQhAbg9772sCov3vG5C2cw=; b=UniKDjvW9BCwSj64K36eKw7zH9eMBj3xjxeE2K2s8zv/SDV542BpZeRC4BNFCyD5L/ UwxJc/Zn0NNRiktKN3P7zZCsPj3K/3zJBID+g/ppYqG4vTcspyw9nElj/QC7cPgO+oHa +1G6Up0H9l8Dh939iVdf0xMUhKIaoKUafxRw/glFTBdJHmLYVV7qRdi0EI7oFQaZxvfp eZ/PmsqK9zwnb/Lv5/Z98yCImL677vM/EHkgR7NAnpfIEqiukJKybrHAoUQ6qmk4N9wC fcH3Tgw4Xy00lvrg4BTUBjCGkike1lDy8Plk/OLdoMeqnqkPblrbQKQLb8EBlVZ/5bKy w1+w== Received: by 10.52.179.2 with SMTP id dc2mr8119892vdc.50.1353164169899; Sat, 17 Nov 2012 06:56:09 -0800 (PST) Received: from tornado.leadboat.com (ip68-105-236-221.hr.hr.cox.net. [68.105.236.221]) by mx.google.com with ESMTPS id dq8sm2645983vdc.4.2012.11.17.06.56.07 (version=SSLv3 cipher=OTHER); Sat, 17 Nov 2012 06:56:08 -0800 (PST) Date: Sat, 17 Nov 2012 09:56:06 -0500 From: Noah Misch To: Andres Freund Cc: Alvaro Herrera , pgsql-hackers@postgresql.org Subject: Re: foreign key locks Message-ID: <20121117145606.GC24972@tornado.leadboat.com> References: <1346389151-sup-8379@alvh.no-ip.org> <20121018195820.GO3763@alvh.no-ip.org> <201210270006.54728.andres@2ndquadrant.com> <20121114152347.GA5161@alvh.no-ip.org> <20121114162726.GE5161@alvh.no-ip.org> <20121116002459.GB4347@tornado.leadboat.com> <20121116161747.GC4454@alvh.no-ip.org> <20121116163112.GF6505@awork2.anarazel.de> <20121117033151.GB24972@tornado.leadboat.com> <20121117142020.GB4222@awork2.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121117142020.GB4222@awork2.anarazel.de> User-Agent: Mutt/1.5.18 (2008-05-17) X-Gm-Message-State: ALoCoQl4Ga8hL+PHW/RL6qK07JP3mYPwASUMkEMC57Z0Za2mFiDyi9XBMYpj1UU/rhPmnkBSYtgG X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201211/944 X-Sequence-Number: 216796 On Sat, Nov 17, 2012 at 03:20:20PM +0100, Andres Freund wrote: > On 2012-11-16 22:31:51 -0500, Noah Misch wrote: > > On Fri, Nov 16, 2012 at 05:31:12PM +0100, Andres Freund wrote: > > > On 2012-11-16 13:17:47 -0300, Alvaro Herrera wrote: > > > > Andres is on the verge of convincing me that we need to support > > > > singleton FOR SHARE without multixacts due to performance concerns. > > > > > > I don't really see any arguments against doing so. We aren't in a that > > > big shortage of flags and if we need more than available I think we can > > > free some (e.g. XMAX/XMIN_INVALID). > > > > The patch currently leaves two unallocated bits. Reclaiming currently-used > > bits means a binary compatibility break. Until we plan out such a thing, > > reclaimable bits are not as handy as never-allocated bits. I don't think we > > should lightly expend one of the final two. > > Not sure what you mean with a binary compatibility break? > pg_upgrade'ability? Yes. If we decide HEAP_XMIN_INVALID isn't helping, we can stop adding it to tuples anytime. Old tuples may continue to carry the bit, with no particular deadline for their demise. To reuse that bit in the mean time, we'll need to prove that no tuple writable by PostgreSQL 8.3+ will get an unacceptable interpretation under the new meaning of the bit. Alternately, build the mechanism to prove that all such old bits are gone before using the bit in the new way. This keeps HEAP_MOVED_IN and HEAP_MOVED_OFF unavailable today. > What I previously suggested somewhere was: > > #define HEAP_XMAX_SHR_LOCK 0x0010 > #define HEAP_XMAX_EXCL_LOCK 0x0040 > #define HEAP_XMAX_KEYSHR_LOCK (HEAP_XMAX_SHR_LOCK|HEAP_XMAX_EXCL_LOCK) > /* > * Different from _LOCK_BITS because it doesn't include LOCK_ONLY > */ > #define HEAP_LOCK_MASK (HEAP_XMAX_SHR_LOCK|HEAP_XMAX_EXCL_LOCK) > > #define HEAP_XMAX_IS_SHR_LOCKED(tup) \ > (((tup)->t_infomask & HEAP_LOCK_BITS) == HEAP_XMAX_SHR_LOCK) > #define HEAP_XMAX_IS_EXCL_LOCKED(tup) \ > (((tup)->t_infomask & HEAP_LOCK_BITS) == HEAP_XMAX_EXCL_LOCK) > #define HEAP_XMAX_IS_KEYSHR_LOCKED(tup) \ > (((tup)->t_infomask & HEAP_LOCK_BITS) == HEAP_XMAX_KEYSHR_LOCK) > > It makes checking for locks sightly more more complicated, but its not > too bad... Agreed; that seems reasonable.