diff options
| author | Tom Lane | 2004-05-29 22:48:23 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-05-29 22:48:23 +0000 |
| commit | 076a055acf3c55314de267c62b03191586d79cf6 (patch) | |
| tree | 1bfb8a8755cd393c6615bd55a7a4bb7ad404781c /src/include | |
| parent | d531fd2cdc819e7ca026c2ab9e65a7f7c49b1906 (diff) | |
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/include')
| -rw-r--r-- | src/include/access/xlog.h | 3 | ||||
| -rw-r--r-- | src/include/bootstrap/bootstrap.h | 6 | ||||
| -rw-r--r-- | src/include/miscadmin.h | 48 | ||||
| -rw-r--r-- | src/include/pgstat.h | 3 | ||||
| -rw-r--r-- | src/include/postmaster/bgwriter.h | 29 | ||||
| -rw-r--r-- | src/include/postmaster/postmaster.h | 41 | ||||
| -rw-r--r-- | src/include/storage/bufmgr.h | 10 | ||||
| -rw-r--r-- | src/include/storage/pmsignal.h | 4 | ||||
| -rw-r--r-- | src/include/tcop/tcopprot.h | 4 |
9 files changed, 92 insertions, 56 deletions
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index b0ebedcf329..0e44e77446d 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.50 2004/05/27 17:12:57 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.51 2004/05/29 22:48:22 tgl Exp $ */ #ifndef XLOG_H #define XLOG_H @@ -207,7 +207,6 @@ extern XLogRecPtr ProcLastRecEnd; /* these variables are GUC parameters related to XLOG */ extern int CheckPointSegments; -extern int CheckPointWarning; extern int XLOGbuffers; extern char *XLOG_sync_method; extern const char XLOG_sync_method_default[]; diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h index 7dd9c808fde..21ed4828692 100644 --- a/src/include/bootstrap/bootstrap.h +++ b/src/include/bootstrap/bootstrap.h @@ -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/bootstrap/bootstrap.h,v 1.34 2004/05/28 05:13:21 tgl Exp $ + * $PostgreSQL: pgsql/src/include/bootstrap/bootstrap.h,v 1.35 2004/05/29 22:48:22 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -58,8 +58,6 @@ extern void Int_yyerror(const char *str); #define BS_XLOG_NOP 0 #define BS_XLOG_BOOTSTRAP 1 #define BS_XLOG_STARTUP 2 -#define BS_XLOG_CHECKPOINT 3 -#define BS_XLOG_BGWRITER 4 -#define BS_XLOG_SHUTDOWN 5 +#define BS_XLOG_BGWRITER 3 #endif /* BOOTSTRAP_H */ diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index e8e35fd6b58..4561d2fcfb7 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -13,11 +13,10 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.161 2004/05/28 05:13:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.162 2004/05/29 22:48:22 tgl Exp $ * * NOTES - * some of the information in this file should be moved to - * other files. + * some of the information in this file should be moved to other files. * *------------------------------------------------------------------------- */ @@ -25,6 +24,9 @@ #define MISCADMIN_H +#define PG_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n" + + /***************************************************************************** * System interrupt and critical section handling * @@ -75,12 +77,15 @@ extern volatile uint32 CritSectionCount; extern void ProcessInterrupts(void); #ifndef WIN32 + #define CHECK_FOR_INTERRUPTS() \ do { \ if (InterruptPending) \ ProcessInterrupts(); \ } while(0) -#else + +#else /* WIN32 */ + #define CHECK_FOR_INTERRUPTS() \ do { \ if (WaitForSingleObject(pgwin32_signal_event,0) == WAIT_OBJECT_0) \ @@ -88,7 +93,8 @@ do { \ if (InterruptPending) \ ProcessInterrupts(); \ } while(0) -#endif + +#endif /* WIN32 */ #define HOLD_INTERRUPTS() (InterruptHoldoffCount++) @@ -113,20 +119,6 @@ do { \ *****************************************************************************/ /* - * from postmaster/postmaster.c - */ -extern bool ClientAuthInProgress; - -extern int PostmasterMain(int argc, char *argv[]); -extern void ClosePostmasterPorts(bool pgstat_too); -#ifdef EXEC_BACKEND -extern pid_t postmaster_forkexec(int argc, char *argv[]); -extern int SubPostmasterMain(int argc, char *argv[]); -#endif - -#define PG_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n" - -/* * from utils/init/globals.c */ extern pid_t PostmasterPid; @@ -137,6 +129,9 @@ extern bool ExitOnAnyError; extern char *DataDir; +extern DLLIMPORT int NBuffers; +extern int MaxBackends; + extern DLLIMPORT int MyProcPid; extern struct Port *MyProcPort; extern long MyCancelKey; @@ -216,21 +211,6 @@ extern int VacuumCostNaptime; extern int VacuumCostBalance; extern bool VacuumCostActive; -/* - * A few postmaster startup options are exported here so the - * configuration file processor can access them. - */ -extern bool EnableSSL; -extern bool SilentMode; -extern int MaxBackends; -extern int ReservedBackends; -extern DLLIMPORT int NBuffers; -extern int PostPortNumber; -extern int Unix_socket_permissions; -extern char *Unix_socket_group; -extern char *UnixSocketDir; -extern char *ListenAddresses; - /* in tcop/postgres.c */ extern void check_stack_depth(void); diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 8f7c4dc4515..96d3af7ab05 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -5,7 +5,7 @@ * * Copyright (c) 2001-2003, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.22 2004/05/28 05:13:25 tgl Exp $ + * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.23 2004/05/29 22:48:22 tgl Exp $ * ---------- */ #ifndef PGSTAT_H @@ -349,7 +349,6 @@ extern bool pgstat_is_running; extern void pgstat_init(void); extern void pgstat_start(void); extern bool pgstat_ispgstat(int pid); -extern void pgstat_close_sockets(void); extern void pgstat_beterm(int pid); #ifdef EXEC_BACKEND diff --git a/src/include/postmaster/bgwriter.h b/src/include/postmaster/bgwriter.h new file mode 100644 index 00000000000..c11af72e789 --- /dev/null +++ b/src/include/postmaster/bgwriter.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * bgwriter.h + * Exports from postmaster/bgwriter.c. + * + * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group + * + * $PostgreSQL: pgsql/src/include/postmaster/bgwriter.h,v 1.1 2004/05/29 22:48:23 tgl Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef _BGWRITER_H +#define _BGWRITER_H + +/* GUC options */ +extern int BgWriterDelay; +extern int BgWriterPercent; +extern int BgWriterMaxPages; +extern int CheckPointTimeout; +extern int CheckPointWarning; + +extern void BackgroundWriterMain(void); + +extern void RequestCheckpoint(bool waitforit); + +extern int BgWriterShmemSize(void); +extern void BgWriterShmemInit(void); + +#endif /* _BGWRITER_H */ diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h new file mode 100644 index 00000000000..d349018f4b5 --- /dev/null +++ b/src/include/postmaster/postmaster.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * postmaster.h + * Exports from postmaster/postmaster.c. + * + * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $PostgreSQL: pgsql/src/include/postmaster/postmaster.h,v 1.1 2004/05/29 22:48:23 tgl Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef _POSTMASTER_H +#define _POSTMASTER_H + +/* GUC options */ +extern bool EnableSSL; +extern bool SilentMode; +extern int ReservedBackends; +extern int PostPortNumber; +extern int Unix_socket_permissions; +extern char *Unix_socket_group; +extern char *UnixSocketDir; +extern char *ListenAddresses; +extern bool ClientAuthInProgress; +extern int PreAuthDelay; +extern int AuthenticationTimeout; +extern char *preload_libraries_string; +extern bool Log_connections; +extern bool log_hostname; +extern char *rendezvous_name; + + +extern int PostmasterMain(int argc, char *argv[]); +extern void ClosePostmasterPorts(void); +#ifdef EXEC_BACKEND +extern pid_t postmaster_forkexec(int argc, char *argv[]); +extern int SubPostmasterMain(int argc, char *argv[]); +#endif + +#endif /* _POSTMASTER_H */ diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index 0aab9ad24f4..27752d412b5 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -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/bufmgr.h,v 1.79 2004/05/08 19:09:25 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.80 2004/05/29 22:48:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -28,11 +28,6 @@ extern DLLIMPORT int NBuffers; /* in bufmgr.c */ extern bool zero_damaged_pages; -extern int BgWriterDelay; -extern int BgWriterPercent; -extern int BgWriterMaxpages; - - /* in buf_init.c */ extern DLLIMPORT Block *BufferBlockPointers; extern int32 *PrivateRefCount; @@ -179,9 +174,6 @@ extern void AbortBufferIO(void); extern void BufmgrCommit(void); extern int BufferSync(int percent, int maxpages); -extern void BufferBackgroundWriter(void); -extern const char *BgWriterAssignSyncMethod(const char *method, - bool doid, bool interactive); extern void InitLocalBuffer(void); diff --git a/src/include/storage/pmsignal.h b/src/include/storage/pmsignal.h index 688b83adab1..4180c95c735 100644 --- a/src/include/storage/pmsignal.h +++ b/src/include/storage/pmsignal.h @@ -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/pmsignal.h,v 1.7 2004/05/23 03:50:45 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/pmsignal.h,v 1.8 2004/05/29 22:48:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -22,7 +22,6 @@ */ typedef enum { - PMSIGNAL_DO_CHECKPOINT, /* request to start a checkpoint */ PMSIGNAL_PASSWORD_CHANGE, /* pg_pwd file has changed */ PMSIGNAL_WAKEN_CHILDREN, /* send a SIGUSR1 signal to all backends */ @@ -35,5 +34,6 @@ typedef enum extern void PMSignalInit(void); extern void SendPostmasterSignal(PMSignalReason reason); extern bool CheckPostmasterSignal(PMSignalReason reason); +extern bool PostmasterIsAlive(bool amDirectChild); #endif /* PMSIGNAL_H */ diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h index 97556ccbf1d..1218e04fdfb 100644 --- a/src/include/tcop/tcopprot.h +++ b/src/include/tcop/tcopprot.h @@ -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/tcop/tcopprot.h,v 1.65 2004/04/11 00:54:45 momjian Exp $ + * $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.66 2004/05/29 22:48:23 tgl Exp $ * * OLD COMMENTS * This file was created so that other c files could get the two @@ -30,9 +30,7 @@ extern DLLIMPORT sigjmp_buf Warn_restart; extern bool Warn_restart_ready; extern bool InError; extern CommandDest whereToSendOutput; -extern bool log_hostname; extern DLLIMPORT const char *debug_query_string; -extern char *rendezvous_name; extern int max_stack_depth; extern bool in_fatal_exit; |
