summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2007-06-01 23:43:39 +0000
committerTom Lane2007-06-01 23:43:39 +0000
commit72cbfa4fcc6718fcd8c4eb479d0353b8802ce322 (patch)
tree85de714b118df13721894df93fa807cda1f46053
parent2d91f676b0b23afc2cd0cd69f005dad7494c378e (diff)
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.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 7e78793a404..7f77f130ebe 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.14 2002/09/05 00:43:07 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/file/buffile.c,v 1.14.2.1 2007/06/01 23:43:39 tgl Exp $
*
* NOTES:
*
@@ -287,7 +287,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;