@ -16,7 +16,7 @@
*
* Copyright ( c ) 2001 , PostgreSQL Global Development Group
*
* $ Header : / cvsroot / pgsql / src / backend / postmaster / pgstat . c , v 1.7 2001 / 08 / 23 23 : 06 : 37 tgl Exp $
* $ Header : / cvsroot / pgsql / src / backend / postmaster / pgstat . c , v 1.8 2001 / 10 / 01 05 : 36 : 13 tgl Exp $
* - - - - - - - - - -
*/
# include "postgres.h"
@ -511,7 +511,8 @@ pgstat_vacuum_tabstat(void)
* Lookup our own database entry
*/
dbentry = ( PgStat_StatDBEntry * ) hash_search ( pgStatDBHash ,
( char * ) & MyDatabaseId , HASH_FIND , & found ) ;
( void * ) & MyDatabaseId ,
HASH_FIND , & found ) ;
if ( ! found | | dbentry = = NULL )
return - 1 ;
@ -927,7 +928,8 @@ pgstat_fetch_stat_dbentry(Oid dbid)
* Lookup the requested database
*/
dbentry = ( PgStat_StatDBEntry * ) hash_search ( pgStatDBHash ,
( char * ) & dbid , HASH_FIND , & found ) ;
( void * ) & dbid ,
HASH_FIND , & found ) ;
if ( ! found | | dbentry = = NULL )
return NULL ;
@ -967,7 +969,8 @@ pgstat_fetch_stat_tabentry(Oid relid)
* Lookup our database .
*/
dbentry = ( PgStat_StatDBEntry * ) hash_search ( pgStatDBHash ,
( char * ) & MyDatabaseId , HASH_FIND , & found ) ;
( void * ) & MyDatabaseId ,
HASH_FIND , & found ) ;
if ( ! found | | dbentry = = NULL )
return NULL ;
@ -977,7 +980,8 @@ pgstat_fetch_stat_tabentry(Oid relid)
if ( dbentry - > tables = = NULL )
return NULL ;
tabentry = ( PgStat_StatTabEntry * ) hash_search ( dbentry - > tables ,
( char * ) & relid , HASH_FIND , & found ) ;
( void * ) & relid ,
HASH_FIND , & found ) ;
if ( ! found | | tabentry = = NULL )
return NULL ;
@ -1198,7 +1202,7 @@ pgstat_main(int real_argc, char *real_argv[])
*/
memset ( & hash_ctl , 0 , sizeof ( hash_ctl ) ) ;
hash_ctl . keysize = sizeof ( int ) ;
hash_ctl . data size = sizeof ( PgStat_StatBeDead ) ;
hash_ctl . entry size = sizeof ( PgStat_StatBeDead ) ;
hash_ctl . hash = tag_hash ;
pgStatBeDead = hash_create ( PGSTAT_BE_HASH_SIZE , & hash_ctl ,
HASH_ELEM | HASH_FUNCTION ) ;
@ -1721,7 +1725,8 @@ pgstat_add_backend(PgStat_MsgHdr *msg)
* If the backend is known to be dead , we ignore this add .
*/
deadbe = ( PgStat_StatBeDead * ) hash_search ( pgStatBeDead ,
( char * ) & ( msg - > m_procpid ) , HASH_FIND , & found ) ;
( void * ) & ( msg - > m_procpid ) ,
HASH_FIND , & found ) ;
if ( deadbe = = NULL )
{
fprintf ( stderr , " PGSTAT: Dead backend table corrupted - abort \n " ) ;
@ -1748,8 +1753,8 @@ pgstat_add_backend(PgStat_MsgHdr *msg)
* Lookup or create the database entry for this backends DB .
*/
dbentry = ( PgStat_StatDBEntry * ) hash_search ( pgStatDBHash ,
( char * ) & ( msg - > m_databaseid ) , HASH_ENTER ,
& found ) ;
( void * ) & ( msg - > m_databaseid ) ,
HASH_ENTER , & found ) ;
if ( dbentry = = NULL )
{
fprintf ( stderr , " PGSTAT: DB hash table corrupted - abort \n " ) ;
@ -1773,7 +1778,7 @@ pgstat_add_backend(PgStat_MsgHdr *msg)
memset ( & hash_ctl , 0 , sizeof ( hash_ctl ) ) ;
hash_ctl . keysize = sizeof ( Oid ) ;
hash_ctl . data size = sizeof ( PgStat_StatTabEntry ) ;
hash_ctl . entry size = sizeof ( PgStat_StatTabEntry ) ;
hash_ctl . hash = tag_hash ;
dbentry - > tables = hash_create ( PGSTAT_TAB_HASH_SIZE , & hash_ctl ,
HASH_ELEM | HASH_FUNCTION ) ;
@ -1828,7 +1833,8 @@ pgstat_sub_backend(int procpid)
* sent ) .
*/
deadbe = ( PgStat_StatBeDead * ) hash_search ( pgStatBeDead ,
( char * ) & procpid , HASH_ENTER , & found ) ;
( void * ) & procpid ,
HASH_ENTER , & found ) ;
if ( deadbe = = NULL )
{
fprintf ( stderr , " PGSTAT: dead backend hash table corrupted "
@ -1914,7 +1920,7 @@ pgstat_write_statsfile(void)
hash_destroy ( dbentry - > tables ) ;
hentry = hash_search ( pgStatDBHash ,
( char * ) & ( dbentry - > databaseid ) ,
( void * ) & ( dbentry - > databaseid ) ,
HASH_REMOVE , & found ) ;
if ( hentry = = NULL )
{
@ -1959,7 +1965,7 @@ pgstat_write_statsfile(void)
if ( - - ( tabentry - > destroy ) = = 0 )
{
hentry = hash_search ( dbentry - > tables ,
( char * ) & ( tabentry - > tableid ) ,
( void * ) & ( tabentry - > tableid ) ,
HASH_REMOVE , & found ) ;
if ( hentry = = NULL )
{
@ -2047,7 +2053,8 @@ pgstat_write_statsfile(void)
*/
if ( - - ( deadbe - > destroy ) < = 0 )
{
hentry = hash_search ( pgStatBeDead , ( char * ) & ( deadbe - > procpid ) ,
hentry = hash_search ( pgStatBeDead ,
( void * ) & ( deadbe - > procpid ) ,
HASH_REMOVE , & found ) ;
if ( hentry = = NULL )
{
@ -2108,7 +2115,7 @@ pgstat_read_statsfile(HTAB **dbhash, Oid onlydb,
*/
memset ( & hash_ctl , 0 , sizeof ( hash_ctl ) ) ;
hash_ctl . keysize = sizeof ( Oid ) ;
hash_ctl . data size = sizeof ( PgStat_StatDBEntry ) ;
hash_ctl . entry size = sizeof ( PgStat_StatDBEntry ) ;
hash_ctl . hash = tag_hash ;
hash_ctl . hcxt = use_mcxt ;
* dbhash = hash_create ( PGSTAT_DB_HASH_SIZE , & hash_ctl ,
@ -2176,7 +2183,7 @@ pgstat_read_statsfile(HTAB **dbhash, Oid onlydb,
* Add to the DB hash
*/
dbentry = ( PgStat_StatDBEntry * ) hash_search ( * dbhash ,
( char * ) & dbbuf . databaseid ,
( void * ) & dbbuf . databaseid ,
HASH_ENTER , & found ) ;
if ( dbentry = = NULL )
{
@ -2223,7 +2230,7 @@ pgstat_read_statsfile(HTAB **dbhash, Oid onlydb,
memset ( & hash_ctl , 0 , sizeof ( hash_ctl ) ) ;
hash_ctl . keysize = sizeof ( Oid ) ;
hash_ctl . data size = sizeof ( PgStat_StatTabEntry ) ;
hash_ctl . entry size = sizeof ( PgStat_StatTabEntry ) ;
hash_ctl . hash = tag_hash ;
hash_ctl . hcxt = use_mcxt ;
dbentry - > tables = hash_create ( PGSTAT_TAB_HASH_SIZE , & hash_ctl ,
@ -2287,7 +2294,7 @@ pgstat_read_statsfile(HTAB **dbhash, Oid onlydb,
break ;
tabentry = ( PgStat_StatTabEntry * ) hash_search ( tabhash ,
( char * ) & tabbuf . tableid ,
( void * ) & tabbuf . tableid ,
HASH_ENTER , & found ) ;
if ( tabentry = = NULL )
{
@ -2411,7 +2418,7 @@ pgstat_read_statsfile(HTAB **dbhash, Oid onlydb,
* Count backends per database here .
*/
dbentry = ( PgStat_StatDBEntry * ) hash_search ( * dbhash ,
( char * ) & ( ( * betab ) [ havebackends ] . databaseid ) ,
( void * ) & ( ( * betab ) [ havebackends ] . databaseid ) ,
HASH_FIND , & found ) ;
if ( found )
dbentry - > n_backends + + ;
@ -2526,7 +2533,7 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
* Lookup the database in the hashtable .
*/
dbentry = ( PgStat_StatDBEntry * ) hash_search ( pgStatDBHash ,
( char * ) & ( msg - > m_hdr . m_databaseid ) ,
( void * ) & ( msg - > m_hdr . m_databaseid ) ,
HASH_FIND , & found ) ;
if ( dbentry = = NULL )
{
@ -2552,7 +2559,7 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
for ( i = 0 ; i < msg - > m_nentries ; i + + )
{
tabentry = ( PgStat_StatTabEntry * ) hash_search ( dbentry - > tables ,
( char * ) & ( tabmsg [ i ] . t_id ) ,
( void * ) & ( tabmsg [ i ] . t_id ) ,
HASH_ENTER , & found ) ;
if ( tabentry = = NULL )
{
@ -2626,7 +2633,7 @@ pgstat_recv_tabpurge(PgStat_MsgTabpurge *msg, int len)
* Lookup the database in the hashtable .
*/
dbentry = ( PgStat_StatDBEntry * ) hash_search ( pgStatDBHash ,
( char * ) & ( msg - > m_hdr . m_databaseid ) ,
( void * ) & ( msg - > m_hdr . m_databaseid ) ,
HASH_FIND , & found ) ;
if ( dbentry = = NULL )
{
@ -2649,7 +2656,7 @@ pgstat_recv_tabpurge(PgStat_MsgTabpurge *msg, int len)
for ( i = 0 ; i < msg - > m_nentries ; i + + )
{
tabentry = ( PgStat_StatTabEntry * ) hash_search ( dbentry - > tables ,
( char * ) & ( msg - > m_tableid [ i ] ) ,
( void * ) & ( msg - > m_tableid [ i ] ) ,
HASH_FIND , & found ) ;
if ( tabentry = = NULL )
{
@ -2686,7 +2693,7 @@ pgstat_recv_dropdb(PgStat_MsgDropdb *msg, int len)
* Lookup the database in the hashtable .
*/
dbentry = ( PgStat_StatDBEntry * ) hash_search ( pgStatDBHash ,
( char * ) & ( msg - > m_databaseid ) ,
( void * ) & ( msg - > m_databaseid ) ,
HASH_FIND , & found ) ;
if ( dbentry = = NULL )
{
@ -2726,7 +2733,7 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
* Lookup the database in the hashtable .
*/
dbentry = ( PgStat_StatDBEntry * ) hash_search ( pgStatDBHash ,
( char * ) & ( msg - > m_hdr . m_databaseid ) ,
( void * ) & ( msg - > m_hdr . m_databaseid ) ,
HASH_FIND , & found ) ;
if ( dbentry = = NULL )
{
@ -2753,7 +2760,7 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
memset ( & hash_ctl , 0 , sizeof ( hash_ctl ) ) ;
hash_ctl . keysize = sizeof ( Oid ) ;
hash_ctl . data size = sizeof ( PgStat_StatTabEntry ) ;
hash_ctl . entry size = sizeof ( PgStat_StatTabEntry ) ;
hash_ctl . hash = tag_hash ;
dbentry - > tables = hash_create ( PGSTAT_TAB_HASH_SIZE , & hash_ctl ,
HASH_ELEM | HASH_FUNCTION ) ;