Question on corruption (PostgreSQL 9.6.1)

From: Andy Halsall <andyh(at)live(dot)co(dot)uk>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Question on corruption (PostgreSQL 9.6.1)
Date: 2018-03-13 08:48:31
Message-ID: DB6PR0902MB1878C535A03C87A576532066F5D20@DB6PR0902MB1878.eurprd09.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Following a number of kernel crashes due to memory corruption, we experienced "ERROR: invalid memory alloc request size 8589934587" from pg_dump. We assume because of corruption to a PostgreSQL page due to the same memory problems causing the crashes. Fortunately this was low impact - we could remove the single problematic row through the application. pg_dump now ok.

But recently we hit a different problem when restoring a pg_dump, seemingly caused by empty data in a not-null column. From pg_dump:

...

CREATE TABLE xxxxx (
col_a bigint NOT NULL,
col_b bytea,
col_c integer NOT NULL,
col_d bytea,
col_e integer NOT NULL,
last_modified timestamp without time zone NOT NULL
);

COPY xxxxx (col_a, col_b, col_c, col_d, col_e, last_modified) FROM stdin;
....
4675632 \\x 0 \\x 0 2017-09-27 10:34:38.109677
4675633 \\x 0 \\x 0 2017-09-27 10:34:38.113812
4675634 \\x 0 \\x 0 2017-09-27 10:34:38.118072
\N \N \N \N \N \N
4675636 \\x 0 \\x 0 2017-09-27 10:34:38.128796
4675637 \\x 0 \\x 0 2017-09-27 10:34:38.132003
4675638 \\x 0 \\x 0 2017-09-27 10:34:38.134197
....

And then investigating rows 4675634 and 4675635:

db=# select * from xxxxx where col_a = 4675634;
col_a | col_b | col_c | col_d | col_e | last_modified
---------+-------------+-----------------+-----------+---------------+----------------------------
4675634 | \x | 0 | \x | 0 | 2017-09-27 10:34:38.118072
(1 row)

db=# select * from xxxxx where col_a = 4675635;
col_a | col_b | col_c | col_d | col_e | last_modified
--------+-------------+-----------------+-----------+---------------+---------------
| | | | |
(1 row)

Row 4675635 is very odd - NULL columns and at the same time retrievable by a value in col_a.

Can this be explained in any other way than by corruption or could it be some other behaviour that we should worry about?

(We've never seen anything like it in test, just on the system that's had the problems. Previous problem row was col_a=4675656 - same table and perhaps page and so perhaps same corruption).

Fortunately again low impact - we were able to delete the row through the application.

Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dylan Luong 2018-03-13 11:28:26 Point-in-time recovery after failover
Previous Message Alban Hertroys 2018-03-13 08:21:19 Re: Programmatically duplicating a schema