Commit fcb90fdc authored by Tom Lane's avatar Tom Lane

Change some frequently-reached elog(DEBUG...) calls to ereport(DEBUG...)

for speed reasons.  (ereport falls out much more quickly when no output
is needed than elog does.)
parent 1c6702f6
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.40 2003/08/04 17:58:14 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.41 2003/08/12 18:23:20 tgl Exp $
* *
* Since the server static private key ($DataDir/server.key) * Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database * will normally be stored unencrypted so that the database
...@@ -469,7 +469,9 @@ load_dh_buffer(const char *buffer, size_t len) ...@@ -469,7 +469,9 @@ load_dh_buffer(const char *buffer, size_t len)
return NULL; return NULL;
dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
if (dh == NULL) if (dh == NULL)
elog(DEBUG2, "DH load buffer: %s", SSLerrmessage()); ereport(DEBUG2,
(errmsg_internal("DH load buffer: %s",
SSLerrmessage())));
BIO_free(bio); BIO_free(bio);
return dh; return dh;
...@@ -541,7 +543,9 @@ tmp_dh_cb(SSL *s, int is_export, int keylength) ...@@ -541,7 +543,9 @@ tmp_dh_cb(SSL *s, int is_export, int keylength)
/* this may take a long time, but it may be necessary... */ /* this may take a long time, but it may be necessary... */
if (r == NULL || 8 * DH_size(r) < keylength) if (r == NULL || 8 * DH_size(r) < keylength)
{ {
elog(DEBUG2, "DH: generating parameters (%d bits)....", keylength); ereport(DEBUG2,
(errmsg_internal("DH: generating parameters (%d bits)....",
keylength)));
r = DH_generate_parameters(keylength, DH_GENERATOR_2, NULL, NULL); r = DH_generate_parameters(keylength, DH_GENERATOR_2, NULL, NULL);
} }
...@@ -575,28 +579,36 @@ info_cb(const SSL *ssl, int type, int args) ...@@ -575,28 +579,36 @@ info_cb(const SSL *ssl, int type, int args)
switch (type) switch (type)
{ {
case SSL_CB_HANDSHAKE_START: case SSL_CB_HANDSHAKE_START:
elog(DEBUG4, "SSL: handshake start"); ereport(DEBUG4,
(errmsg_internal("SSL: handshake start")));
break; break;
case SSL_CB_HANDSHAKE_DONE: case SSL_CB_HANDSHAKE_DONE:
elog(DEBUG4, "SSL: handshake done"); ereport(DEBUG4,
(errmsg_internal("SSL: handshake done")));
break; break;
case SSL_CB_ACCEPT_LOOP: case SSL_CB_ACCEPT_LOOP:
elog(DEBUG4, "SSL: accept loop"); ereport(DEBUG4,
(errmsg_internal("SSL: accept loop")));
break; break;
case SSL_CB_ACCEPT_EXIT: case SSL_CB_ACCEPT_EXIT:
elog(DEBUG4, "SSL: accept exit (%d)", args); ereport(DEBUG4,
(errmsg_internal("SSL: accept exit (%d)", args)));
break; break;
case SSL_CB_CONNECT_LOOP: case SSL_CB_CONNECT_LOOP:
elog(DEBUG4, "SSL: connect loop"); ereport(DEBUG4,
(errmsg_internal("SSL: connect loop")));
break; break;
case SSL_CB_CONNECT_EXIT: case SSL_CB_CONNECT_EXIT:
elog(DEBUG4, "SSL: connect exit (%d)", args); ereport(DEBUG4,
(errmsg_internal("SSL: connect exit (%d)", args)));
break; break;
case SSL_CB_READ_ALERT: case SSL_CB_READ_ALERT:
elog(DEBUG4, "SSL: read alert (0x%04x)", args); ereport(DEBUG4,
(errmsg_internal("SSL: read alert (0x%04x)", args)));
break; break;
case SSL_CB_WRITE_ALERT: case SSL_CB_WRITE_ALERT:
elog(DEBUG4, "SSL: write alert (0x%04x)", args); ereport(DEBUG4,
(errmsg_internal("SSL: write alert (0x%04x)", args)));
break; break;
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.38 2003/08/04 02:39:59 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.39 2003/08/12 18:23:20 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -120,30 +120,36 @@ geqo(Query *root, int number_of_rels, List *initial_rels) ...@@ -120,30 +120,36 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
daddy = alloc_chromo(pool->string_length); daddy = alloc_chromo(pool->string_length);
#if defined (ERX) #if defined (ERX)
elog(DEBUG2, "using edge recombination crossover [ERX]"); ereport(DEBUG2,
(errmsg_internal("using edge recombination crossover [ERX]")));
/* allocate edge table memory */ /* allocate edge table memory */
edge_table = alloc_edge_table(pool->string_length); edge_table = alloc_edge_table(pool->string_length);
#elif defined(PMX) #elif defined(PMX)
elog(DEBUG2, "using partially matched crossover [PMX]"); ereport(DEBUG2,
(errmsg_internal("using partially matched crossover [PMX]")));
/* allocate chromosome kid memory */ /* allocate chromosome kid memory */
kid = alloc_chromo(pool->string_length); kid = alloc_chromo(pool->string_length);
#elif defined(CX) #elif defined(CX)
elog(DEBUG2, "using cycle crossover [CX]"); ereport(DEBUG2,
(errmsg_internal("using cycle crossover [CX]")));
/* allocate city table memory */ /* allocate city table memory */
kid = alloc_chromo(pool->string_length); kid = alloc_chromo(pool->string_length);
city_table = alloc_city_table(pool->string_length); city_table = alloc_city_table(pool->string_length);
#elif defined(PX) #elif defined(PX)
elog(DEBUG2, "using position crossover [PX]"); ereport(DEBUG2,
(errmsg_internal("using position crossover [PX]")));
/* allocate city table memory */ /* allocate city table memory */
kid = alloc_chromo(pool->string_length); kid = alloc_chromo(pool->string_length);
city_table = alloc_city_table(pool->string_length); city_table = alloc_city_table(pool->string_length);
#elif defined(OX1) #elif defined(OX1)
elog(DEBUG2, "using order crossover [OX1]"); ereport(DEBUG2,
(errmsg_internal("using order crossover [OX1]")));
/* allocate city table memory */ /* allocate city table memory */
kid = alloc_chromo(pool->string_length); kid = alloc_chromo(pool->string_length);
city_table = alloc_city_table(pool->string_length); city_table = alloc_city_table(pool->string_length);
#elif defined(OX2) #elif defined(OX2)
elog(DEBUG2, "using order crossover [OX2]"); ereport(DEBUG2,
(errmsg_internal("using order crossover [OX2]")));
/* allocate city table memory */ /* allocate city table memory */
kid = alloc_chromo(pool->string_length); kid = alloc_chromo(pool->string_length);
city_table = alloc_city_table(pool->string_length); city_table = alloc_city_table(pool->string_length);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.340 2003/08/04 02:40:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.341 2003/08/12 18:23:20 tgl Exp $
* *
* NOTES * NOTES
* *
...@@ -654,11 +654,16 @@ PostmasterMain(int argc, char *argv[]) ...@@ -654,11 +654,16 @@ PostmasterMain(int argc, char *argv[])
extern char **environ; extern char **environ;
char **p; char **p;
elog(DEBUG3, "%s: PostmasterMain: initial environ dump:", progname); ereport(DEBUG3,
elog(DEBUG3, "-----------------------------------------"); (errmsg_internal("%s: PostmasterMain: initial environ dump:",
progname)));
ereport(DEBUG3,
(errmsg_internal("-----------------------------------------")));
for (p = environ; *p; ++p) for (p = environ; *p; ++p)
elog(DEBUG3, "\t%s", *p); ereport(DEBUG3,
elog(DEBUG3, "-----------------------------------------"); (errmsg_internal("\t%s", *p)));
ereport(DEBUG3,
(errmsg_internal("-----------------------------------------")));
} }
/* /*
...@@ -1468,8 +1473,9 @@ processCancelRequest(Port *port, void *pkt) ...@@ -1468,8 +1473,9 @@ processCancelRequest(Port *port, void *pkt)
if (backendPID == CheckPointPID) if (backendPID == CheckPointPID)
{ {
elog(DEBUG2, "ignoring cancel request for checkpoint process %d", ereport(DEBUG2,
backendPID); (errmsg_internal("ignoring cancel request for checkpoint process %d",
backendPID)));
return; return;
} }
else if (ExecBackend) else if (ExecBackend)
...@@ -1485,20 +1491,24 @@ processCancelRequest(Port *port, void *pkt) ...@@ -1485,20 +1491,24 @@ processCancelRequest(Port *port, void *pkt)
if (bp->cancel_key == cancelAuthCode) if (bp->cancel_key == cancelAuthCode)
{ {
/* Found a match; signal that backend to cancel current op */ /* Found a match; signal that backend to cancel current op */
elog(DEBUG2, "processing cancel request: sending SIGINT to process %d", ereport(DEBUG2,
backendPID); (errmsg_internal("processing cancel request: sending SIGINT to process %d",
backendPID)));
kill(bp->pid, SIGINT); kill(bp->pid, SIGINT);
} }
else else
/* Right PID, wrong key: no way, Jose */ /* Right PID, wrong key: no way, Jose */
elog(DEBUG2, "bad key in cancel request for process %d", ereport(DEBUG2,
backendPID); (errmsg_internal("bad key in cancel request for process %d",
backendPID)));
return; return;
} }
} }
/* No matching backend */ /* No matching backend */
elog(DEBUG2, "bad pid in cancel request for process %d", backendPID); ereport(DEBUG2,
(errmsg_internal("bad pid in cancel request for process %d",
backendPID)));
} }
/* /*
...@@ -1669,7 +1679,9 @@ pmdie(SIGNAL_ARGS) ...@@ -1669,7 +1679,9 @@ pmdie(SIGNAL_ARGS)
PG_SETMASK(&BlockSig); PG_SETMASK(&BlockSig);
elog(DEBUG2, "postmaster received signal %d", postgres_signal_arg); ereport(DEBUG2,
(errmsg_internal("postmaster received signal %d",
postgres_signal_arg)));
switch (postgres_signal_arg) switch (postgres_signal_arg)
{ {
...@@ -1797,7 +1809,8 @@ reaper(SIGNAL_ARGS) ...@@ -1797,7 +1809,8 @@ reaper(SIGNAL_ARGS)
PG_SETMASK(&BlockSig); PG_SETMASK(&BlockSig);
elog(DEBUG4, "reaping dead processes"); ereport(DEBUG4,
(errmsg_internal("reaping dead processes")));
#ifdef HAVE_WAITPID #ifdef HAVE_WAITPID
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
{ {
...@@ -2007,8 +2020,10 @@ CleanupProc(int pid, ...@@ -2007,8 +2020,10 @@ CleanupProc(int pid,
*/ */
if (!FatalError) if (!FatalError)
{ {
elog(DEBUG2, "sending %s to process %d", ereport(DEBUG2,
(SendStop ? "SIGSTOP" : "SIGQUIT"), (int) bp->pid); (errmsg_internal("sending %s to process %d",
(SendStop ? "SIGSTOP" : "SIGQUIT"),
(int) bp->pid)));
kill(bp->pid, (SendStop ? SIGSTOP : SIGQUIT)); kill(bp->pid, (SendStop ? SIGSTOP : SIGQUIT));
} }
} }
...@@ -2093,8 +2108,10 @@ SignalChildren(int signal) ...@@ -2093,8 +2108,10 @@ SignalChildren(int signal)
if (bp->pid != MyProcPid) if (bp->pid != MyProcPid)
{ {
elog(DEBUG2, "sending signal %d to process %d", ereport(DEBUG2,
signal, (int) bp->pid); (errmsg_internal("sending signal %d to process %d",
signal,
(int) bp->pid)));
kill(bp->pid, signal); kill(bp->pid, signal);
} }
...@@ -2207,8 +2224,9 @@ BackendStartup(Port *port) ...@@ -2207,8 +2224,9 @@ BackendStartup(Port *port)
} }
/* in parent, normal */ /* in parent, normal */
elog(DEBUG2, "forked new backend, pid=%d socket=%d", ereport(DEBUG2,
(int) pid, port->sock); (errmsg_internal("forked new backend, pid=%d socket=%d",
(int) pid, port->sock)));
/* /*
* Everything's been successful, it's safe to add this backend to our * Everything's been successful, it's safe to add this backend to our
...@@ -2525,10 +2543,14 @@ BackendFork(Port *port) ...@@ -2525,10 +2543,14 @@ BackendFork(Port *port)
/* /*
* Debug: print arguments being passed to backend * Debug: print arguments being passed to backend
*/ */
elog(DEBUG3, "%s child[%d]: starting with (", progname, MyProcPid); ereport(DEBUG3,
(errmsg_internal("%s child[%d]: starting with (",
progname, MyProcPid)));
for (i = 0; i < ac; ++i) for (i = 0; i < ac; ++i)
elog(DEBUG3, "\t%s", av[i]); ereport(DEBUG3,
elog(DEBUG3, ")"); (errmsg_internal("\t%s", av[i])));
ereport(DEBUG3,
(errmsg_internal(")")));
ClientAuthInProgress = false; /* client_min_messages is active ClientAuthInProgress = false; /* client_min_messages is active
* now */ * now */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.357 2003/08/06 17:46:45 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.358 2003/08/12 18:23:21 tgl Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -1730,7 +1730,8 @@ start_xact_command(void) ...@@ -1730,7 +1730,8 @@ start_xact_command(void)
{ {
if (!xact_started) if (!xact_started)
{ {
elog(DEBUG3, "StartTransactionCommand"); ereport(DEBUG3,
(errmsg_internal("StartTransactionCommand")));
StartTransactionCommand(); StartTransactionCommand();
/* Set statement timeout running, if any */ /* Set statement timeout running, if any */
...@@ -1753,7 +1754,8 @@ finish_xact_command(void) ...@@ -1753,7 +1754,8 @@ finish_xact_command(void)
disable_sig_alarm(true); disable_sig_alarm(true);
/* Now commit the command */ /* Now commit the command */
elog(DEBUG3, "CommitTransactionCommand"); ereport(DEBUG3,
(errmsg_internal("CommitTransactionCommand")));
CommitTransactionCommand(); CommitTransactionCommand();
...@@ -2620,7 +2622,8 @@ PostgresMain(int argc, char *argv[], const char *username) ...@@ -2620,7 +2622,8 @@ PostgresMain(int argc, char *argv[], const char *username)
* putting it inside InitPostgres() instead. In particular, anything * putting it inside InitPostgres() instead. In particular, anything
* that involves database access should be there, not here. * that involves database access should be there, not here.
*/ */
elog(DEBUG3, "InitPostgres"); ereport(DEBUG3,
(errmsg_internal("InitPostgres")));
InitPostgres(dbname, username); InitPostgres(dbname, username);
SetProcessingMode(NormalProcessing); SetProcessingMode(NormalProcessing);
...@@ -2643,7 +2646,7 @@ PostgresMain(int argc, char *argv[], const char *username) ...@@ -2643,7 +2646,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface "); puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.357 $ $Date: 2003/08/06 17:46:45 $\n"); puts("$Revision: 1.358 $ $Date: 2003/08/12 18:23:21 $\n");
} }
/* /*
...@@ -2702,7 +2705,8 @@ PostgresMain(int argc, char *argv[], const char *username) ...@@ -2702,7 +2705,8 @@ PostgresMain(int argc, char *argv[], const char *username)
MemoryContextSwitchTo(ErrorContext); MemoryContextSwitchTo(ErrorContext);
/* Do the recovery */ /* Do the recovery */
elog(DEBUG2, "AbortCurrentTransaction"); ereport(DEBUG2,
(errmsg_internal("AbortCurrentTransaction")));
AbortCurrentTransaction(); AbortCurrentTransaction();
/* /*
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.71 2003/08/06 17:46:46 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.72 2003/08/12 18:23:21 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -723,7 +723,8 @@ PortalRunUtility(Portal portal, Query *query, ...@@ -723,7 +723,8 @@ PortalRunUtility(Portal portal, Query *query,
{ {
Node *utilityStmt = query->utilityStmt; Node *utilityStmt = query->utilityStmt;
elog(DEBUG3, "ProcessUtility"); ereport(DEBUG3,
(errmsg_internal("ProcessUtility")));
/* /*
* Set snapshot if utility stmt needs one. Most reliable way to do * Set snapshot if utility stmt needs one. Most reliable way to do
...@@ -827,7 +828,8 @@ PortalRunMulti(Portal portal, ...@@ -827,7 +828,8 @@ PortalRunMulti(Portal portal,
/* /*
* process a plannable query. * process a plannable query.
*/ */
elog(DEBUG3, "ProcessQuery"); ereport(DEBUG3,
(errmsg_internal("ProcessQuery")));
/* Must always set snapshot for plannable queries */ /* Must always set snapshot for plannable queries */
SetQuerySnapshot(); SetQuerySnapshot();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment