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 1hZK8Z-0000V5-Lj for pgsql-bugs@arkaria.postgresql.org; Fri, 07 Jun 2019 19:02:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hZK8X-0008Md-B4 for pgsql-bugs@arkaria.postgresql.org; Fri, 07 Jun 2019 19:02:49 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hZK8V-0008D0-OK for pgsql-bugs@lists.postgresql.org; Fri, 07 Jun 2019 19:02:49 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hZK8M-0008VP-GH for pgsql-bugs@lists.postgresql.org; Fri, 07 Jun 2019 19:02:47 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 4AABF2223C; Fri, 7 Jun 2019 15:02:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 07 Jun 2019 15:02:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=Bdt/hwP3Klkxd/Giho9B9EAf18D Vc8wfScnQY+VvIFA=; b=51XfUZxSbjycUT1234xCPWawwihUPAxVpE5cLsn6BJL Qiv6RFx3VhdkGu/J4MC8KZkIm5HSPkVv8Ll7aVrXUiKvuMwkJoNGz2II/NUm2ot9 lE/aUkD3kmBAFoJCd/zVMw5T4Xh1i1gywD4SidBdAKZ0Kbs89zM5zHGEYT4pUbaW RdqVheYXe0GC68ibRLbojJN9ORT2zKzTTVOJ6XbkdQd70W1Tc8Kl3sBwopzmTb6x mz7ntKn9NiaRDJm5Qayu+WShdAitZ7myxN9IhZJ0lvMexq6Li88Vs2GJL60P1qgI xlOpf7/J5aYXmB5PTMfdIyzKZpc1nAwJVChzGVSfcXw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=Bdt/hw P3Klkxd/Giho9B9EAf18DVc8wfScnQY+VvIFA=; b=CbDPN52qQwqYS77J8+P7UV RNgD9wRudCCaCwm4ZAe+kcw+dc+PmsFvVWTvhQef2msGSUCMPE0sCCSRicC/sr7h 8i8bOu/nxtA4KsVaNBITpRX9pmS8qWrjDZX/vuFRAU+y0XkUYHzUhPI0rez4fJAI 4Raqz/rf3zXlwerRhDlg8YrU3C/Be/ts2G8b6aVvW5+jgGUA1uTMjbmZ6UrmwoVV 7erB33dPuvUBLR/vypjklpRaB9g/7uoNSzhG4XQmAu/FcDwOrjK5OqM9mMM2mlol zAf7aX1pfi3F5PY807Ph9zU263BNKbG+1X4gRD7WlPBNVG9vf+LWuLFWjOap/2yA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrudegiedgudefvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjsehttd ertddttddvnecuhfhrohhmpeetnhgurhgvshcuhfhrvghunhguuceorghnughrvghssegr nhgrrhgriigvlhdruggvqeenucfkphepieejrdduiedtrddvudekrddvfeejnecurfgrrh grmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghlrdguvgenucevlhhu shhtvghrufhiiigvpedt 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 7B59D380073; Fri, 7 Jun 2019 15:02:33 -0400 (EDT) Date: Fri, 7 Jun 2019 12:02:31 -0700 From: Andres Freund To: thusson@informiciel.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15840: Vacuum does not work after database stopped for wraparound protection. Database seems unrepearable. Message-ID: <20190607190231.6psb6w3bvlod7lvk@alap3.anarazel.de> References: <15840-06c9565bfd8099f6@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15840-06c9565bfd8099f6@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, 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? > postgres --single emet_zhen > VACUUM FREEZE VERBOSE; Don't FREEZE in wraparound cases, that just makes it take longer. > It worked a few hours and when I was thinking it was done as nothing was > loggin anymore, I made a ctrl-\ and restarted the DB. > I was still getting wraparound protection messages so I shutdown the DB > again & redo the vacuum command but it didn't work anymore: > zhen:semt700 $ postgres --single emet_zhen > 2019-06-07 17:23:36 UTC 7251 WARNING: database with OID 16394 must be > vacuumed within 999995 transactions > 2019-06-07 17:23:36 UTC 7251 HINT: To avoid a database shutdown, execute a > database-wide VACUUM in that database. > You might also need to commit or roll back old prepared > transactions, or drop stale replication slots. > PostgreSQL stand-alone backend 12beta1 > backend> VACUUM VERBOSE; > 2019-06-07 17:23:59 UTC 7251 WARNING: database "emet_zhen" must be > vacuumed within 999995 transactions > 2019-06-07 17:23:59 UTC 7251 HINT: To avoid a database shutdown, execute a > database-wide VACUUM in that database. > You might also need to commit or roll back old prepared > transactions, or drop stale replication slots. > 2019-06-07 17:23:59 UTC 7251 LOG: duration: 2417.639 ms statement: VACUUM > VERBOSE; What do you mean by "didn't work anymore"? As far as I can tell the VACUUM here succeeded? > HINT: To avoid a database shutdown, execute a database-wide VACUUM in that > database. > You might also need to commit or roll back old prepared transactions, or > drop stale replication slots. Did you check whether any of these are the case? SELECT * FROM pg_replication_slots; SELECT * FROM pg_prepared_xacts; Could you also show SELECT oid, datname, datfrozenxid, age(datfrozenxid), datminmxid, mxid_age(datminmxid) FROM pg_database ORDER BY age(datfrozenxid) DESC; SELECT * FROM pg_control_checkpoint(); Greetings, Andres Freund