@ -8,7 +8,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 / bootstrap / bootstrap . c , v 1.208 .2 .1 2005 / 11 / 22 18 : 23 : 05 momjian Exp $
* $ PostgreSQL : pgsql / src / backend / bootstrap / bootstrap . c , v 1.208 .2 .2 2006 / 06 / 08 23 : 55 : 54 tgl Exp $
*
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
*/
@ -57,6 +57,7 @@ extern int Int_yyparse(void);
static void usage ( void ) ;
static void usage ( void ) ;
static void bootstrap_signals ( void ) ;
static void bootstrap_signals ( void ) ;
static void ShutdownDummyProcess ( int code , Datum arg ) ;
static hashnode * AddStr ( char * str , int strlength , int mderef ) ;
static hashnode * AddStr ( char * str , int strlength , int mderef ) ;
static Form_pg_attribute AllocateAttribute ( void ) ;
static Form_pg_attribute AllocateAttribute ( void ) ;
static int CompHash ( char * str , int len ) ;
static int CompHash ( char * str , int len ) ;
@ -400,6 +401,9 @@ BootstrapMain(int argc, char *argv[])
/* finish setting up bufmgr.c */
/* finish setting up bufmgr.c */
InitBufferPoolBackend ( ) ;
InitBufferPoolBackend ( ) ;
/* register a shutdown callback for LWLock cleanup */
on_shmem_exit ( ShutdownDummyProcess , 0 ) ;
}
}
/*
/*
@ -422,8 +426,14 @@ BootstrapMain(int argc, char *argv[])
case BS_XLOG_STARTUP :
case BS_XLOG_STARTUP :
bootstrap_signals ( ) ;
bootstrap_signals ( ) ;
StartupXLOG ( ) ;
StartupXLOG ( ) ;
/*
* These next two functions don ' t consider themselves critical ,
* but we ' d best PANIC anyway if they fail .
*/
START_CRIT_SECTION ( ) ;
LoadFreeSpaceMap ( ) ;
LoadFreeSpaceMap ( ) ;
BuildFlatFiles ( false ) ;
BuildFlatFiles ( false ) ;
END_CRIT_SECTION ( ) ;
proc_exit ( 0 ) ; /* startup done */
proc_exit ( 0 ) ; /* startup done */
case BS_XLOG_BGWRITER :
case BS_XLOG_BGWRITER :
@ -552,6 +562,19 @@ bootstrap_signals(void)
}
}
}
}
/*
* Begin shutdown of a dummy process . This is approximately the equivalent
* of ShutdownPostgres ( ) in postinit . c . We can ' t run transactions in a
* dummy process , so most of the work of AbortTransaction ( ) is not needed ,
* but we do need to make sure we ' ve released any LWLocks we are holding .
* ( This is only critical during an error exit . )
*/
static void
ShutdownDummyProcess ( int code , Datum arg )
{
LWLockReleaseAll ( ) ;
}
/* ----------------
/* ----------------
* error handling / abort routines
* error handling / abort routines
* - - - - - - - - - - - - - - - -
* - - - - - - - - - - - - - - - -