Hi, While experimenting with some changes in BufFile, I noticed a harmless bug in BufFileLoadBuffer. It calls sizeof on the whole PGAlignedBuffer, instead of just on the "data" field. It's benign because the "data" is the largest part of the union, so the sizes are equal.
But it's still confusing, it took me a while my experimental patch fails. So I think it'd be good to correct it. regards -- Tomas Vondra
diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index 6449f82a72b..a4541b87b8f 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -459,7 +459,7 @@ BufFileLoadBuffer(BufFile *file) */ file->nbytes = FileRead(thisfile, file->buffer.data, - sizeof(file->buffer), + sizeof(file->buffer.data), file->curOffset, WAIT_EVENT_BUFFILE_READ); if (file->nbytes < 0)