Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9bw7-0000fP-DL for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Oct 2017 19:10:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e9bw6-0005rl-NC for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Oct 2017 19:10:54 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e9buZ-0002zK-7X for pgsql-hackers@postgresql.org; Tue, 31 Oct 2017 19:09:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e9buW-0004gV-AJ for pgsql-hackers@postgresql.org; Tue, 31 Oct 2017 19:09:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v9VJ9BjV011500; Tue, 31 Oct 2017 15:09:11 -0400 From: Tom Lane To: Alvaro Herrera cc: Michael Paquier , Tomas Vondra , PostgreSQL mailing lists Subject: Re: Re: PANIC: invalid index offnum: 186 when processing BRIN indexes in VACUUM In-reply-to: <20171031181053.xh7hzminpv6rvwr2@alvherre.pgsql> References: <20171031181053.xh7hzminpv6rvwr2@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 31 Oct 2017 19:10:53 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11498.1509476951.1@sss.pgh.pa.us> Date: Tue, 31 Oct 2017 15:09:11 -0400 Message-ID: <11499.1509476951@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Alvaro Herrera writes: > Tom Lane wrote: >> I really don't understand how any of this "let's release the buffer >> lock and then take it back later" logic is supposed to work reliably. > So summarize_range first inserts the placeholder tuple, which is there > purposefully for other processes to update concurrently; then, without > blocking any other process, scan the page range and update the > placeholder tuple (this could take a long time, so it'd be a bad idea > to hold buffer lock for that long). Yeah, agreed, and your upthread point about avoiding deadlock when we need to take two buffer locks at the same time is also something that it's hard to see any other way around. Maybe we just have to find a way to make the existing structure work. The sticking point is that not only might the tuple we expected have been deleted, but someone could have put an unrelated tuple in its place. Are you confident that you can detect that and recover from it? If you're sure that brin_tuples_equal() is trustworthy for this purpose, then maybe we just have some run-of-the-mill bugs to find, like the off-the-end bug I spotted in brin_doupdate. There's apparently at least one more, but given the error message it must be something like not checking for a page to have turned into a revmap page. Shouldn't be too hard to find... regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers