pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Subject: Re: Re: PANIC: invalid index offnum: 186 when processing BRIN indexes in VACUUM
Date: Tue, 31 Oct 2017 23:44:36 +0100
Message-ID: <083d996a-4a8a-0e13-800a-851dd09ad8cc@2ndquadrant.com> (raw)
In-Reply-To: <13135.1509479192@sss.pgh.pa.us>
References: <20171031181053.xh7hzminpv6rvwr2@alvherre.pgsql>
	<11499.1509476951@sss.pgh.pa.us>
	<13135.1509479192@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Hi,

On 10/31/2017 08:46 PM, Tom Lane wrote:
> I wrote:
>> 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...
> 
> Actually, I think it might be as simple as the attached.
> brin_getinsertbuffer checks for the old page having turned into revmap,
> but the "samepage" path in brin_doupdate does not :-(
> 
> With this applied, Alvaro's version of the test case has survived
> without error for quite a bit longer than its former MTBF.  There
> might still be some issues though in other code paths.
> 

That does fix the crashes for me - I've been unable to reproduce any
even after one hour (it took a couple of minutes to crash before).

Unfortunately, I think we still have a problem ... I've been wondering
if we end up producing correct indexes, so I've done a simple test.

1) create the table as before

2) let the insert + vacuum run for some time, to see if there are
crashes (result: no crashes after one hour, inserting ~92M rows)

3) do a bunch of random updates on the data (while still doing the
concurrent vacuum in another session)

4) run a bunch of simple queries to compare the results, essentially

   -- BRIN index
   SET enable_bitmapscan = on;
   SELECT COUNT(*) FROM brin_test WHERE a = $1;


   -- seq scan
   SET enable_bitmapscan = on;
   SELECT COUNT(*) FROM brin_test WHERE a = $1;

and unfortunately what I get is not particularly pleasant:

    test=# set enable_bitmapscan = on;
    SET
    test=# select count(*) from brin_test where a = 0;
     count
    -------
      9062
    (1 row)

    test=# set enable_bitmapscan = off;
    SET
    test=# select count(*) from brin_test where a = 0;
     count
    -------
      9175
    (1 row)

Attached is a SQL script with commands I used. You'll need to copy the
commands into multiple psql sessions, though, to simulate concurrent
activity).

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

  [application/sql] brin-test.sql (1.2K, ../083d996a-4a8a-0e13-800a-851dd09ad8cc@2ndquadrant.com/2-brin-test.sql)
  download

view thread (42+ messages)  latest in thread

Message-ID: <083d996a-4a8a-0e13-800a-851dd09ad8cc@2ndquadrant.com>
Permalink:  ../083d996a-4a8a-0e13-800a-851dd09ad8cc@2ndquadrant.com/
Also on:    postgresql.org/message-id/083d996a-4a8a-0e13-800a-851dd09ad8cc@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org, michael.paquier@gmail.com
  Subject: Re: Re: PANIC: invalid index offnum: 186 when processing BRIN indexes in VACUUM
  In-Reply-To: <083d996a-4a8a-0e13-800a-851dd09ad8cc@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox