mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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.
This commit is contained in:
		@@ -7,7 +7,7 @@
 | 
				
			|||||||
 * Portions Copyright (c) 1994, Regents of the University of California
 | 
					 * Portions Copyright (c) 1994, Regents of the University of California
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * IDENTIFICATION
 | 
					 * IDENTIFICATION
 | 
				
			||||||
 *	  $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.22 2005/10/15 02:49:25 momjian Exp $
 | 
					 *	  $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.22.2.1 2007/06/01 23:43:23 tgl Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * NOTES:
 | 
					 * NOTES:
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -291,7 +291,7 @@ BufFileDumpBuffer(BufFile *file)
 | 
				
			|||||||
				return;			/* seek failed, give up */
 | 
									return;			/* seek failed, give up */
 | 
				
			||||||
			file->offsets[file->curFile] = file->curOffset;
 | 
								file->offsets[file->curFile] = file->curOffset;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		bytestowrite = FileWrite(thisfile, file->buffer, bytestowrite);
 | 
							bytestowrite = FileWrite(thisfile, file->buffer + wpos, bytestowrite);
 | 
				
			||||||
		if (bytestowrite <= 0)
 | 
							if (bytestowrite <= 0)
 | 
				
			||||||
			return;				/* failed to write */
 | 
								return;				/* failed to write */
 | 
				
			||||||
		file->offsets[file->curFile] += bytestowrite;
 | 
							file->offsets[file->curFile] += bytestowrite;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user