diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-01 23:43:34 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-01 23:43:34 +0000 |
commit | 20c031eb8a9e9d0e74159d8d1d0dd1f77c3db648 (patch) | |
tree | b8cb149ed23377afc7afed960f9bbc79e7ebc75b | |
parent | 86b6abe9805e9457389c78f8ddbdfe2c91a7c90c (diff) | |
download | postgresql-20c031eb8a9e9d0e74159d8d1d0dd1f77c3db648.tar.gz postgresql-20c031eb8a9e9d0e74159d8d1d0dd1f77c3db648.zip |
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.
-rw-r--r-- | src/backend/storage/file/buffile.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index 45ee4b0326a..957d033efd0 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/file/buffile.c,v 1.18 2003/08/04 02:40:03 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/file/buffile.c,v 1.18.4.1 2007/06/01 23:43:34 tgl Exp $ * * NOTES: * @@ -292,7 +292,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; |