[HACKERS] trace package (for 970601) - Mailing list pgsql-hackers

From Massimo Dal Zotto
Subject [HACKERS] trace package (for 970601)
Date
Msg-id 3677b17090618a89fdda817c4f77916e
Whole thread Raw
List pgsql-hackers
Hi,

I have written some patches which add timestamps and backend pid to all
messages written to the backend log, for example:

970601.10:16:20.955 [17982] StartTransactionCommand
970601.10:16:20.956 [17982] query: select * from test;
970601.10:16:20.957 [17982] ProcessQuery
970601.10:16:20.960 [17982] CommitTransactionCommand

This improves the readability of the log file when there are many backends
writing on the same file.
In addition to that I added a new option -T which can set/reset individual
trace flags for various kind of traces. The idea is that instead of using
many switches and many different trace functions written by different people
we can use a single switch to set any number of trace flags and a unique
trace function to print messages only if one particular flag is set.
For example to add a new trace flag I need only to add two lines in trace.h
and trace.c:

/* add TRACE_MYFUNC to enum trace_opts in trace.h */
/* add "myfunc" to array trace_names[] in trace.c */

and then use the following code in my files:

#include "utils/trace.h"
#define MyTraceFlag trace_flags[TRACE_MYFUNC];
if (MyTraceFlag) trace_print(TRACE_MYFUNC, "fmt", args...);

The flag can be set together with other flags using the backend option:

  -T "debug,locks+,query-,myfunc=1,other=123"

The same switch can be used to set the value of any other integer variable
of postgres without the need to add it to the parser, for example GEQO_RELS
if it were defined as trace_flags[PARM_GEQO_RELS] instead of a constant.

I defined also a global flag TRACE_ALL which can enable/disable all the trace
output overriding all the individual settings.

This patch (for 070601) should be 'mostly harmless' because it affects only
the debugging output, so it could be applied to 6.1, if it is not too late.

*** src/backend/utils/misc/Makefile.orig    Wed Nov  6 12:01:36 1996
- --- src/backend/utils/misc/Makefile    Sun Jun  1 19:52:52 1997
***************
*** 16,22 ****

  CFLAGS += $(INCLUDE_OPT)

! OBJS = superuser.o

  all: SUBSYS.o

- --- 16,22 ----

  CFLAGS += $(INCLUDE_OPT)

! OBJS = superuser.o trace.o

  all: SUBSYS.o

*** src/include/utils/trace.h.orig    Sun Jun  1 23:17:14 1997
- --- src/include/utils/trace.h    Sun Jun  1 23:17:14 1997
***************
*** 0 ****
- --- 1,40 ----
+ #include <stdio.h>
+ #include <string.h>
+ #include <time.h>
+ #include <stdarg.h>
+
+ #include "postgres.h"
+
+ #ifndef ELOG_TIMESTAMPS
+ #define ELOG_TIMESTAMPS
+ #endif
+
+ #define TRACE_TIMESTAMP_SIZE 28
+
+ extern int trace_print(int flag, const char *fmt, ...);
+ extern int trace_flag(int flag);
+ extern int set_trace_flag(int flag, int value);
+ extern void trace_parse(char *str);
+ char *trace_timestamp(void);
+
+ /*
+  * Trace options, used as index into trace_flags.
+  * Must match the constants in trace_flags[].
+  */
+ enum trace_opts {
+     TRACE_ALL,        /* 0=trace enabled ones, +1=trace all, -1=trace none */
+     TRACE_VERBOSE,
+     TRACE_QUERY,
+     TRACE_PLAN,
+     TRACE_PARSE,
+     TRACE_REWRITTEN,
+     TRACE_PARSERSTATS,
+     TRACE_PLANNERSTATS,
+     TRACE_EXECUTORSTATS,
+     TRACE_LOCKS,
+     TRACE_MALLOC,
+     TRACE_PALLOC,
+     N_TRACE_OPTS    /* must be the last item in enum */
+ };
+
+ extern int trace_flags[N_TRACE_OPTS];
*** src/backend/utils/misc/trace.c.orig    Mon Jun  2 00:22:35 1997
- --- src/backend/utils/misc/trace.c    Sun Jun  1 23:45:00 1997
***************
*** 0 ****
- --- 1,154 ----
+ #include <stdio.h>
+ #include <string.h>
+ #include <time.h>
+ #include <stdarg.h>
+
+ #include "postgres.h"
+ #include "miscadmin.h"
+ #include "utils/trace.h"
+
+ /*
+  * Trace option names, must match the constants in trace_opts[].
+  */
+ static char *trace_names[] = {
+     "all",
+     "verbose",
+     "query",
+     "plan",
+     "parse",
+     "rewritten",
+     "parserstats",
+     "plannerstats",
+     "executorstats",
+     "locks",
+     "malloc",
+     "palloc"
+ };
+
+ /*
+  * Array of trace flags which can be set or reset independently.
+  */
+ int trace_flags[N_TRACE_OPTS] = { 0 };
+
+ /*
+  * Print a timestamp and a message to stdout if the trace flag
+  * indexed by the flag value is set.
+  */
+ int
+ trace_print(int flag, const char *fmt, ... )
+ {
+     va_list ap;
+     char line[ELOG_MAXLEN];
+
+     if ((flag == TRACE_ALL) || (trace_flags[TRACE_ALL] > 0)) {
+     /* uconditional trace or trace all */
+     } else if (trace_flags[TRACE_ALL] == 0) {
+     if ((flag < 0) || (flag >= N_TRACE_OPTS) || (!trace_flags[flag])) {
+         return 0;
+     }
+     } else if (trace_flags[TRACE_ALL] < 0) {
+     return 0;
+     }
+
+     va_start(ap, fmt);
+     strcpy(line, trace_timestamp());
+     vsprintf(line+TRACE_TIMESTAMP_SIZE, fmt, ap);
+     va_end(ap);
+     puts(line);
+     fflush(stdout);
+     return 1;
+ }
+
+ int
+ trace_flag(int flag)
+ {
+     if ((flag < 0) || (flag >= N_TRACE_OPTS)) {
+     return -1;
+     }
+     return trace_flags[flag];
+ }
+
+ int
+ set_trace_flag(int flag, int value)
+ {
+     if ((flag < 0) || (flag >= N_TRACE_OPTS)) {
+     return -1;
+     }
+
+     trace_flags[flag] = value;
+     return value;
+ }
+
+ /*
+  * Parse a parameter string like "name,name+,name-,name=value".
+  */
+ void
+ trace_parse(char *str)
+ {
+     char *s, *name;
+     int i, len, val;
+
+     Assert((sizeof(trace_names)/sizeof(char*)) == N_TRACE_OPTS);
+
+     for (s=str; *s;) {
+     name = s;
+     val  = 1;
+     for (; *s; s++) {
+         switch (*s) {
+           case '=':
+         *s++ = '\0';
+         val = strtol(s, &s, 10);
+         goto setval;
+           case '-':
+         *s++ = '\0';
+         val = 0;
+         goto setval;
+           case '+':
+         *s++ = '\0';
+         val = 1;
+         goto setval;
+           case ',':
+         val = 1;
+         goto setval;
+         }
+     }
+       setval:
+     for (; *s; s++) {
+         if (*s == ',') {
+         *s++ = '\0';
+         break;
+         }
+     }
+     len = strlen(name);
+     for (i=0; i<N_TRACE_OPTS; i++) {
+         if (strncmp(name, trace_names[i], len) == 0) {
+         trace_flags[i] = val;
+         break;
+         }
+     }
+     if (i >= N_TRACE_OPTS) {
+         fprintf(stderr, "invalid trace option: %s\n", name);
+     }
+     }
+ }
+
+ char *
+ trace_timestamp()
+ {
+     struct timeval    tv;
+     struct tm        *time;
+     time_t        tm;
+     static char        result[32], pid[8];
+
+     gettimeofday(&tv, DST_NONE);
+     tm = tv.tv_sec;
+     time = localtime(&tm);
+
+     sprintf(pid, "[%d]", MasterPid);
+     sprintf(result, "%02d%02d%02d.%02d:%02d:%02d.%03d %7s ",
+         time->tm_year, time->tm_mon+1, time->tm_mday,
+         time->tm_hour, time->tm_min, time->tm_sec,
+         tv.tv_usec/1000, pid);
+
+     return result;
+ }
*** src/backend/utils/error/elog.c.orig    Wed Mar 19 00:01:14 1997
- --- src/backend/utils/error/elog.c    Sun Jun  1 23:54:43 1997
***************
*** 28,33 ****
- --- 28,34 ----
  #include "miscadmin.h"
  #include "libpq/libpq.h"
  #include "storage/proc.h"
+ #include "utils/trace.h"

  static int    Debugfile = -1;
  static int    Err_file = -1;
***************
*** 66,95 ****
      i = ElogDebugIndentLevel-1;
      if (i < 0) i = 0;
      if (i > 30) i = i%30;
!     cp = "DEBUG:";
      break;
      case DEBUG:
      i = ElogDebugIndentLevel;
      if (i < 0) i = 0;
      if (i > 30) i = i%30;
!     cp = "DEBUG:";
      break;
      case NOTICE:
!     cp = "NOTICE:";
      break;
      case WARN:
!     cp = "WARN:";
      break;
      default:
      sprintf(line, "FATAL %d:", lev);
      cp = line;
      }
  #ifdef ELOG_TIMESTAMPS
      time(&tim);
      strcat(strcpy(buf, cp), ctime(&tim)+4);
      bp = buf+strlen(buf)-6;
      *bp++ = ':';
  #else
      strcpy(buf,cp);
      bp = buf+strlen(buf);
  #endif
- --- 67,102 ----
      i = ElogDebugIndentLevel-1;
      if (i < 0) i = 0;
      if (i > 30) i = i%30;
!     cp = "DEBUG: ";
      break;
      case DEBUG:
      i = ElogDebugIndentLevel;
      if (i < 0) i = 0;
      if (i > 30) i = i%30;
!     cp = "DEBUG: ";
      break;
      case NOTICE:
!     cp = "NOTICE: ";
      break;
      case WARN:
!     cp = "WARN: ";
      break;
      default:
      sprintf(line, "FATAL %d:", lev);
      cp = line;
      }
  #ifdef ELOG_TIMESTAMPS
+ #if 0
      time(&tim);
      strcat(strcpy(buf, cp), ctime(&tim)+4);
      bp = buf+strlen(buf)-6;
      *bp++ = ':';
  #else
+     strcpy(buf, trace_timestamp());
+     strcat(buf, cp);
+     bp = buf+strlen(buf);
+ #endif
+ #else
      strcpy(buf,cp);
      bp = buf+strlen(buf);
  #endif
***************
*** 143,149 ****
- --- 150,160 ----
      else
          pq_putnchar("E", 1);
      /* pq_putint(-101, 4);*/    /* should be query id */
+ #ifdef ELOG_TIMESTAMPS
+     pq_putstr(line+TRACE_TIMESTAMP_SIZE); /* don't show timestamps */
+ #else
      pq_putstr(line);
+ #endif
      pq_flush();
      }
  #endif /* !PG_STANDALONE */
*** src/backend/tcop/postgres.c.orig    Thu Apr 24 06:01:21 1997
- --- src/backend/tcop/postgres.c    Mon Jun  2 00:07:32 1997
***************
*** 80,98 ****
  #include "libpq/pqsignal.h"
  #include "rewrite/rewriteHandler.h" /* for QueryRewrite() */

  /* ----------------
   *      global variables
   * ----------------
   */
- - static bool     DebugPrintQuery = false;
- - static bool     DebugPrintPlan = false;
- - static bool     DebugPrintParse = false;
- - static bool     DebugPrintRewrittenParsetree = false;
  /*static bool   EnableRewrite = true; , never changes why have it*/
  CommandDest whereToSendOutput;

  #ifdef LOCK_MGR_DEBUG
! extern int      lockDebug;
  #endif
  extern int      lockingOff;
  extern int      NBuffers;
- --- 80,108 ----
  #include "libpq/pqsignal.h"
  #include "rewrite/rewriteHandler.h" /* for QueryRewrite() */

+ #include "utils/trace.h"
+
+ /*
+  * Trace flags, see backend/utils/misc/trace.c
+  */
+ #define Verbose           trace_flags[TRACE_VERBOSE]
+ #define DebugPrintQuery   trace_flags[TRACE_QUERY]
+ #define DebugPrintPlan    trace_flags[TRACE_PLAN]
+ #define DebugPrintParse   trace_flags[TRACE_PARSE]
+ #define ShowParserStats   trace_flags[TRACE_PARSERSTATS]
+ #define ShowPlannerStats  trace_flags[TRACE_PLANNERSTATS]
+ #define ShowExecutorStats trace_flags[TRACE_EXECUTORSTATS]
+ #define DebugPrintRewrittenParsetree trace_flags[TRACE_REWRITTEN]
+
  /* ----------------
   *      global variables
   * ----------------
   */
  /*static bool   EnableRewrite = true; , never changes why have it*/
  CommandDest whereToSendOutput;

  #ifdef LOCK_MGR_DEBUG
! #define lockDebug trace_flags[TRACE_LOCKS]
  #endif
  extern int      lockingOff;
  extern int      NBuffers;
***************
*** 119,127 ****
  static int      EchoQuery = 0;          /* default don't echo */
  time_t          tim;
  char            pg_pathname[256];
- - static int      ShowParserStats;
- - static int      ShowPlannerStats;
- - int             ShowExecutorStats;
  FILE            *StatFp;

  typedef struct frontend {
- --- 129,134 ----
***************
*** 245,251 ****
          }

          if (end) {
!             if (!Quiet) puts("EOF");
              IsEmptyQuery = true;
              exitpg(0);
          }
- --- 252,258 ----
          }

          if (end) {
!             if (Verbose) puts("EOF");
              IsEmptyQuery = true;
              exitpg(0);
          }
***************
*** 262,268 ****
       * ----------------
       */
      if (EchoQuery)
!         printf("query is: %s\n", inBuf);

      return('Q');
  }
- --- 269,275 ----
       * ----------------
       */
      if (EchoQuery)
!         printf("query: %s\n", inBuf);

      return('Q');
  }
***************
*** 410,425 ****
              continue;
          }

!         if ( DebugPrintQuery == true ) {
!             printf("\n---- \tquery is:\n%s\n",query_string);
!             printf("\n");
!         fflush(stdout);
          }

!         if ( DebugPrintParse == true ) {
!             printf("\n---- \tparser outputs :\n");
              nodeDisplay(querytree);
- -             printf("\n");
          }

          /* rewrite queries (retrieve, append, delete, replace) */
- --- 417,429 ----
              continue;
          }

!         if ( DebugPrintQuery ) {
!             trace_print(TRACE_QUERY, "query: %s",query_string);
          }

!         if ( DebugPrintParse ) {
!             trace_print(TRACE_PARSE, "parser outputs:");
              nodeDisplay(querytree);
          }

          /* rewrite queries (retrieve, append, delete, replace) */
***************
*** 491,502 ****
          plan_archive(rt);
      }

!     if (DebugPrintRewrittenParsetree == true) {
!         printf("\n---- \tafter rewriting:\n");
!
          for (i=0; i<querytree_list->len; i++) {
              print(querytree_list->qtrees[i]);
- -             printf("\n");
          }
      }

- --- 495,504 ----
          plan_archive(rt);
      }

!     if (DebugPrintRewrittenParsetree) {
!         trace_print(TRACE_REWRITTEN, "after rewriting:");
          for (i=0; i<querytree_list->len; i++) {
              print(querytree_list->qtrees[i]);
          }
      }

***************
*** 529,535 ****
              if (ShowPlannerStats) ResetUsage();
              plan = planner(querytree);
              if (ShowPlannerStats) {
!                 fprintf(stderr, "! Planner Stats:\n");
                  ShowUsage();
              }
              plan_list = lappend(plan_list, plan);
- --- 531,537 ----
              if (ShowPlannerStats) ResetUsage();
              plan = planner(querytree);
              if (ShowPlannerStats) {
!         fprintf(stderr, "! Planner Stats:\n");
                  ShowUsage();
              }
              plan_list = lappend(plan_list, plan);
***************
*** 540,549 ****
               *  also for queries in functions.  DZ - 27-8-1996
               * ----------------
               */
!             if ( DebugPrintPlan == true ) {
!                 printf("\n---- \tplan is :\n");
                  nodeDisplay(plan);
- -                 printf("\n");
              }
  #endif
          }
- --- 542,550 ----
               *  also for queries in functions.  DZ - 27-8-1996
               * ----------------
               */
!             if ( DebugPrintPlan ) {
!                 trace_print(TRACE_PLAN, "plan:");
                  nodeDisplay(plan);
              }
  #endif
          }
***************
*** 627,635 ****
               *   because that is done in ProcessUtility.
               * ----------------
               */
!             if (! Quiet) {
!                 time(&tim);
!                 printf("\tProcessUtility() at %s\n", ctime(&tim));
              }

              ProcessUtility(querytree->utilityStmt, dest);
- --- 628,635 ----
               *   because that is done in ProcessUtility.
               * ----------------
               */
!             if (Verbose) {
!         trace_print(TRACE_VERBOSE, "ProcessUtility");
              }

              ProcessUtility(querytree->utilityStmt, dest);
***************
*** 652,661 ****
               *  print plan if debugging
               * ----------------
               */
!             if ( DebugPrintPlan == true ) {
!                 printf("\n---- plan is :\n");
                  nodeDisplay(plan);
- -                 printf("\n");
              }
  #endif

- --- 652,660 ----
               *  print plan if debugging
               * ----------------
               */
!             if ( DebugPrintPlan ) {
!                 trace_print(TRACE_PLAN, "plan:");
                  nodeDisplay(plan);
              }
  #endif

***************
*** 667,681 ****
                  ResetUsage();

              for (j = 0; j < _exec_repeat_; j++) {
!                 if (! Quiet) {
!                     time(&tim);
!                     printf("\tProcessQuery() at %s\n", ctime(&tim));
                  }
                  ProcessQuery(querytree, plan, argv, typev, nargs, dest);
              }

              if (ShowExecutorStats) {
!                 fprintf(stderr, "! Executor Stats:\n");
                  ShowUsage();
              }
          }
- --- 666,679 ----
                  ResetUsage();

              for (j = 0; j < _exec_repeat_; j++) {
!                 if (Verbose) {
!             trace_print(TRACE_VERBOSE, "ProcessQuery");
                  }
                  ProcessQuery(querytree, plan, argv, typev, nargs, dest);
              }

              if (ShowExecutorStats) {
!         fprintf(stderr, "! Executor Stats:\n");
                  ShowUsage();
              }
          }
***************
*** 864,870 ****
      DataDir = getenv("PGDATA");   /* default */
      multiplexedBackend = false;   /* default */

!     while ((flag = getopt(argc, argv, "A:B:bCD:d:Eef:iK:Lm:MNo:P:pQSst:x:F"))
             != EOF)
          switch (flag) {

- --- 862,868 ----
      DataDir = getenv("PGDATA");   /* default */
      multiplexedBackend = false;   /* default */

!     while ((flag = getopt(argc,argv,"A:B:bCD:d:Eef:iK:Lm:MNo:P:pQSst:x:FT:"))
             != EOF)
          switch (flag) {

***************
*** 909,914 ****
- --- 907,913 ----

          case 'd':   /* debug level */
              flagQ = 0;
+         Verbose = 1;
              DebugLvl = (short)atoi(optarg);
              if (DebugLvl > 1)
              DebugPrintQuery = true;
***************
*** 1043,1048 ****
- --- 1042,1048 ----
               * ----------------
               */
              flagQ = 1;
+         Verbose = 0;
              break;

          case 'S':
***************
*** 1089,1094 ****
- --- 1089,1098 ----
              }
              break;

+         case 'T':
+         trace_parse(optarg);
+             break;
+
          case 'x':
  #if 0 /* planner/xfunc.h */
              /* control joey hellerstein's expensive function optimization */
***************
*** 1163,1169 ****
      }

      Noversion = flagC;
- -     Quiet = flagQ;
      EchoQuery = flagE;
      EuroDates = flagEu;

- --- 1167,1172 ----
***************
*** 1171,1189 ****
       *  print flags
       * ----------------
       */
!     if (! Quiet) {
!         puts("\t---debug info---");
!         printf("\tQuiet =        %c\n", Quiet     ? 't' : 'f');
!         printf("\tNoversion =    %c\n", Noversion ? 't' : 'f');
!         printf("\tstable    =    %c\n", flagS     ? 't' : 'f');
!         printf("\ttimings   =    %c\n", ShowStats ? 't' : 'f');
!         printf("\tdates     =    %s\n", EuroDates ? "European" : "Normal");
!         printf("\tbufsize   =    %d\n", NBuffers);
!
!         printf("\tquery echo =   %c\n", EchoQuery ? 't' : 'f');
!         printf("\tmultiplexed backend? =  %c\n", multiplexedBackend ? 't' : 'f');
!         printf("\tDatabaseName = [%s]\n", DBName);
!         puts("\t----------------\n");
      }

      /* ----------------
- --- 1174,1190 ----
       *  print flags
       * ----------------
       */
!     if (Verbose) {
!     trace_print(TRACE_VERBOSE, "debug info:");
!         printf("\tVerbose      = %c\n", Verbose   ? 't' : 'f');
!         printf("\tNoversion    = %c\n", Noversion ? 't' : 'f');
!         printf("\tstable       = %c\n", flagS     ? 't' : 'f');
!         printf("\ttimings      = %c\n", ShowStats ? 't' : 'f');
!         printf("\tdates        = %s\n", EuroDates ? "European" : "Normal");
!         printf("\tbufsize      = %d\n", NBuffers);
!         printf("\tquery echo   = %c\n", EchoQuery ? 't' : 'f');
!         printf("\tmultiplexed  = %c\n", multiplexedBackend ? 't' : 'f');
!         printf("\tDatabaseName = %s\n", DBName);
      }

      /* ----------------
***************
*** 1246,1253 ****
      SetProcessingMode(InitProcessing);

      /* initialize */
!     if (! Quiet) {
!         puts("\tInitPostgres()..");
      }

      InitPostgres(DBName);
- --- 1247,1254 ----
      SetProcessingMode(InitProcessing);

      /* initialize */
!     if (Verbose) {
!         trace_print(TRACE_VERBOSE, "InitPostgres");
      }

      InitPostgres(DBName);
***************
*** 1271,1278 ****

          time(&tim);

!         if (! Quiet)
!             printf("\tAbortCurrentTransaction() at %s\n", ctime(&tim));

          memset(parser_input, 0, MAX_PARSE_BUFFER);

- --- 1272,1280 ----

          time(&tim);

!         if (Verbose) {
!         trace_print(TRACE_VERBOSE, "AbortCurrentTransaction");
!     }

          memset(parser_input, 0, MAX_PARSE_BUFFER);

***************
*** 1395,1403 ****
              IsEmptyQuery = false;

              /* start an xact for this function invocation */
!             if (! Quiet) {
!                 time(&tim);
!                 printf("\tStartTransactionCommand() at %s\n", ctime(&tim));
              }

              StartTransactionCommand();
- --- 1397,1404 ----
              IsEmptyQuery = false;

              /* start an xact for this function invocation */
!             if (Verbose) {
!         trace_print(TRACE_VERBOSE, "StartTransactionCommand");
              }

              StartTransactionCommand();
***************
*** 1428,1436 ****
                      ResetUsage();

                  /* start an xact for this query */
!                 if (! Quiet) {
!                     time(&tim);
!                     printf("\tStartTransactionCommand() at %s\n", ctime(&tim));
                  }
                  StartTransactionCommand();

- --- 1429,1436 ----
                      ResetUsage();

                  /* start an xact for this query */
!                 if (Verbose) {
!             trace_print(TRACE_VERBOSE, "StartTransactionCommand");
                  }
                  StartTransactionCommand();

***************
*** 1467,1475 ****
           * ----------------
           */
          if (! IsEmptyQuery) {
!             if (! Quiet) {
!                 time(&tim);
!                 printf("\tCommitTransactionCommand() at %s\n", ctime(&tim));
              }
              CommitTransactionCommand();

- --- 1467,1474 ----
           * ----------------
           */
          if (! IsEmptyQuery) {
!             if (Verbose) {
!         trace_print(TRACE_VERBOSE, "CommitTransactionCommand");
              }
              CommitTransactionCommand();

***************
*** 1591,1596 ****
- --- 1590,1596 ----
      return val;
  }

+ int
  assertTest(int val)
  {
      Assert(val == 0);
*** src/backend/storage/ipc/ipc.c.orig    Wed Jan  8 12:01:06 1997
- --- src/backend/storage/ipc/ipc.c    Sun Jun  1 23:22:11 1997
***************
*** 37,42 ****
- --- 37,43 ----
  #include <sys/sem.h>
  #include <sys/shm.h>
  #include "utils/memutils.h"
+ #include "utils/trace.h"

  #if defined(sparc_solaris)
  #include <string.h>
***************
*** 122,127 ****
- --- 123,130 ----

      exitpg_inprogress = 1;

+     trace_print(TRACE_VERBOSE, "exitpg");
+
      /* ----------------
       *    call all the callbacks registered before calling exit().
       * ----------------
*** src/backend/parser/scan.l.orig    Sun Mar  2 06:00:43 1997
- --- src/backend/parser/scan.l    Mon Jun  2 00:13:59 1997
***************
*** 116,122 ****
          errno = 0;
          yylval.dval = strtod(((char *)yytext),&endptr);
          if (*endptr != '\0' || errno == ERANGE)
!             elog(WARN,"\tBad float8 input format\n");
          CheckFloat8Val(yylval.dval);
          return (FCONST);
          }
- --- 116,122 ----
          errno = 0;
          yylval.dval = strtod(((char *)yytext),&endptr);
          if (*endptr != '\0' || errno == ERANGE)
!             elog(WARN,"Bad float8 input format");
          CheckFloat8Val(yylval.dval);
          return (FCONST);
          }
***************
*** 187,193 ****

  void yyerror(char message[])
  {
!     elog(WARN, "parser: %s at or near \"%s\"\n", message, yytext);
  }

  int yywrap()
- --- 187,193 ----

  void yyerror(char message[])
  {
!     elog(WARN, "parser: %s at or near \"%s\"", message, yytext);
  }

  int yywrap()
*** src/backend/access/nbtree/nbtree.c.orig    Mon May  5 06:00:22 1997
- --- src/backend/access/nbtree/nbtree.c    Mon Jun  2 00:05:37 1997
***************
*** 35,41 ****

  #ifdef BTREE_BUILD_STATS
  #include <tcop/tcopprot.h>
! extern int ShowExecutorStats;
  #endif


- --- 35,42 ----

  #ifdef BTREE_BUILD_STATS
  #include <tcop/tcopprot.h>
! #include <utils/trace.h>
! #define ShowExecutorStats trace_flags[TRACE_EXECUTORSTATS]
  #endif


*** src/backend/access/nbtree/nbtsort.c.orig    Sat May 31 00:00:22 1997
- --- src/backend/access/nbtree/nbtsort.c    Mon Jun  2 00:05:25 1997
***************
*** 65,71 ****

  #ifdef BTREE_BUILD_STATS
  #include <tcop/tcopprot.h>
! extern int ShowExecutorStats;
  #endif

  /*
- --- 65,72 ----

  #ifdef BTREE_BUILD_STATS
  #include <tcop/tcopprot.h>
! #include <utils/trace.h>
! #define ShowExecutorStats trace_flags[TRACE_EXECUTORSTATS]
  #endif

  /*

- --
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto                e-mail:  dz@cs.unitn.it            |
|  Via Marconi, 141                 phone/fax:  ++39-461-534251        |
|  38057 Pergine Valsugana (TN)     pgp:  finger dz@tango.cs.unitn.it  |
|  Italy                                                               |
+----------------------------------------------------------------------+

------------------------------

End of hackers-digest V1 #371
*****************************

pgsql-hackers by date:

Previous
From: Igor
Date:
Subject: Re: [HACKERS] Isn't Purify great? :)
Next
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] 6.1 issues resolved