Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hZLBq-0004D1-C5 for pgsql-bugs@arkaria.postgresql.org; Fri, 07 Jun 2019 20:10:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hZLBn-0006y6-SU for pgsql-bugs@arkaria.postgresql.org; Fri, 07 Jun 2019 20:10:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hZLBl-0006u4-U0 for pgsql-bugs@lists.postgresql.org; Fri, 07 Jun 2019 20:10:15 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hZLBe-0000Ul-NN for pgsql-bugs@lists.postgresql.org; Fri, 07 Jun 2019 20:10:12 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 8E7BF21B7C; Fri, 7 Jun 2019 16:10:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 07 Jun 2019 16:10:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=fm1; bh=M dg2EURFnMh61UlsVDYtFZQwQcORHwuhaQnRFDsUs6s=; b=oFMUhT0sazTENvEJ8 5KQhx3GjFgFO3xKLs9YoE+1DTHJasUXdsRRhaMLUj4DCIVlIpB8X8+yLKh8U6Uyp if23esc9oE6hW6kg8w7LK2rcB1NlP9WGlLyJ1CvQdtFgBKHxPKGedUGCXWgTTLMm CQjs0pWFBsYG0oLFZT8IKNHjqpWERgligriiGKPkwPPh/6tcjSuvb8BT6+X3MKuV 9zGK32znXV7bi5vZdbRI/OQM2yylXa2EH8JTPm0AW3RgMvkzrlLvuYd35D4bhAXr IGgYcSuqWSdnUuVSodRDiprh5YEIKSJkEFuV2LRwIGwNIaMADlLTm+cPUqhKx31O sEY1A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=Mdg2EURFnMh61UlsVDYtFZQwQcORHwuhaQnRFDsUs 6s=; b=J52VUAr1POOFUBeT23o20rgVr8vQ/FbdESfU1NjAHbsJd0GvZs8x0TyOn 6WZDVbKUCVMnFLAMdD06diutqrFNQRbGQsmERsbSly33hjSfW27djc2Pg5Fyizxl w7Dx5gGAy27Kl/hUozufoARUn2gCLh0KMeUkLarCxJVySKjaLr/S+FABHoxLamwk xQ7tdexck33G6AStqm9JY0ZIDjJ3RKr6K6skHPeIY6ZFJGYPYW2nM6mU1RNx6d+Y LMIAAbxUQSpsZ/PIEcxDr9VbVnOn8wKVrB5012PQbKVai0GieXwJLtOhz135FDQd 5fLn/OKj8SNqsxmUf4QlFUPqbHasw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrudegiedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggugfgjsehtkeertddttddunecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucfkph epieejrdduiedtrddvudekrddvfeejnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgu rhgvshesrghnrghrrgiivghlrdguvgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-218-237.hsd1.ca.comcast.net [67.160.218.237]) by mail.messagingengine.com (Postfix) with ESMTPA id 6CB27380087; Fri, 7 Jun 2019 16:10:04 -0400 (EDT) Date: Fri, 7 Jun 2019 13:10:02 -0700 From: Andres Freund To: Thierry Husson Cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15840: Vacuum does not work after database stopped for wraparound protection. Database seems unrepearable. Message-ID: <20190607201002.cado5goe3rcup43n@alap3.anarazel.de> References: <15840-06c9565bfd8099f6@postgresql.org> <20190607190231.6psb6w3bvlod7lvk@alap3.anarazel.de> <20190607145911.Horde.MKizKAnShw4nKEYGDUC2M-T@webmail.iciel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190607145911.Horde.MKizKAnShw4nKEYGDUC2M-T@webmail.iciel.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2019-06-07 14:59:11 -0500, Thierry Husson wrote: > Thank you for your anwser. Precisions bellow: > Andres Freund a écrit : > > On 2019-06-07 18:22:20 +0000, PG Bug reporting form wrote: > > > I was doing tables COPY between my old server with PG10.8 and the new one > > > with 12Beta1. After each table is done, I make a vacuum of it. > > > However PG12 has stopped working for wraparound protection. I was doing it > > > on around 10 cpu, 1 table by cpu. > > > > That was a new postgres 12 cluster, not a pg_upgraded one? And you just > > did a bunch of COPYs? How many? > > > > I'm not clear as to how the cluster got to wraparound if that's the > > scenario. We use one xid per transaction, and copy doesn't use multiple > > transactions internally. Any chance you have triggers on these tables > > that use savepoints internally? > > Yes it was a new cluster. Around 30 copy were done. > Yes there is a trigger to manage partitions. Around 1200 tables were > created. 10 billions records transfered, I need to tranfert 180BR over 1700 > tables. > I just realize I made vacuum on partitions for the first 8BR rows and forgot > for the last 2BR That would explain the wraparound protection. Do those triggers use savepoints / EXCEPTION handling? Might be worthwhile to check - independent of this issue - if you still need the partition handling via trigger, now that pg's builtin partitioning can handle COPY (and likely *much* faster). > > Could you also show > > > > SELECT oid, datname, datfrozenxid, age(datfrozenxid), datminmxid, > > mxid_age(datminmxid) FROM pg_database ORDER BY age(datfrozenxid) DESC; > oid | datname | datfrozenxid | age | datminmxid | mxid_age > -------+-----------+--------------+------------+------------+---------- > 16394 | emet_zhen | 36464 | 2146483652 | 1 | 0 Ok, so it's xids, and clearly not multixids. Could you connect to emet_zhen and show the output of: SELECT oid, oid::regclass, relkind, relfrozenxid, age(relfrozenxid) FROM pg_class WHERE relfrozenxid <> 0 AND age(relfrozenxid) > 1800000000 ORDER BY age(relfrozenxid) DESC; that will tell us which relations need to be vacuumed, and then we can see why that doesn't work. > Could it be that PG12 considers "vacuum" as a transaction and trigger > wraparound protection against it? I'm still somewhat confused - the output you showed didn't include vacuum failing, as far as I can tell? - Andres