Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRMqI-0003KW-Nq for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Dec 2017 18:42:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRMqI-0008RH-AW for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Dec 2017 18:42:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eRMqI-0008R2-4W; Tue, 19 Dec 2017 18:42:18 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eRMqF-0003Z0-Nf; Tue, 19 Dec 2017 18:42:17 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id C234D20CEA; Tue, 19 Dec 2017 13:42:12 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Tue, 19 Dec 2017 13:42:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=7hVZNdxa65OT2ENY6kIq6LM+mo2zY RKA8UD4YUwAj7Y=; b=KXMWuFVpa6ryi2JT0HYiVFxegtlMDEdTfFfAxC0ZhLqo3 v/ppKnpESPbOz7AvT7EjyDHWU3EsuxD3LLNffOiqcxPzPrVUcthjEfRhu7t8/Qa4 MmA0u03L237m8133u4hXQQXjkroPM9IFZ5G+dn6+N18Op66TGFjE2McxeENyB5Fi hE+va6zyyj+2zRpsBxTH9SdkK172yY7lHfKhEfYfdVIqQIQwu+wIziUy8k9TBAq0 2JPDDQsnwpmA5S4O7NfvojrbbgSuuFAwQZ/kw/Yg62kRJS6bYOMemcG+tAQszY/c XGSlTAnA2cdLZ6vx3frjNHyVgvEy8u0QJHbgKCvTg== X-ME-Sender: Received: from intern.anarazel.de (unknown [136.24.76.189]) by mail.messagingengine.com (Postfix) with ESMTPA id 5FA75246F4; Tue, 19 Dec 2017 13:42:12 -0500 (EST) Date: Tue, 19 Dec 2017 10:42:11 -0800 From: Andres Freund To: Alvaro Herrera Cc: PostgreSQL Bugs , pgsql-hackers@postgresql.org, Robert Haas Subject: Re: vacuum vs heap_update_tuple() and multixactids Message-ID: <20171219184211.bsgfkk7vbgiqoste@alap3.anarazel.de> References: <20171219183114.q3utztzbqih34ltl@alap3.anarazel.de> <20171219183512.5clw3fxztholw4vq@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171219183512.5clw3fxztholw4vq@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2017-12-19 15:35:12 -0300, Alvaro Herrera wrote: > Andres Freund wrote: > > > I think the bugfix is going to have to essentially be something similar > > to FreezeMultiXactId(). I.e. when reusing an old tuple's xmax for a new > > tuple version, we need to prune dead multixact members. I think we can > > do so unconditionally and rely on multixact id caching layer to avoid > > unnecesarily creating multis when all members are the same. > > Actually, isn't the cache subject to the very same problem? If you use > a value from the cache, it could very well be below whatever the cutoff > multi was chosen in the other process ... That's an potential issue somewhat indepent of this bug though (IIRC I also mentioned it in the other thread). I hit that problem a bunch in manual testing, but I didn't manage to create an actual testcase for it, without pre-existing corruption. I don't think this specific instance would be more-vulnerable than FreezeMultiXactId() itself - we'd just use alive multis and pass them to MultiXactIdCreateFromMembers(), which is exactly what FreezeMultiXactId() does. I think the cache issue ends up not quite being a live bug, because every transaction that's a member of a multixact also has done MultiXactIdSetOldestMember(). Which in turn probably, but I'm not sure, prevents the existance of multis with just alive members in the cache, that are below the multi horizon. That relies on the fact that we only create multis with alive members though, which seems fragile. It'd be good if we added some assurances to MultiXactIdCreateFromMembers() that it actually can't happen. Hope I didn't miss a live version of the above problem? Greetings, Andres Freund