mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
Per previous discussions, get rid of use of sync(2) in favor of
explicitly fsync'ing every (non-temp) file we have written since the last checkpoint. In the vast majority of cases, the burden of the fsyncs should fall on the bgwriter process not on backends. (To this end, we assume that an fsync issued by the bgwriter will force out blocks written to the same file by other processes using other file descriptors. Anyone have a problem with that?) This makes the world safe for WIN32, which ain't even got sync(2), and really makes the world safe for Unixen as well, because sync(2) never had the semantics we need: it offers no way to wait for the requested I/O to finish. Along the way, fix a bug I recently introduced in xlog recovery: file truncation replay failed to clear bufmgr buffers for the dropped blocks, which could result in 'PANIC: heap_delete_redo: no block' later on in xlog replay.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.41 2004/02/11 22:55:26 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.42 2004/05/31 03:48:10 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -83,10 +83,10 @@ extern bool mdread(SMgrRelation reln, BlockNumber blocknum, char *buffer);
|
||||
extern bool mdwrite(SMgrRelation reln, BlockNumber blocknum, char *buffer);
|
||||
extern BlockNumber mdnblocks(SMgrRelation reln);
|
||||
extern BlockNumber mdtruncate(SMgrRelation reln, BlockNumber nblocks);
|
||||
extern bool mdcommit(void);
|
||||
extern bool mdabort(void);
|
||||
extern bool mdsync(void);
|
||||
|
||||
extern void RememberFsyncRequest(RelFileNode rnode, BlockNumber segno);
|
||||
|
||||
/* smgrtype.c */
|
||||
extern Datum smgrout(PG_FUNCTION_ARGS);
|
||||
extern Datum smgrin(PG_FUNCTION_ARGS);
|
||||
|
||||
Reference in New Issue
Block a user