Segmentation fault when creating a BRIN, 10beta1

Alexander Sosna <alexander.sosna@credativ.de>

From: Alexander Sosna <alexander.sosna@credativ.de>
To: pgsql-hackers@postgresql.org
Date: 2017-05-30T15:03:32Z
Lists: pgsql-hackers

Attachments

Hi,

I can reproduce a segmentation fault when creating a BRIN concurrently
with set pages_per_range and autosummarize.

# Reproduce
CREATE TABLE brin_test AS
    SELECT
        series AS id,
        MD5(series::TEXT) AS VALUE,
        '2015-10-31 13:37:00.313370+01'::TIMESTAMP + (series::TEXT || '
Minute')::INTERVAL AS TIME
    FROM
        GENERATE_SERIES(0,10000) AS series;

CREATE INDEX CONCURRENTLY brin_test_time_abrin_8 ON brin_test USING brin
(TIME) WITH (pages_per_range=8, autosummarize=true);

2017-05-30 16:08:59.451 CEST [20689] LOG:  server process (PID 20881)
was terminated by signal 11: Segmentation fault
2017-05-30 16:08:59.451 CEST [20689] DETAIL:  Failed process was
running: CREATE INDEX CONCURRENTLY brin_test_time_abrin_8 ON brin_test
USING brin (TIME) WITH (pages_per_range=8, autosummarize=true);
2017-05-30 16:08:59.451 CEST [20689] LOG:  terminating any other active
server processes
2017-05-30 16:08:59.451 CEST [20806] WARNING:  terminating connection
because of crash of another server process
2017-05-30 16:08:59.451 CEST [20806] DETAIL:  The postmaster has
commanded this server process to roll back the current transaction and
exit, because another server process exited abnormally and possibly
corrupted shared memory.
2017-05-30 16:08:59.451 CEST [20806] HINT:  In a moment you should be
able to reconnect to the database and repeat your command.
2017-05-30 16:08:59.452 CEST [21204] postgres@postgres FATAL:  the
database system is in recovery mode

The debian packages where used, version "PostgreSQL 10beta1 on
x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18) 6.3.0 20170516,
64-bit".
I also tested the latest git commit
d5cb3bab564e0927ffac7c8729eacf181a12dd40 with the same result.
A more detailed log (debug5) can be found attached.


Kind regards,
Alexander Sosna

Commits

  1. brin: Don't crash on auto-summarization

  2. Fix improper quoting of format_type_be() output.