aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer/bufmgr.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-05-29 22:48:23 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-05-29 22:48:23 +0000
commit076a055acf3c55314de267c62b03191586d79cf6 (patch)
tree1bfb8a8755cd393c6615bd55a7a4bb7ad404781c /src/backend/storage/buffer/bufmgr.c
parentd531fd2cdc819e7ca026c2ab9e65a7f7c49b1906 (diff)
downloadpostgresql-076a055acf3c55314de267c62b03191586d79cf6.tar.gz
postgresql-076a055acf3c55314de267c62b03191586d79cf6.zip
Separate out bgwriter code into a logically separate module, rather
than being random pieces of other files. Give bgwriter responsibility for all checkpoint activity (other than a post-recovery checkpoint); so this child process absorbs the functionality of the former transient checkpoint and shutdown subprocesses. While at it, create an actual include file for postmaster.c, which for some reason never had its own file before.
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r--src/backend/storage/buffer/bufmgr.c72
1 files changed, 1 insertions, 71 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 4f6772564a8..f718e33cd59 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.165 2004/05/08 19:09:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.166 2004/05/29 22:48:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -60,10 +60,6 @@ bool zero_damaged_pages = false;
bool ShowPinTrace = false;
#endif
-int BgWriterDelay = 200;
-int BgWriterPercent = 1;
-int BgWriterMaxpages = 100;
-
long NDirectFileRead; /* some I/O's are direct file access.
* bypass bufmgr */
long NDirectFileWrite; /* e.g., I/O in psort and hashjoin. */
@@ -863,72 +859,6 @@ FlushBufferPool(void)
/*
- * BufferBackgroundWriter
- *
- * Periodically flushes dirty blocks from the buffer pool to keep
- * the LRU list clean, preventing regular backends from writing.
- */
-void
-BufferBackgroundWriter(void)
-{
- if (BgWriterPercent == 0)
- return;
-
- /*
- * Loop forever
- */
- for (;;)
- {
- int n;
- long udelay;
-
- /*
- * Call BufferSync() with instructions to keep just the
- * LRU heads clean.
- */
- n = BufferSync(BgWriterPercent, BgWriterMaxpages);
-
- /*
- * Whatever signal is sent to us, let's just die gallantly. If
- * it wasn't meant that way, the postmaster will reincarnate us.
- */
- if (InterruptPending)
- return;
-
- /*
- * Whenever we have nothing to do, close all smgr files. This
- * is so we won't hang onto smgr references to deleted files
- * indefinitely. XXX this is a bogus, temporary solution. 'Twould
- * be much better to do this once per checkpoint, but the bgwriter
- * doesn't yet know anything about checkpoints.
- */
- if (n == 0)
- smgrcloseall();
-
- /*
- * Nap for the configured time or sleep for 10 seconds if
- * there was nothing to do at all.
- *
- * On some platforms, signals won't interrupt the sleep. To ensure
- * we respond reasonably promptly when the postmaster signals us,
- * break down the sleep into 1-second increments, and check for
- * interrupts after each nap.
- */
- udelay = ((n > 0) ? BgWriterDelay : 10000) * 1000L;
- while (udelay > 1000000L)
- {
- pg_usleep(1000000L);
- udelay -= 1000000L;
- if (InterruptPending)
- return;
- }
- pg_usleep(udelay);
- if (InterruptPending)
- return;
- }
-}
-
-/*
* Do whatever is needed to prepare for commit at the bufmgr and smgr levels
*/
void