From fcca411c04122960769c33f61c5ca37df606213f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 1 Jun 2007 23:43:17 +0000 Subject: [PATCH] Fix aboriginal bug in BufFileDumpBuffer that would cause it to write the wrong data when dumping a bufferload that crosses a component-file boundary. This probably has not been seen in the wild because (a) component files are normally 1GB apiece and (b) non-block-aligned buffer usage is relatively rare. But it's fairly easy to reproduce a problem if one reduces RELSEG_SIZE in a test build. Kudos to Kurt Harriman for spotting the bug. --- src/backend/storage/file/buffile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index 6377f59139..164e2f5700 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -289,7 +289,7 @@ BufFileDumpBuffer(BufFile *file) return; /* seek failed, give up */ file->offsets[file->curFile] = file->curOffset; } - bytestowrite = FileWrite(thisfile, file->buffer, bytestowrite); + bytestowrite = FileWrite(thisfile, file->buffer + wpos, bytestowrite); if (bytestowrite <= 0) return; /* failed to write */ file->offsets[file->curFile] += bytestowrite; -- 2.39.5