Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a2rwB-0005TN-PN for pgsql-admin@arkaria.postgresql.org; Sun, 29 Nov 2015 02:42:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a2rwB-0006Cs-8P for pgsql-admin@arkaria.postgresql.org; Sun, 29 Nov 2015 02:42:03 +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) (envelope-from ) id 1a2rwA-0006CL-E5 for pgsql-admin@postgresql.org; Sun, 29 Nov 2015 02:42:02 +0000 Received: from out.smtp-auth.no-ip.com ([8.23.224.60]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1a2rw7-0001c4-7X for pgsql-admin@postgresql.org; Sun, 29 Nov 2015 02:42:01 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [201.220.242.125]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 6C44A4008E9; Sat, 28 Nov 2015 18:41:52 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id C382E6501; Sat, 28 Nov 2015 12:20:44 -0300 (CLT) Date: Sat, 28 Nov 2015 12:20:44 -0300 From: Alvaro Herrera To: Kouber Saparev Cc: pgsql-admin@postgresql.org Subject: Re: VACUUM unable to accomplish because of a non-existent MultiXactId Message-ID: <20151128152044.GI4320@alvherre.pgsql> References: <62FE8F79-7278-4AE0-9FDE-0C0277A7B609@gmail.com> <20151127184936.GD4320@alvherre.pgsql> <99572764-62FE-4C23-8667-53B648C8DFD4@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <99572764-62FE-4C23-8667-53B648C8DFD4@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Kouber Saparev wrote: > > > The state of your data is probably caused by some weird corner case of > > the upgrade. Can you see in the log files that the toast table has been > > failing vacuum since the upgrade, or is it more recent than that? (In > > other words, is there any working vacuum after the upgrade?) > > We upgraded to 9.4.5 on 19 October, and there was a successful automatic vacuum over pg_toast_376621 just 3 days later - on 22 October: > > Oct 22 08:16:49 db-master postgres[10589]: [3-1] []: LOG: automatic vacuum of table “db.pg_toast.pg_toast_376621": index scans: 1 > Oct 22 08:16:49 db-master postgres[10589]: [3-2] pages: 0 removed, 784361 remain > Oct 22 08:16:49 db-master postgres[10589]: [3-3] tuples: 110 removed, 3768496 remain, 0 are dead but not yet removable > Oct 22 08:16:49 db-master postgres[10589]: [3-4] buffer usage: 37193 hits, 44891 misses, 32311 dirtied > Oct 22 08:16:49 db-master postgres[10589]: [3-5] avg read rate: 0.954 MB/s, avg write rate: 0.686 MB/s > Oct 22 08:16:49 db-master postgres[10589]: [3-6] system usage: CPU 1.10s/1.67u sec elapsed 367.73 sec > > The next automatic vacuum came 8 days later - on 30 October and failed and it is failing ever since: > > Oct 30 14:22:01 db-master postgres[16160]: [3-1] []: ERROR: MultiXactId 2915905228 does no longer exist -- apparent wraparound > Oct 30 14:22:01 db-master postgres[16160]: [3-2] []: CONTEXT: automatic vacuum of table “db.pg_toast.pg_toast_376621” > > So I guess something happened between 22 and 30 October and there is no relation to the pg_upgrade we did on 19 October. OK, so it wasn't pg_upgrade. Good to know. > > It would be useful to debug this that you attached gdb to a backend, set > > breakpoint on errfinish, then run vacuum on that table. Then you can > > extract the page number from the backtrace. With the page number we can > > try pageinspect and heap_page_items until we find the culprit and > > perhaps identify how it got in that state. > > I will try to obtain the page number, and will then send you the results, thank you. > > Can we somehow do it on one of our replicas (after detaching it), i.e. > is the corrupted record propagated through the replication channel, > and in the meantime fix the table on the master? I suppose the corrupted data should be in any replicas as well, but I have no way to be sure. Also, I don't know how to get the data to a valid state, other than dropping the table and reloading it. I suppose you can take a complete pg_dump of the data in that table? If you want to reset it to a known-good state, you could just save the pg_toast file aside (and its corresponding main table file, just in case). Doing forensics in a copy is better practice anyway, you know. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin