mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-10 06:52:55 +00:00
Handle unexpected EOF while doing an LFC read more gracefully
There's a bug somewhere because this happens in python regression tests. We need to hunt that down, but in any case, let's not get stuck in an infinite loop if it happens.
This commit is contained in:
@@ -662,6 +662,19 @@ retry:
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not read block %lu in local cache file: %m",
|
||||
cached_block)));
|
||||
if (nbytes == 0)
|
||||
{
|
||||
/*
|
||||
* FIXME: if the file was concurrently truncated, I guess
|
||||
* this is expected. We should finish the read by calling
|
||||
* bcomm_finish_cache_read(), and only throw the error if
|
||||
* it reported success.
|
||||
*/
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not read block %lu in local cache file (unexpected EOF)",
|
||||
cached_block)));
|
||||
}
|
||||
bytes_total += nbytes;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user