aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/file/buffile.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-06-01 23:43:11 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-06-01 23:43:11 +0000
commit964ec46cfe95028ca166dd5579e07b22c7434a91 (patch)
tree72662bf36bfea602d8a6e865d6f2bddcb8f1a23e /src/backend/storage/file/buffile.c
parentf086be3d39ce003532ce818347354fe8d6efe8eb (diff)
downloadpostgresql-964ec46cfe95028ca166dd5579e07b22c7434a91.tar.gz
postgresql-964ec46cfe95028ca166dd5579e07b22c7434a91.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.
Diffstat (limited to 'src/backend/storage/file/buffile.c')
-rw-r--r--src/backend/storage/file/buffile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c
index ccaed0efa06..4f3a8a311bf 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
- * $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.25 2007/01/05 22:19:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.26 2007/06/01 23:43:11 tgl Exp $
*
* NOTES:
*
@@ -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;