Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TPEgh-0000H9-3b for pgsql-hackers@postgresql.org; Fri, 19 Oct 2012 15:40:39 +0000 Received: from mail-vb0-f46.google.com ([209.85.212.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TPEge-0007ts-5D for pgsql-hackers@postgresql.org; Fri, 19 Oct 2012 15:40:38 +0000 Received: by mail-vb0-f46.google.com with SMTP id ff1so609689vbb.19 for ; Fri, 19 Oct 2012 08:40:34 -0700 (PDT) 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=KgirbZKEGEtBx6Ddyd1tmnOZQAp3w0t5dkSHm+MhsIA=; b=fR+/WCGyyB+FoYKh9Hue1SEjRGn7sFZ0T3BFMjJinCeNC//TRk+IDvOoAsVWLat7Ea YcduoZfJjQGe2T46/jZ9svj2+uOwHh+k+K5LUO7WYqlfMoGgMkKJAXY1fVk1EBLPfDLy In+yZPN2q9VzA/K8V3hdLSJz66Fbv0GU9wFKjF0NU0/XpkXCq467aUKg4VNT6W0iugih YlZ02UYmsCuLYAv9DBVWeWo+fiei2GgIJWJKMj4FEHaMRPa6f5bmDeIiYPXI6/jivNYc z878fxB3Ce4dBLT1s8IJcl39pFxIB/hL9Drek65dVOb6fnoBtk8N+awo988zx0EtaVXJ f7sw== Received: by 10.58.162.130 with SMTP id ya2mr2286710veb.2.1350661234391; Fri, 19 Oct 2012 08:40:34 -0700 (PDT) Received: from tornado.leadboat.com (ip68-105-236-221.hr.hr.cox.net. [68.105.236.221]) by mx.google.com with ESMTPS id k4sm1825637vdg.2.2012.10.19.08.40.31 (version=SSLv3 cipher=OTHER); Fri, 19 Oct 2012 08:40:31 -0700 (PDT) Date: Fri, 19 Oct 2012 11:40:29 -0400 From: Noah Misch To: Alvaro Herrera Cc: Pg Hackers Subject: Re: foreign key locks Message-ID: <20121019154029.GA27306@tornado.leadboat.com> References: <4FEAB90A0200002500048B7D@gw.wicourts.gov> <1341011531-sup-1642@alvh.no-ip.org> <1341528201-sup-720@alvh.no-ip.org> <1345234806-sup-3685@alvh.no-ip.org> <1345670473-sup-4222@alvh.no-ip.org> <1346095617-sup-567@alvh.no-ip.org> <1346389151-sup-8379@alvh.no-ip.org> <20121018195820.GO3763@alvh.no-ip.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121018195820.GO3763@alvh.no-ip.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-Gm-Message-State: ALoCoQnb7O3x7vJQk8fYpttSsKayyfiX3N0Rp8MlpafEeN1CZrN+Vr2ORYke/UtDGYelmJLLrR4x X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201210/1177 X-Sequence-Number: 215413 On Thu, Oct 18, 2012 at 04:58:20PM -0300, Alvaro Herrera wrote: > Here is version 22 of this patch. This version contains fixes to issues > reported by Andres, as well as a rebase to latest master. I scanned this for obvious signs of work left to do. It contains numerous XXX and FIXME comments. Many highlight micro-optimization opportunities and the like; those can stay. Others preclude commit, either highlighting an unsolved problem or wrongly highlighting a non-problem: > + /* > + * XXX we do not lock this tuple here; the theory is that it's sufficient > + * with the buffer lock we're about to grab. Any other code must be able > + * to cope with tuple lock specifics changing while they don't hold buffer > + * lock anyway. > + */ > * so they will be uninteresting by the time our next transaction starts. > * (XXX not clear that this is correct --- other members of the MultiXact > * could hang around longer than we did. However, it's not clear what a > ! * better policy for flushing old cache entries would be.) FIXME actually > ! * this is plain wrong now that multixact's may contain update Xids. > ! nmembers = GetMultiXactIdMembers(multi, &members, true); > ! /* > ! * XXX we don't have the infomask to run the required consistency check > ! * here; the required notational overhead seems excessive. > ! */ > /* We assume the cache entries are sorted */ > ! /* XXX we assume the unused bits in "status" are zeroed */ > ! if (memcmp(members, entry->members, nmembers * sizeof(MultiXactMember)) == 0) > ! * XXX do we have any issues with needing to checkpoint here? > */ > ! static void > ! TruncateMultiXact(void) > { > + /* FIXME what should we initialize this to? */ > + newFrozenMulti = ReadNextMultiXactId(); > + * FIXME -- the XMAX_IS_MULTI test is a bit wrong .. it's possible to > + * have tuples with that bit set that are dead. However, if that's > + * changed, the RawXmax() call below should probably be researched as well. > */ > if (tuple->t_infomask & > ! (HEAP_XMAX_INVALID | HEAP_XMAX_LOCK_ONLY | HEAP_XMAX_IS_MULTI)) > return false;