Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XZRVW-0005MD-8v for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Oct 2014 21:32:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XZRVV-0002i6-Ft for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Oct 2014 21:32:21 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XZRVU-0002hz-Fk for pgsql-bugs@postgresql.org; Wed, 01 Oct 2014 21:32:20 +0000 Received: from smtprelay0128.b.hostedemail.com ([64.98.42.128] helo=smtprelay.b.hostedemail.com) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XZRVQ-0002Q8-S9 for pgsql-bugs@postgresql.org; Wed, 01 Oct 2014 21:32:18 +0000 Received: from filter.hostedemail.com (b-bigip1 [10.5.19.254]) by smtprelay04.b.hostedemail.com (Postfix) with ESMTP id F08B17B61A; Wed, 1 Oct 2014 21:32:15 +0000 (UTC) X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Spam-Summary: 50, 0, 0, , d41d8cd98f00b204, alvherre@alvh.no-ip.org, :::, RULES_HIT:41:355:379:599:960:967:973:988:989:1260:1277:1311:1312:1313:1314:1345:1359:1437:1515:1516:1518:1519:1534:1542:1593:1594:1595:1596:1711:1730:1747:1777:1792:2198:2199:2393:2525:2553:2561:2564:2682:2685:2693:2731:2828:2859:2895:2901:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4605:4659:5007:6261:7903:8599:8957:8985:9025:9121:9388:10004:10400:10450:10455:10848:11232:11256:11257:11658:11914:12043:12050:12296:12438:12517:12519:12555:12660:12663:12682:13025:13160:13161:13229:13894:13895:14094:19904:19999:21080, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0 X-HE-Tag: wall10_13a826bb9a745 X-Filterd-Recvd-Size: 3496 Received: from eldon.alvh.no-ip.org (unknown [186.37.58.0]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf02.b.hostedemail.com (Postfix) with ESMTPA; Wed, 1 Oct 2014 21:32:15 +0000 (UTC) Received: by eldon.alvh.no-ip.org (Postfix, from userid 1000) id 824711FCB; Wed, 1 Oct 2014 18:32:12 -0300 (CLST) Date: Wed, 1 Oct 2014 18:32:12 -0300 From: Alvaro Herrera To: David Gould Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #11264: Auto vacuum wraparound job blocking everything Message-ID: <20141001213211.GW5311@eldon.alvh.no-ip.org> References: <20140825225029.2536.5315@wrigleys.postgresql.org> <20140827152636.GC7046@eldon.alvh.no-ip.org> <33085ff949d9484f8d3e6a1b86d15717@CO2PR05MB569.namprd05.prod.outlook.com> <20140827154800.GE7046@eldon.alvh.no-ip.org> <20140827164527.GG7046@eldon.alvh.no-ip.org> <20140827175105.GI7046@eldon.alvh.no-ip.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) 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 David Gould wrote: > We ran into this on two instances last night and I'm starting to worry that > many others may hit it as well. As far as I can tell any postgres instance > that was upgraded to 9.3 by a pre-9.3.5 pg_upgrade is at risk as they all > will have: > > Latest checkpoint's oldestMultiXid: 1 > > The workaround above is good if you still have the old cluster around from > before the upgrade. We did not, that was all cleaned up months ago. Which > raises the question: how do you fix a 9.3 instance that has oldestMultiXid = > 1 without access to the pre-upgrade instance. That is, where do you get the > correct value of oldestMultiXid to set into pg_database.datxminmxid? > > I took a guess that the oldest pg_class.relminmxid for all the tables in all > the databases would be ok and updated pg_database.datminmxid witt that. That > is, in each database I ran: > > select relname, relminmxid, age(relminmxid) > from pg_class > where relkind = 'r' > and age(relminmxid) < 2147483647 > order by 3 desc limit 1 ; Unfortunately, the age() function is only valid for transaction IDs, not multixacts. In certain cases the values returned might be sensible, but they don't have to be, and if the counters are not relatively close to one another, most likely they won't be sensible. A new function was added to 9.4, but that doesn't help those in 9.3. http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=36ad1a87a368d837d5c2260b2fd2ff83e976425a (I guess you could have an extension containing that function.) My bet is that is the reason you had to add the condition that the value is less than 2^31 - 1. Offhand, other than the way to obtain the multixact age, the procedure seems sensible. A better way not involving mxid_age() would be to use pg_controldata to extract the current value of the mxid counter, then subtract the current relminmxid from that value. > 3) Is this likely to affect all 9.3.x<5 upgraded databases? Yes. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs