8000 Fix aboriginal bug in BufFileDumpBuffer that would cause it to write the · danielcode/postgres@72cbfa4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 72cbfa4

Browse files
committed
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-bloc 8000 k-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.
1 parent 2d91f67 commit 72cbfa4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/storage/file/buffile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/file/buffile.c,v 1.14 2002/09/05 00:43:07 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/file/buffile.c,v 1.14.2.1 2007/06/01 23:43:39 tgl Exp $
1111
*
1212
* NOTES:
1313
*
@@ -287,7 +287,7 @@ BufFileDumpBuffer(BufFile *file)
287287
return; /* seek failed, give up */
288288
file->offsets[file->curFile] = file->curOffset;
289289
}
290-
bytestowrite = FileWrite(thisfile, file->buffer, bytestowrite);
290+
bytestowrite = FileWrite(thisfile, file->buffer + wpos, bytestowrite);
291291
if (bytestowrite <= 0)
292292
return; /* failed to write */
293293
file->offsets[file->curFile] += bytestowrite;

0 commit comments

Comments
 (0)
0