Re: Failures in constraints regression test, "read only 0 of 8192 bytes"

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Failures in constraints regression test, "read only 0 of 8192 bytes"
Date: 2024-06-20 22:52:37
Message-ID: 680fafbe-3422-457d-95c2-90f9aa9ac592@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19/06/2024 23:00, Alexander Lakhin wrote:
> Please look at a new anomaly, that I've discovered in master.
>
> ...
>
> triggers a segfault:
> 2024-06-19 19:22:49.009 UTC [1607210:6] LOG:  server process (PID 1607671) was terminated by signal 11: Segmentation fault
>
> ...
>
> server.log might also contain:
> 2024-06-19 19:25:38.060 UTC [1618682:5] psql ERROR:  could not read blocks 3..3 in file "base/28531/28840": read only 0
> of 8192 bytes

Thanks for the report! I was not able to reproduce the segfault, but I
do see the "could not read blocks" error very quickly with the script.

In commit af0e7deb4a, I removed the call to RelationCloseSmgr() from
RelationCacheInvalidate(). I thought it was no longer needed, because we
no longer free the underlying SmgrRelation.

However, it meant that if the relfilenode of the relation was changed,
the relation keeps pointing to the SMgrRelation of the old relfilenode.
So we still need the RelationCloseSmgr() call, in case the relfilenode
has changed.

Per attached patch.

--
Heikki Linnakangas
Neon (https://neon.tech)

Attachment Content-Type Size
0001-Fix-relcache-invalidation-when-relfilelocator-is-upd.patch text/x-patch 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-06-20 23:08:19 Re: Pluggable cumulative statistics
Previous Message Tomas Vondra 2024-06-20 22:07:32 Re: pg_combinebackup --clone doesn't work