Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 964ec46

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-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.
1 parent f086be3 commit 964ec46

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-
* $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.25 2007/01/05 22:19:37 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.26 2007/06/01 23:43:11 tgl Exp $
1111
*
1212
* NOTES:
1313
*
@@ -289,7 +289,7 @@ BufFileDumpBuffer(BufFile *file)
289289
return; /* seek failed, give up */
290290
file->offsets[file->curFile] = file->curOffset;
291291
}
292-
bytestowrite = FileWrite(thisfile, file->buffer, bytestowrite);
292+
bytestowrite = FileWrite(thisfile, file->buffer + wpos, bytestowrite);
293293
if (bytestowrite <= 0)
294294
return; /* failed to write */
295295
file->offsets[file->curFile] += bytestowrite;

0 commit comments

Comments
 (0)