Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDK4F-0000Uz-Hd for pgsql-bugs@arkaria.postgresql.org; Wed, 15 Jun 2016 23:17:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bDK4F-0001ht-3g for pgsql-bugs@arkaria.postgresql.org; Wed, 15 Jun 2016 23:17:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bDK3a-0000FI-ST for pgsql-bugs@postgresql.org; Wed, 15 Jun 2016 23:17:11 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bDK3X-0000bK-O0 for pgsql-bugs@postgresql.org; Wed, 15 Jun 2016 23:17:09 +0000 Received: from localhost ([127.0.0.1]:19170 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtp (Exim 4.84 (FreeBSD)) (envelope-from ) id 1bDK3U-0004RX-Nu; Wed, 15 Jun 2016 23:17:04 +0000 From: Andrew Gierth To: sean.hope@eroad.com, pgsql-bugs@postgresql.org Subject: Re: BUG #14195: "MultiXactId XXXXXX has not been created yet -- apparent wraparound" after upgrade from 9.2 In-Reply-To: <20160615203829.5798.4594@wrigleys.postgresql.org> (sean hope's message of "Wed, 15 Jun 2016 20:38:29 +0000") Message-ID: <87inxarrd6.fsf@news-spur.riddles.org.uk> References: <20160615203829.5798.4594@wrigleys.postgresql.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) Date: Thu, 16 Jun 2016 00:17:04 +0100 MIME-Version: 1.0 Content-Type: text/plain X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org >>>>> "sean" == sean hope writes: sean> The following bug has been logged on the website: sean> Bug reference: 14195 sean> Logged by: Sean Hope sean> Email address: sean.hope@eroad.com sean> PostgreSQL version: 9.4.7 sean> Operating system: Ubuntu 12.04 LTS sean> Description: sean> Hi, sean> We're having issues with 'MultiXactId xxxxxxxxx has not been sean> created yet -- apparent wraparound' log messages upon table sean> vacuums. The vacuums are cancelled by the system after this sean> message is issued. sean> These messages have only been seen since upgrading from 9.2.x to sean> 9.4.7 via pg_upgrade about a month ago. This is a large / high sean> transaction rate (1120 tps) database. We are unable to vacuum the sean> affected tables (5 of them) currently due to this issue. This one came up on the IRC channel and I did some analysis there. What it seems to boil down to is that, faced with a tuple with a pre-upgrade mxid, we get this call path: vacuum calls heap_prepare_freeze_tuple heap_prepare_freeze_tuple calls FreezeMultiXactId (because HEAP_XMAX_IS_MULTI) FreezeMultiXactId checks if the mxid is older than the cutoff, but because this is a pre-upgrade mxid it can be literally anything, and in this case it's in the future not the past, so that check is skipped FreezeMultiXactId calls GetMultiXactIdMembers with allow_old=true GetMultiXactIdMembers checks for wraparound, but while it downgrades the error to DEBUG1 if allow_old is true and the mxid is in the past, it unconditionally errors if the mxid is in the future.