Thread: elog cleanup

elog cleanup

From
Bruce Momjian
Date:
This patch fixes several issues with our elog() handling:

o Uniformly spaces tags so log message are indented the same amount:

    LOG:     database system was shut down at 2002-02-19 05:51:35 CET
    LOG:     checkpoint record is at 0/BF1D8AC
    LOG:     redo record is at 0/BF1D8AC; undo record is at 0/0; Shut...
    LOG:     next transaction id: 242; next oid: 866295
    LOG:     database system is ready
    ERROR:   parser: parse error at or near "asdf"

o Renames REALLYFATAL to CRASH (per Tom)

o Remove STOP and make it CRASH

o Add INFO level that prints only to the client

o Add LOG level to print messages only to the server log

o Cause VACUUM to only print to the client

o Change NOTICE to INFO when informational messages are sent.  This
mimics the behavior of syslog(3). Before we only had NOTICE.  INFO now
gives us LOG_INFO for messages like sequence creation with SERIAL:

     LOG_ALERT     A condition that should be corrected immediately, such as a
                   corrupted system database.

     LOG_CRIT      Critical conditions, e.g., hard device errors.

     LOG_ERR       Errors.

     LOG_WARNING   Warning messages.

     LOG_NOTICE    Conditions that are not error conditions, but should possi-
                   bly be handled specially.

     LOG_INFO      Informational messages.

     LOG_DEBUG     Messages that contain information normally of use only when
                   debugging a program.

o Server startup message now are labeled with LOG instead of DEBUG,
preventing confusion when people think they have debug enabled.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/backend/access/gist/gist.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/gist/gist.c,v
retrieving revision 1.88
diff -c -r1.88 gist.c
*** src/backend/access/gist/gist.c    2002/02/11 22:41:59    1.88
--- src/backend/access/gist/gist.c    2002/02/19 04:54:53
***************
*** 1953,1965 ****
  void
  gist_redo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(STOP, "gist_redo: unimplemented");
  }

  void
  gist_undo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(STOP, "gist_undo: unimplemented");
  }

  void
--- 1953,1965 ----
  void
  gist_redo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(CRASH, "gist_redo: unimplemented");
  }

  void
  gist_undo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(CRASH, "gist_undo: unimplemented");
  }

  void
Index: src/backend/access/hash/hash.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/hash/hash.c,v
retrieving revision 1.53
diff -c -r1.53 hash.c
*** src/backend/access/hash/hash.c    2001/10/25 05:49:20    1.53
--- src/backend/access/hash/hash.c    2002/02/19 04:54:53
***************
*** 468,480 ****
  void
  hash_redo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(STOP, "hash_redo: unimplemented");
  }

  void
  hash_undo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(STOP, "hash_undo: unimplemented");
  }

  void
--- 468,480 ----
  void
  hash_redo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(CRASH, "hash_redo: unimplemented");
  }

  void
  hash_undo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(CRASH, "hash_undo: unimplemented");
  }

  void
Index: src/backend/access/heap/heapam.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v
retrieving revision 1.129
diff -c -r1.129 heapam.c
*** src/backend/access/heap/heapam.c    2002/01/15 22:14:17    1.129
--- src/backend/access/heap/heapam.c    2002/02/19 04:54:55
***************
*** 1958,1968 ****

      buffer = XLogReadBuffer(false, reln, xlrec->block);
      if (!BufferIsValid(buffer))
!         elog(STOP, "heap_clean_redo: no block");

      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(STOP, "heap_clean_redo: uninitialized page");

      if (XLByteLE(lsn, PageGetLSN(page)))
      {
--- 1958,1968 ----

      buffer = XLogReadBuffer(false, reln, xlrec->block);
      if (!BufferIsValid(buffer))
!         elog(CRASH, "heap_clean_redo: no block");

      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(CRASH, "heap_clean_redo: uninitialized page");

      if (XLByteLE(lsn, PageGetLSN(page)))
      {
***************
*** 2015,2025 ****
      buffer = XLogReadBuffer(false, reln,
                          ItemPointerGetBlockNumber(&(xlrec->target.tid)));
      if (!BufferIsValid(buffer))
!         elog(STOP, "heap_delete_%sdo: no block", (redo) ? "re" : "un");

      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(STOP, "heap_delete_%sdo: uninitialized page", (redo) ? "re" : "un");

      if (redo)
      {
--- 2015,2025 ----
      buffer = XLogReadBuffer(false, reln,
                          ItemPointerGetBlockNumber(&(xlrec->target.tid)));
      if (!BufferIsValid(buffer))
!         elog(CRASH, "heap_delete_%sdo: no block", (redo) ? "re" : "un");

      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(CRASH, "heap_delete_%sdo: uninitialized page", (redo) ? "re" : "un");

      if (redo)
      {
***************
*** 2031,2044 ****
      }
      else if (XLByteLT(PageGetLSN(page), lsn))    /* changes are not applied
                                                   * ?! */
!         elog(STOP, "heap_delete_undo: bad page LSN");

      offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
      if (PageGetMaxOffsetNumber(page) >= offnum)
          lp = PageGetItemId(page, offnum);

      if (PageGetMaxOffsetNumber(page) < offnum || !ItemIdIsUsed(lp))
!         elog(STOP, "heap_delete_%sdo: invalid lp", (redo) ? "re" : "un");

      htup = (HeapTupleHeader) PageGetItem(page, lp);

--- 2031,2044 ----
      }
      else if (XLByteLT(PageGetLSN(page), lsn))    /* changes are not applied
                                                   * ?! */
!         elog(CRASH, "heap_delete_undo: bad page LSN");

      offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
      if (PageGetMaxOffsetNumber(page) >= offnum)
          lp = PageGetItemId(page, offnum);

      if (PageGetMaxOffsetNumber(page) < offnum || !ItemIdIsUsed(lp))
!         elog(CRASH, "heap_delete_%sdo: invalid lp", (redo) ? "re" : "un");

      htup = (HeapTupleHeader) PageGetItem(page, lp);

***************
*** 2054,2060 ****
          return;
      }

!     elog(STOP, "heap_delete_undo: unimplemented");
  }

  static void
--- 2054,2060 ----
          return;
      }

!     elog(CRASH, "heap_delete_undo: unimplemented");
  }

  static void
***************
*** 2080,2086 ****
      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page) &&
          (!redo || !(record->xl_info & XLOG_HEAP_INIT_PAGE)))
!         elog(STOP, "heap_insert_%sdo: uninitialized page", (redo) ? "re" : "un");

      if (redo)
      {
--- 2080,2086 ----
      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page) &&
          (!redo || !(record->xl_info & XLOG_HEAP_INIT_PAGE)))
!         elog(CRASH, "heap_insert_%sdo: uninitialized page", (redo) ? "re" : "un");

      if (redo)
      {
***************
*** 2104,2110 ****

          offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
          if (PageGetMaxOffsetNumber(page) + 1 < offnum)
!             elog(STOP, "heap_insert_redo: invalid max offset number");

          newlen = record->xl_len - SizeOfHeapInsert - SizeOfHeapHeader;
          Assert(newlen <= MaxTupleSize);
--- 2104,2110 ----

          offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
          if (PageGetMaxOffsetNumber(page) + 1 < offnum)
!             elog(CRASH, "heap_insert_redo: invalid max offset number");

          newlen = record->xl_len - SizeOfHeapInsert - SizeOfHeapHeader;
          Assert(newlen <= MaxTupleSize);
***************
*** 2128,2134 ****
          offnum = PageAddItem(page, (Item) htup, newlen, offnum,
                               LP_USED | OverwritePageMode);
          if (offnum == InvalidOffsetNumber)
!             elog(STOP, "heap_insert_redo: failed to add tuple");
          PageSetLSN(page, lsn);
          PageSetSUI(page, ThisStartUpID);        /* prev sui */
          UnlockAndWriteBuffer(buffer);
--- 2128,2134 ----
          offnum = PageAddItem(page, (Item) htup, newlen, offnum,
                               LP_USED | OverwritePageMode);
          if (offnum == InvalidOffsetNumber)
!             elog(CRASH, "heap_insert_redo: failed to add tuple");
          PageSetLSN(page, lsn);
          PageSetSUI(page, ThisStartUpID);        /* prev sui */
          UnlockAndWriteBuffer(buffer);
***************
*** 2138,2146 ****
      /* undo insert */
      if (XLByteLT(PageGetLSN(page), lsn))        /* changes are not applied
                                                   * ?! */
!         elog(STOP, "heap_insert_undo: bad page LSN");

!     elog(STOP, "heap_insert_undo: unimplemented");
  }

  /*
--- 2138,2146 ----
      /* undo insert */
      if (XLByteLT(PageGetLSN(page), lsn))        /* changes are not applied
                                                   * ?! */
!         elog(CRASH, "heap_insert_undo: bad page LSN");

!     elog(CRASH, "heap_insert_undo: unimplemented");
  }

  /*
***************
*** 2171,2181 ****
      buffer = XLogReadBuffer(false, reln,
                          ItemPointerGetBlockNumber(&(xlrec->target.tid)));
      if (!BufferIsValid(buffer))
!         elog(STOP, "heap_update_%sdo: no block", (redo) ? "re" : "un");

      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(STOP, "heap_update_%sdo: uninitialized old page", (redo) ? "re" : "un");

      if (redo)
      {
--- 2171,2181 ----
      buffer = XLogReadBuffer(false, reln,
                          ItemPointerGetBlockNumber(&(xlrec->target.tid)));
      if (!BufferIsValid(buffer))
!         elog(CRASH, "heap_update_%sdo: no block", (redo) ? "re" : "un");

      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(CRASH, "heap_update_%sdo: uninitialized old page", (redo) ? "re" : "un");

      if (redo)
      {
***************
*** 2189,2202 ****
      }
      else if (XLByteLT(PageGetLSN(page), lsn))    /* changes are not applied
                                                   * ?! */
!         elog(STOP, "heap_update_undo: bad old tuple page LSN");

      offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
      if (PageGetMaxOffsetNumber(page) >= offnum)
          lp = PageGetItemId(page, offnum);

      if (PageGetMaxOffsetNumber(page) < offnum || !ItemIdIsUsed(lp))
!         elog(STOP, "heap_update_%sdo: invalid lp", (redo) ? "re" : "un");

      htup = (HeapTupleHeader) PageGetItem(page, lp);

--- 2189,2202 ----
      }
      else if (XLByteLT(PageGetLSN(page), lsn))    /* changes are not applied
                                                   * ?! */
!         elog(CRASH, "heap_update_undo: bad old tuple page LSN");

      offnum = ItemPointerGetOffsetNumber(&(xlrec->target.tid));
      if (PageGetMaxOffsetNumber(page) >= offnum)
          lp = PageGetItemId(page, offnum);

      if (PageGetMaxOffsetNumber(page) < offnum || !ItemIdIsUsed(lp))
!         elog(CRASH, "heap_update_%sdo: invalid lp", (redo) ? "re" : "un");

      htup = (HeapTupleHeader) PageGetItem(page, lp);

***************
*** 2224,2230 ****
          goto newt;
      }

!     elog(STOP, "heap_update_undo: unimplemented");

      /* Deal with new tuple */

--- 2224,2230 ----
          goto newt;
      }

!     elog(CRASH, "heap_update_undo: unimplemented");

      /* Deal with new tuple */

***************
*** 2245,2251 ****
  newsame:;
      if (PageIsNew((PageHeader) page) &&
          (!redo || !(record->xl_info & XLOG_HEAP_INIT_PAGE)))
!         elog(STOP, "heap_update_%sdo: uninitialized page", (redo) ? "re" : "un");

      if (redo)
      {
--- 2245,2251 ----
  newsame:;
      if (PageIsNew((PageHeader) page) &&
          (!redo || !(record->xl_info & XLOG_HEAP_INIT_PAGE)))
!         elog(CRASH, "heap_update_%sdo: uninitialized page", (redo) ? "re" : "un");

      if (redo)
      {
***************
*** 2269,2275 ****

          offnum = ItemPointerGetOffsetNumber(&(xlrec->newtid));
          if (PageGetMaxOffsetNumber(page) + 1 < offnum)
!             elog(STOP, "heap_update_redo: invalid max offset number");

          hsize = SizeOfHeapUpdate + SizeOfHeapHeader;
          if (move)
--- 2269,2275 ----

          offnum = ItemPointerGetOffsetNumber(&(xlrec->newtid));
          if (PageGetMaxOffsetNumber(page) + 1 < offnum)
!             elog(CRASH, "heap_update_redo: invalid max offset number");

          hsize = SizeOfHeapUpdate + SizeOfHeapHeader;
          if (move)
***************
*** 2315,2321 ****
          offnum = PageAddItem(page, (Item) htup, newlen, offnum,
                               LP_USED | OverwritePageMode);
          if (offnum == InvalidOffsetNumber)
!             elog(STOP, "heap_update_redo: failed to add tuple");
          PageSetLSN(page, lsn);
          PageSetSUI(page, ThisStartUpID);        /* prev sui */
          UnlockAndWriteBuffer(buffer);
--- 2315,2321 ----
          offnum = PageAddItem(page, (Item) htup, newlen, offnum,
                               LP_USED | OverwritePageMode);
          if (offnum == InvalidOffsetNumber)
!             elog(CRASH, "heap_update_redo: failed to add tuple");
          PageSetLSN(page, lsn);
          PageSetSUI(page, ThisStartUpID);        /* prev sui */
          UnlockAndWriteBuffer(buffer);
***************
*** 2324,2332 ****

      /* undo */
      if (XLByteLT(PageGetLSN(page), lsn))        /* changes not applied?! */
!         elog(STOP, "heap_update_undo: bad new tuple page LSN");

!     elog(STOP, "heap_update_undo: unimplemented");

  }

--- 2324,2332 ----

      /* undo */
      if (XLByteLT(PageGetLSN(page), lsn))        /* changes not applied?! */
!         elog(CRASH, "heap_update_undo: bad new tuple page LSN");

!     elog(CRASH, "heap_update_undo: unimplemented");

  }

***************
*** 2342,2371 ****
      HeapTupleHeader htup;

      if (!RelationIsValid(reln))
!         elog(STOP, "_heap_unlock_tuple: can't open relation");

      buffer = XLogReadBuffer(false, reln,
                              ItemPointerGetBlockNumber(&(xltid->tid)));
      if (!BufferIsValid(buffer))
!         elog(STOP, "_heap_unlock_tuple: can't read buffer");

      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(STOP, "_heap_unlock_tuple: uninitialized page");

      offnum = ItemPointerGetOffsetNumber(&(xltid->tid));
      if (offnum > PageGetMaxOffsetNumber(page))
!         elog(STOP, "_heap_unlock_tuple: invalid itemid");
      lp = PageGetItemId(page, offnum);

      if (!ItemIdIsUsed(lp) || ItemIdDeleted(lp))
!         elog(STOP, "_heap_unlock_tuple: unused/deleted tuple in rollback");

      htup = (HeapTupleHeader) PageGetItem(page, lp);

      if (!TransactionIdEquals(htup->t_xmax, GetCurrentTransactionId()) ||
          htup->t_cmax != GetCurrentCommandId())
!         elog(STOP, "_heap_unlock_tuple: invalid xmax/cmax in rollback");
      htup->t_infomask &= ~HEAP_XMAX_UNLOGGED;
      htup->t_infomask |= HEAP_XMAX_INVALID;
      UnlockAndWriteBuffer(buffer);
--- 2342,2371 ----
      HeapTupleHeader htup;

      if (!RelationIsValid(reln))
!         elog(CRASH, "_heap_unlock_tuple: can't open relation");

      buffer = XLogReadBuffer(false, reln,
                              ItemPointerGetBlockNumber(&(xltid->tid)));
      if (!BufferIsValid(buffer))
!         elog(CRASH, "_heap_unlock_tuple: can't read buffer");

      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(CRASH, "_heap_unlock_tuple: uninitialized page");

      offnum = ItemPointerGetOffsetNumber(&(xltid->tid));
      if (offnum > PageGetMaxOffsetNumber(page))
!         elog(CRASH, "_heap_unlock_tuple: invalid itemid");
      lp = PageGetItemId(page, offnum);

      if (!ItemIdIsUsed(lp) || ItemIdDeleted(lp))
!         elog(CRASH, "_heap_unlock_tuple: unused/deleted tuple in rollback");

      htup = (HeapTupleHeader) PageGetItem(page, lp);

      if (!TransactionIdEquals(htup->t_xmax, GetCurrentTransactionId()) ||
          htup->t_cmax != GetCurrentCommandId())
!         elog(CRASH, "_heap_unlock_tuple: invalid xmax/cmax in rollback");
      htup->t_infomask &= ~HEAP_XMAX_UNLOGGED;
      htup->t_infomask |= HEAP_XMAX_INVALID;
      UnlockAndWriteBuffer(buffer);
***************
*** 2389,2395 ****
      else if (info == XLOG_HEAP_CLEAN)
          heap_xlog_clean(true, lsn, record);
      else
!         elog(STOP, "heap_redo: unknown op code %u", info);
  }

  void
--- 2389,2395 ----
      else if (info == XLOG_HEAP_CLEAN)
          heap_xlog_clean(true, lsn, record);
      else
!         elog(CRASH, "heap_redo: unknown op code %u", info);
  }

  void
***************
*** 2409,2415 ****
      else if (info == XLOG_HEAP_CLEAN)
          heap_xlog_clean(false, lsn, record);
      else
!         elog(STOP, "heap_undo: unknown op code %u", info);
  }

  static void
--- 2409,2415 ----
      else if (info == XLOG_HEAP_CLEAN)
          heap_xlog_clean(false, lsn, record);
      else
!         elog(CRASH, "heap_undo: unknown op code %u", info);
  }

  static void
Index: src/backend/access/heap/hio.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/heap/hio.c,v
retrieving revision 1.43
diff -c -r1.43 hio.c
*** src/backend/access/heap/hio.c    2001/10/25 05:49:21    1.43
--- src/backend/access/heap/hio.c    2002/02/19 04:54:55
***************
*** 50,56 ****
                           tuple->t_len, InvalidOffsetNumber, LP_USED);

      if (offnum == InvalidOffsetNumber)
!         elog(STOP, "RelationPutHeapTuple: failed to add tuple");

      /* Update tuple->t_self to the actual position where it was stored */
      ItemPointerSet(&(tuple->t_self), BufferGetBlockNumber(buffer), offnum);
--- 50,56 ----
                           tuple->t_len, InvalidOffsetNumber, LP_USED);

      if (offnum == InvalidOffsetNumber)
!         elog(CRASH, "RelationPutHeapTuple: failed to add tuple");

      /* Update tuple->t_self to the actual position where it was stored */
      ItemPointerSet(&(tuple->t_self), BufferGetBlockNumber(buffer), offnum);
***************
*** 270,276 ****
      if (len > PageGetFreeSpace(pageHeader))
      {
          /* We should not get here given the test at the top */
!         elog(STOP, "Tuple is too big: size %lu", (unsigned long) len);
      }

      /*
--- 270,276 ----
      if (len > PageGetFreeSpace(pageHeader))
      {
          /* We should not get here given the test at the top */
!         elog(CRASH, "Tuple is too big: size %lu", (unsigned long) len);
      }

      /*
Index: src/backend/access/nbtree/nbtinsert.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v
retrieving revision 1.88
diff -c -r1.88 nbtinsert.c
*** src/backend/access/nbtree/nbtinsert.c    2002/01/01 20:32:37    1.88
--- src/backend/access/nbtree/nbtinsert.c    2002/02/19 04:54:57
***************
*** 735,741 ****
          item = (BTItem) PageGetItem(origpage, itemid);
          if (PageAddItem(rightpage, (Item) item, itemsz, rightoff,
                          LP_USED) == InvalidOffsetNumber)
!             elog(STOP, "btree: failed to add hikey to the right sibling");
          rightoff = OffsetNumberNext(rightoff);
      }

--- 735,741 ----
          item = (BTItem) PageGetItem(origpage, itemid);
          if (PageAddItem(rightpage, (Item) item, itemsz, rightoff,
                          LP_USED) == InvalidOffsetNumber)
!             elog(CRASH, "btree: failed to add hikey to the right sibling");
          rightoff = OffsetNumberNext(rightoff);
      }

***************
*** 761,767 ****
      lhikey = item;
      if (PageAddItem(leftpage, (Item) item, itemsz, leftoff,
                      LP_USED) == InvalidOffsetNumber)
!         elog(STOP, "btree: failed to add hikey to the left sibling");
      leftoff = OffsetNumberNext(leftoff);

      /*
--- 761,767 ----
      lhikey = item;
      if (PageAddItem(leftpage, (Item) item, itemsz, leftoff,
                      LP_USED) == InvalidOffsetNumber)
!         elog(CRASH, "btree: failed to add hikey to the left sibling");
      leftoff = OffsetNumberNext(leftoff);

      /*
***************
*** 1316,1322 ****
       * the two items will go into positions P_HIKEY and P_FIRSTKEY.
       */
      if (PageAddItem(rootpage, (Item) new_item, itemsz, P_HIKEY, LP_USED) == InvalidOffsetNumber)
!         elog(STOP, "btree: failed to add leftkey to new root page");
      pfree(new_item);

      /*
--- 1316,1322 ----
       * the two items will go into positions P_HIKEY and P_FIRSTKEY.
       */
      if (PageAddItem(rootpage, (Item) new_item, itemsz, P_HIKEY, LP_USED) == InvalidOffsetNumber)
!         elog(CRASH, "btree: failed to add leftkey to new root page");
      pfree(new_item);

      /*
***************
*** 1333,1339 ****
       * insert the right page pointer into the new root page.
       */
      if (PageAddItem(rootpage, (Item) new_item, itemsz, P_FIRSTKEY, LP_USED) == InvalidOffsetNumber)
!         elog(STOP, "btree: failed to add rightkey to new root page");
      pfree(new_item);

      metad->btm_root = rootblknum;
--- 1333,1339 ----
       * insert the right page pointer into the new root page.
       */
      if (PageAddItem(rootpage, (Item) new_item, itemsz, P_FIRSTKEY, LP_USED) == InvalidOffsetNumber)
!         elog(CRASH, "btree: failed to add rightkey to new root page");
      pfree(new_item);

      metad->btm_root = rootblknum;
***************
*** 2034,2040 ****

      if (PageAddItem(page, (Item) btitem, itemsize, itup_off,
                      LP_USED) == InvalidOffsetNumber)
!         elog(STOP, "btree: failed to add item to the %s for %s",
               where, RelationGetRelationName(rel));
  }

--- 2034,2040 ----

      if (PageAddItem(page, (Item) btitem, itemsize, itup_off,
                      LP_USED) == InvalidOffsetNumber)
!         elog(CRASH, "btree: failed to add item to the %s for %s",
               where, RelationGetRelationName(rel));
  }

Index: src/backend/access/nbtree/nbtree.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v
retrieving revision 1.87
diff -c -r1.87 nbtree.c
*** src/backend/access/nbtree/nbtree.c    2002/01/06 00:37:43    1.87
--- src/backend/access/nbtree/nbtree.c    2002/02/19 04:54:58
***************
*** 776,782 ****
          itemsz = MAXALIGN(itemsz);
          if (PageAddItem(page, (Item) from, itemsz,
                        FirstOffsetNumber, LP_USED) == InvalidOffsetNumber)
!             elog(STOP, "_bt_restore_page: can't add item to page");
          from += itemsz;
      }
  }
--- 776,782 ----
          itemsz = MAXALIGN(itemsz);
          if (PageAddItem(page, (Item) from, itemsz,
                        FirstOffsetNumber, LP_USED) == InvalidOffsetNumber)
!             elog(CRASH, "_bt_restore_page: can't add item to page");
          from += itemsz;
      }
  }
***************
*** 799,808 ****
      buffer = XLogReadBuffer(false, reln,
                          ItemPointerGetBlockNumber(&(xlrec->target.tid)));
      if (!BufferIsValid(buffer))
!         elog(STOP, "btree_delete_redo: block unfound");
      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(STOP, "btree_delete_redo: uninitialized page");

      if (XLByteLE(lsn, PageGetLSN(page)))
      {
--- 799,808 ----
      buffer = XLogReadBuffer(false, reln,
                          ItemPointerGetBlockNumber(&(xlrec->target.tid)));
      if (!BufferIsValid(buffer))
!         elog(CRASH, "btree_delete_redo: block unfound");
      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(CRASH, "btree_delete_redo: uninitialized page");

      if (XLByteLE(lsn, PageGetLSN(page)))
      {
***************
*** 838,847 ****
      buffer = XLogReadBuffer(false, reln,
                          ItemPointerGetBlockNumber(&(xlrec->target.tid)));
      if (!BufferIsValid(buffer))
!         elog(STOP, "btree_insert_%sdo: block unfound", (redo) ? "re" : "un");
      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(STOP, "btree_insert_%sdo: uninitialized page", (redo) ? "re" : "un");
      pageop = (BTPageOpaque) PageGetSpecialPointer(page);

      if (redo)
--- 838,847 ----
      buffer = XLogReadBuffer(false, reln,
                          ItemPointerGetBlockNumber(&(xlrec->target.tid)));
      if (!BufferIsValid(buffer))
!         elog(CRASH, "btree_insert_%sdo: block unfound", (redo) ? "re" : "un");
      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(CRASH, "btree_insert_%sdo: uninitialized page", (redo) ? "re" : "un");
      pageop = (BTPageOpaque) PageGetSpecialPointer(page);

      if (redo)
***************
*** 855,861 ****
                          record->xl_len - SizeOfBtreeInsert,
                          ItemPointerGetOffsetNumber(&(xlrec->target.tid)),
                          LP_USED) == InvalidOffsetNumber)
!             elog(STOP, "btree_insert_redo: failed to add item");

          PageSetLSN(page, lsn);
          PageSetSUI(page, ThisStartUpID);
--- 855,861 ----
                          record->xl_len - SizeOfBtreeInsert,
                          ItemPointerGetOffsetNumber(&(xlrec->target.tid)),
                          LP_USED) == InvalidOffsetNumber)
!             elog(CRASH, "btree_insert_redo: failed to add item");

          PageSetLSN(page, lsn);
          PageSetSUI(page, ThisStartUpID);
***************
*** 864,870 ****
      else
      {
          if (XLByteLT(PageGetLSN(page), lsn))
!             elog(STOP, "btree_insert_undo: bad page LSN");

          if (!P_ISLEAF(pageop))
          {
--- 864,870 ----
      else
      {
          if (XLByteLT(PageGetLSN(page), lsn))
!             elog(CRASH, "btree_insert_undo: bad page LSN");

          if (!P_ISLEAF(pageop))
          {
***************
*** 872,878 ****
              return;
          }

!         elog(STOP, "btree_insert_undo: unimplemented");
      }

      return;
--- 872,878 ----
              return;
          }

!         elog(CRASH, "btree_insert_undo: unimplemented");
      }

      return;
***************
*** 899,911 ****
          BlockIdGetBlockNumber(&(xlrec->otherblk));
      buffer = XLogReadBuffer(false, reln, blkno);
      if (!BufferIsValid(buffer))
!         elog(STOP, "btree_split_%s: lost left sibling", op);

      page = (Page) BufferGetPage(buffer);
      if (redo)
          _bt_pageinit(page, BufferGetPageSize(buffer));
      else if (PageIsNew((PageHeader) page))
!         elog(STOP, "btree_split_undo: uninitialized left sibling");
      pageop = (BTPageOpaque) PageGetSpecialPointer(page);

      if (redo)
--- 899,911 ----
          BlockIdGetBlockNumber(&(xlrec->otherblk));
      buffer = XLogReadBuffer(false, reln, blkno);
      if (!BufferIsValid(buffer))
!         elog(CRASH, "btree_split_%s: lost left sibling", op);

      page = (Page) BufferGetPage(buffer);
      if (redo)
          _bt_pageinit(page, BufferGetPageSize(buffer));
      else if (PageIsNew((PageHeader) page))
!         elog(CRASH, "btree_split_undo: uninitialized left sibling");
      pageop = (BTPageOpaque) PageGetSpecialPointer(page);

      if (redo)
***************
*** 928,935 ****
  /* undo */
      {
          if (XLByteLT(PageGetLSN(page), lsn))
!             elog(STOP, "btree_split_undo: bad left sibling LSN");
!         elog(STOP, "btree_split_undo: unimplemented");
      }

      /* Right (new) sibling */
--- 928,935 ----
  /* undo */
      {
          if (XLByteLT(PageGetLSN(page), lsn))
!             elog(CRASH, "btree_split_undo: bad left sibling LSN");
!         elog(CRASH, "btree_split_undo: unimplemented");
      }

      /* Right (new) sibling */
***************
*** 937,949 ****
          ItemPointerGetBlockNumber(&(xlrec->target.tid));
      buffer = XLogReadBuffer((redo) ? true : false, reln, blkno);
      if (!BufferIsValid(buffer))
!         elog(STOP, "btree_split_%s: lost right sibling", op);

      page = (Page) BufferGetPage(buffer);
      if (redo)
          _bt_pageinit(page, BufferGetPageSize(buffer));
      else if (PageIsNew((PageHeader) page))
!         elog(STOP, "btree_split_undo: uninitialized right sibling");
      pageop = (BTPageOpaque) PageGetSpecialPointer(page);

      if (redo)
--- 937,949 ----
          ItemPointerGetBlockNumber(&(xlrec->target.tid));
      buffer = XLogReadBuffer((redo) ? true : false, reln, blkno);
      if (!BufferIsValid(buffer))
!         elog(CRASH, "btree_split_%s: lost right sibling", op);

      page = (Page) BufferGetPage(buffer);
      if (redo)
          _bt_pageinit(page, BufferGetPageSize(buffer));
      else if (PageIsNew((PageHeader) page))
!         elog(CRASH, "btree_split_undo: uninitialized right sibling");
      pageop = (BTPageOpaque) PageGetSpecialPointer(page);

      if (redo)
***************
*** 967,974 ****
  /* undo */
      {
          if (XLByteLT(PageGetLSN(page), lsn))
!             elog(STOP, "btree_split_undo: bad right sibling LSN");
!         elog(STOP, "btree_split_undo: unimplemented");
      }

      if (!redo || (record->xl_info & XLR_BKP_BLOCK_1))
--- 967,974 ----
  /* undo */
      {
          if (XLByteLT(PageGetLSN(page), lsn))
!             elog(CRASH, "btree_split_undo: bad right sibling LSN");
!         elog(CRASH, "btree_split_undo: unimplemented");
      }

      if (!redo || (record->xl_info & XLR_BKP_BLOCK_1))
***************
*** 981,991 ****

      buffer = XLogReadBuffer(false, reln, blkno);
      if (!BufferIsValid(buffer))
!         elog(STOP, "btree_split_redo: lost next right page");

      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(STOP, "btree_split_redo: uninitialized next right page");

      if (XLByteLE(lsn, PageGetLSN(page)))
      {
--- 981,991 ----

      buffer = XLogReadBuffer(false, reln, blkno);
      if (!BufferIsValid(buffer))
!         elog(CRASH, "btree_split_redo: lost next right page");

      page = (Page) BufferGetPage(buffer);
      if (PageIsNew((PageHeader) page))
!         elog(CRASH, "btree_split_redo: uninitialized next right page");

      if (XLByteLE(lsn, PageGetLSN(page)))
      {
***************
*** 1022,1031 ****
          return;
      buffer = XLogReadBuffer(true, reln, BlockIdGetBlockNumber(&(xlrec->rootblk)));
      if (!BufferIsValid(buffer))
!         elog(STOP, "btree_newroot_redo: no root page");
      metabuf = XLogReadBuffer(false, reln, BTREE_METAPAGE);
      if (!BufferIsValid(buffer))
!         elog(STOP, "btree_newroot_redo: no metapage");
      page = (Page) BufferGetPage(buffer);
      _bt_pageinit(page, BufferGetPageSize(buffer));
      pageop = (BTPageOpaque) PageGetSpecialPointer(page);
--- 1022,1031 ----
          return;
      buffer = XLogReadBuffer(true, reln, BlockIdGetBlockNumber(&(xlrec->rootblk)));
      if (!BufferIsValid(buffer))
!         elog(CRASH, "btree_newroot_redo: no root page");
      metabuf = XLogReadBuffer(false, reln, BTREE_METAPAGE);
      if (!BufferIsValid(buffer))
!         elog(CRASH, "btree_newroot_redo: no metapage");
      page = (Page) BufferGetPage(buffer);
      _bt_pageinit(page, BufferGetPageSize(buffer));
      pageop = (BTPageOpaque) PageGetSpecialPointer(page);
***************
*** 1079,1085 ****
      else if (info == XLOG_BTREE_NEWROOT)
          btree_xlog_newroot(true, lsn, record);
      else
!         elog(STOP, "btree_redo: unknown op code %u", info);
  }

  void
--- 1079,1085 ----
      else if (info == XLOG_BTREE_NEWROOT)
          btree_xlog_newroot(true, lsn, record);
      else
!         elog(CRASH, "btree_redo: unknown op code %u", info);
  }

  void
***************
*** 1099,1105 ****
      else if (info == XLOG_BTREE_NEWROOT)
          btree_xlog_newroot(false, lsn, record);
      else
!         elog(STOP, "btree_undo: unknown op code %u", info);
  }

  static void
--- 1099,1105 ----
      else if (info == XLOG_BTREE_NEWROOT)
          btree_xlog_newroot(false, lsn, record);
      else
!         elog(CRASH, "btree_undo: unknown op code %u", info);
  }

  static void
Index: src/backend/access/rtree/rtree.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/rtree/rtree.c,v
retrieving revision 1.69
diff -c -r1.69 rtree.c
*** src/backend/access/rtree/rtree.c    2002/01/15 22:14:17    1.69
--- src/backend/access/rtree/rtree.c    2002/02/19 04:54:58
***************
*** 1345,1357 ****
  void
  rtree_redo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(STOP, "rtree_redo: unimplemented");
  }

  void
  rtree_undo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(STOP, "rtree_undo: unimplemented");
  }

  void
--- 1345,1357 ----
  void
  rtree_redo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(CRASH, "rtree_redo: unimplemented");
  }

  void
  rtree_undo(XLogRecPtr lsn, XLogRecord *record)
  {
!     elog(CRASH, "rtree_undo: unimplemented");
  }

  void
Index: src/backend/access/transam/clog.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/clog.c,v
retrieving revision 1.7
diff -c -r1.7 clog.c
*** src/backend/access/transam/clog.c    2001/10/28 06:25:42    1.7
--- src/backend/access/transam/clog.c    2002/02/19 04:54:59
***************
*** 544,562 ****
      if (fd < 0)
      {
          if (errno != ENOENT || !InRecovery)
!             elog(STOP, "open of %s failed: %m", path);
          elog(DEBUG, "clog file %s doesn't exist, reading as zeroes", path);
          MemSet(ClogCtl->page_buffer[slotno], 0, CLOG_BLCKSZ);
          return;
      }

      if (lseek(fd, (off_t) offset, SEEK_SET) < 0)
!         elog(STOP, "lseek of clog file %u, offset %u failed: %m",
               segno, offset);

      errno = 0;
      if (read(fd, ClogCtl->page_buffer[slotno], CLOG_BLCKSZ) != CLOG_BLCKSZ)
!         elog(STOP, "read of clog file %u, offset %u failed: %m",
               segno, offset);

      close(fd);
--- 544,562 ----
      if (fd < 0)
      {
          if (errno != ENOENT || !InRecovery)
!             elog(CRASH, "open of %s failed: %m", path);
          elog(DEBUG, "clog file %s doesn't exist, reading as zeroes", path);
          MemSet(ClogCtl->page_buffer[slotno], 0, CLOG_BLCKSZ);
          return;
      }

      if (lseek(fd, (off_t) offset, SEEK_SET) < 0)
!         elog(CRASH, "lseek of clog file %u, offset %u failed: %m",
               segno, offset);

      errno = 0;
      if (read(fd, ClogCtl->page_buffer[slotno], CLOG_BLCKSZ) != CLOG_BLCKSZ)
!         elog(CRASH, "read of clog file %u, offset %u failed: %m",
               segno, offset);

      close(fd);
***************
*** 596,610 ****
      if (fd < 0)
      {
          if (errno != ENOENT)
!             elog(STOP, "open of %s failed: %m", path);
          fd = BasicOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
                             S_IRUSR | S_IWUSR);
          if (fd < 0)
!             elog(STOP, "creation of file %s failed: %m", path);
      }

      if (lseek(fd, (off_t) offset, SEEK_SET) < 0)
!         elog(STOP, "lseek of clog file %u, offset %u failed: %m",
               segno, offset);

      errno = 0;
--- 596,610 ----
      if (fd < 0)
      {
          if (errno != ENOENT)
!             elog(CRASH, "open of %s failed: %m", path);
          fd = BasicOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
                             S_IRUSR | S_IWUSR);
          if (fd < 0)
!             elog(CRASH, "creation of file %s failed: %m", path);
      }

      if (lseek(fd, (off_t) offset, SEEK_SET) < 0)
!         elog(CRASH, "lseek of clog file %u, offset %u failed: %m",
               segno, offset);

      errno = 0;
***************
*** 613,619 ****
          /* if write didn't set errno, assume problem is no disk space */
          if (errno == 0)
              errno = ENOSPC;
!         elog(STOP, "write of clog file %u, offset %u failed: %m",
               segno, offset);
      }

--- 613,619 ----
          /* if write didn't set errno, assume problem is no disk space */
          if (errno == 0)
              errno = ENOSPC;
!         elog(CRASH, "write of clog file %u, offset %u failed: %m",
               segno, offset);
      }

***************
*** 887,893 ****

      cldir = opendir(ClogDir);
      if (cldir == NULL)
!         elog(STOP, "could not open transaction-commit log directory (%s): %m",
               ClogDir);

      errno = 0;
--- 887,893 ----

      cldir = opendir(ClogDir);
      if (cldir == NULL)
!         elog(CRASH, "could not open transaction-commit log directory (%s): %m",
               ClogDir);

      errno = 0;
***************
*** 912,918 ****
          errno = 0;
      }
      if (errno)
!         elog(STOP, "could not read transaction-commit log directory (%s): %m",
               ClogDir);
      closedir(cldir);

--- 912,918 ----
          errno = 0;
      }
      if (errno)
!         elog(CRASH, "could not read transaction-commit log directory (%s): %m",
               ClogDir);
      closedir(cldir);

Index: src/backend/access/transam/xact.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/xact.c,v
retrieving revision 1.115
diff -c -r1.115 xact.c
*** src/backend/access/transam/xact.c    2001/11/01 06:17:01    1.115
--- src/backend/access/transam/xact.c    2002/02/19 04:55:00
***************
*** 1606,1612 ****
          /* SHOULD REMOVE FILES OF ALL FAILED-TO-BE-CREATED RELATIONS */
      }
      else
!         elog(STOP, "xact_redo: unknown op code %u", info);
  }

  void
--- 1606,1612 ----
          /* SHOULD REMOVE FILES OF ALL FAILED-TO-BE-CREATED RELATIONS */
      }
      else
!         elog(CRASH, "xact_redo: unknown op code %u", info);
  }

  void
***************
*** 1615,1623 ****
      uint8        info = record->xl_info & ~XLR_INFO_MASK;

      if (info == XLOG_XACT_COMMIT)        /* shouldn't be called by XLOG */
!         elog(STOP, "xact_undo: can't undo committed xaction");
      else if (info != XLOG_XACT_ABORT)
!         elog(STOP, "xact_redo: unknown op code %u", info);
  }

  void
--- 1615,1623 ----
      uint8        info = record->xl_info & ~XLR_INFO_MASK;

      if (info == XLOG_XACT_COMMIT)        /* shouldn't be called by XLOG */
!         elog(CRASH, "xact_undo: can't undo committed xaction");
      else if (info != XLOG_XACT_ABORT)
!         elog(CRASH, "xact_redo: unknown op code %u", info);
  }

  void
***************
*** 1652,1658 ****
  {
  #ifdef XLOG_II
      if (_RollbackFunc != NULL)
!         elog(STOP, "XactPushRollback: already installed");
  #endif

      _RollbackFunc = func;
--- 1652,1658 ----
  {
  #ifdef XLOG_II
      if (_RollbackFunc != NULL)
!         elog(CRASH, "XactPushRollback: already installed");
  #endif

      _RollbackFunc = func;
Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.87
diff -c -r1.87 xlog.c
*** src/backend/access/transam/xlog.c    2002/02/18 05:44:45    1.87
--- src/backend/access/transam/xlog.c    2002/02/19 04:55:02
***************
*** 489,495 ****
      if (info & XLR_INFO_MASK)
      {
          if ((info & XLR_INFO_MASK) != XLOG_NO_TRAN)
!             elog(STOP, "XLogInsert: invalid info mask %02X",
                   (info & XLR_INFO_MASK));
          no_tran = true;
          info &= ~XLR_INFO_MASK;
--- 489,495 ----
      if (info & XLR_INFO_MASK)
      {
          if ((info & XLR_INFO_MASK) != XLOG_NO_TRAN)
!             elog(CRASH, "XLogInsert: invalid info mask %02X",
                   (info & XLR_INFO_MASK));
          no_tran = true;
          info &= ~XLR_INFO_MASK;
***************
*** 594,600 ****
                  }
              }
              if (i >= XLR_MAX_BKP_BLOCKS)
!                 elog(STOP, "XLogInsert: can backup %d blocks at most",
                       XLR_MAX_BKP_BLOCKS);
          }
          /* Break out of loop when rdt points to last list item */
--- 594,600 ----
                  }
              }
              if (i >= XLR_MAX_BKP_BLOCKS)
!                 elog(CRASH, "XLogInsert: can backup %d blocks at most",
                       XLR_MAX_BKP_BLOCKS);
          }
          /* Break out of loop when rdt points to last list item */
***************
*** 612,618 ****
       * also remove the check for xl_len == 0 in ReadRecord, below.
       */
      if (len == 0 || len > MAXLOGRECSZ)
!         elog(STOP, "XLogInsert: invalid record length %u", len);

      START_CRIT_SECTION();

--- 612,618 ----
       * also remove the check for xl_len == 0 in ReadRecord, below.
       */
      if (len == 0 || len > MAXLOGRECSZ)
!         elog(CRASH, "XLogInsert: invalid record length %u", len);

      START_CRIT_SECTION();

***************
*** 1010,1016 ****
           * AdvanceXLInsertBuffer.
           */
          if (!XLByteLT(LogwrtResult.Write, XLogCtl->xlblocks[Write->curridx]))
!             elog(STOP, "XLogWrite: write request %X/%X is past end of log %X/%X",
                   LogwrtResult.Write.xlogid, LogwrtResult.Write.xrecoff,
                   XLogCtl->xlblocks[Write->curridx].xlogid,
                   XLogCtl->xlblocks[Write->curridx].xrecoff);
--- 1010,1016 ----
           * AdvanceXLInsertBuffer.
           */
          if (!XLByteLT(LogwrtResult.Write, XLogCtl->xlblocks[Write->curridx]))
!             elog(CRASH, "XLogWrite: write request %X/%X is past end of log %X/%X",
                   LogwrtResult.Write.xlogid, LogwrtResult.Write.xrecoff,
                   XLogCtl->xlblocks[Write->curridx].xlogid,
                   XLogCtl->xlblocks[Write->curridx].xrecoff);
***************
*** 1027,1033 ****
              if (openLogFile >= 0)
              {
                  if (close(openLogFile) != 0)
!                     elog(STOP, "close of log file %u, segment %u failed: %m",
                           openLogId, openLogSeg);
                  openLogFile = -1;
              }
--- 1027,1033 ----
              if (openLogFile >= 0)
              {
                  if (close(openLogFile) != 0)
!                     elog(CRASH, "close of log file %u, segment %u failed: %m",
                           openLogId, openLogSeg);
                  openLogFile = -1;
              }
***************
*** 1085,1091 ****
          {
              openLogOff = (LogwrtResult.Write.xrecoff - BLCKSZ) % XLogSegSize;
              if (lseek(openLogFile, (off_t) openLogOff, SEEK_SET) < 0)
!                 elog(STOP, "lseek of log file %u, segment %u, offset %u failed: %m",
                       openLogId, openLogSeg, openLogOff);
          }

--- 1085,1091 ----
          {
              openLogOff = (LogwrtResult.Write.xrecoff - BLCKSZ) % XLogSegSize;
              if (lseek(openLogFile, (off_t) openLogOff, SEEK_SET) < 0)
!                 elog(CRASH, "lseek of log file %u, segment %u, offset %u failed: %m",
                       openLogId, openLogSeg, openLogOff);
          }

***************
*** 1097,1103 ****
              /* if write didn't set errno, assume problem is no disk space */
              if (errno == 0)
                  errno = ENOSPC;
!             elog(STOP, "write of log file %u, segment %u, offset %u failed: %m",
                   openLogId, openLogSeg, openLogOff);
          }
          openLogOff += BLCKSZ;
--- 1097,1103 ----
              /* if write didn't set errno, assume problem is no disk space */
              if (errno == 0)
                  errno = ENOSPC;
!             elog(CRASH, "write of log file %u, segment %u, offset %u failed: %m",
                   openLogId, openLogSeg, openLogOff);
          }
          openLogOff += BLCKSZ;
***************
*** 1141,1147 ****
               !XLByteInPrevSeg(LogwrtResult.Write, openLogId, openLogSeg))
              {
                  if (close(openLogFile) != 0)
!                     elog(STOP, "close of log file %u, segment %u failed: %m",
                           openLogId, openLogSeg);
                  openLogFile = -1;
              }
--- 1141,1147 ----
               !XLByteInPrevSeg(LogwrtResult.Write, openLogId, openLogSeg))
              {
                  if (close(openLogFile) != 0)
!                     elog(CRASH, "close of log file %u, segment %u failed: %m",
                           openLogId, openLogSeg);
                  openLogFile = -1;
              }
***************
*** 1273,1279 ****
       * problem; most likely, the requested flush point is past end of XLOG.
       * This has been seen to occur when a disk page has a corrupted LSN.
       *
!      * Formerly we treated this as a STOP condition, but that hurts the
       * system's robustness rather than helping it: we do not want to take
       * down the whole system due to corruption on one data page.  In
       * particular, if the bad page is encountered again during recovery then
--- 1273,1279 ----
       * problem; most likely, the requested flush point is past end of XLOG.
       * This has been seen to occur when a disk page has a corrupted LSN.
       *
!      * Formerly we treated this as a CRASH condition, but that hurts the
       * system's robustness rather than helping it: we do not want to take
       * down the whole system due to corruption on one data page.  In
       * particular, if the bad page is encountered again during recovery then
***************
*** 1286,1292 ****
       * The current approach is to ERROR under normal conditions, but only
       * NOTICE during recovery, so that the system can be brought up even if
       * there's a corrupt LSN.  Note that for calls from xact.c, the ERROR
!      * will be promoted to STOP since xact.c calls this routine inside a
       * critical section.  However, calls from bufmgr.c are not within
       * critical sections and so we will not force a restart for a bad LSN
       * on a data page.
--- 1286,1292 ----
       * The current approach is to ERROR under normal conditions, but only
       * NOTICE during recovery, so that the system can be brought up even if
       * there's a corrupt LSN.  Note that for calls from xact.c, the ERROR
!      * will be promoted to CRASH since xact.c calls this routine inside a
       * critical section.  However, calls from bufmgr.c are not within
       * critical sections and so we will not force a restart for a bad LSN
       * on a data page.
***************
*** 1336,1342 ****
          if (fd < 0)
          {
              if (errno != ENOENT)
!                 elog(STOP, "open of %s (log file %u, segment %u) failed: %m",
                       path, log, seg);
          }
          else
--- 1336,1342 ----
          if (fd < 0)
          {
              if (errno != ENOENT)
!                 elog(CRASH, "open of %s (log file %u, segment %u) failed: %m",
                       path, log, seg);
          }
          else
***************
*** 1358,1364 ****
      fd = BasicOpenFile(tmppath, O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
                         S_IRUSR | S_IWUSR);
      if (fd < 0)
!         elog(STOP, "creation of file %s failed: %m", tmppath);

      /*
       * Zero-fill the file.    We have to do this the hard way to ensure that
--- 1358,1364 ----
      fd = BasicOpenFile(tmppath, O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
                         S_IRUSR | S_IWUSR);
      if (fd < 0)
!         elog(CRASH, "creation of file %s failed: %m", tmppath);

      /*
       * Zero-fill the file.    We have to do this the hard way to ensure that
***************
*** 1385,1396 ****
              /* if write didn't set errno, assume problem is no disk space */
              errno = save_errno ? save_errno : ENOSPC;

!             elog(STOP, "ZeroFill failed to write %s: %m", tmppath);
          }
      }

      if (pg_fsync(fd) != 0)
!         elog(STOP, "fsync of file %s failed: %m", tmppath);

      close(fd);

--- 1385,1396 ----
              /* if write didn't set errno, assume problem is no disk space */
              errno = save_errno ? save_errno : ENOSPC;

!             elog(CRASH, "ZeroFill failed to write %s: %m", tmppath);
          }
      }

      if (pg_fsync(fd) != 0)
!         elog(CRASH, "fsync of file %s failed: %m", tmppath);

      close(fd);

***************
*** 1417,1423 ****
      fd = BasicOpenFile(path, O_RDWR | PG_BINARY | XLOG_SYNC_BIT,
                         S_IRUSR | S_IWUSR);
      if (fd < 0)
!         elog(STOP, "open of %s (log file %u, segment %u) failed: %m",
               path, log, seg);

      return (fd);
--- 1417,1423 ----
      fd = BasicOpenFile(path, O_RDWR | PG_BINARY | XLOG_SYNC_BIT,
                         S_IRUSR | S_IWUSR);
      if (fd < 0)
!         elog(CRASH, "open of %s (log file %u, segment %u) failed: %m",
               path, log, seg);

      return (fd);
***************
*** 1495,1506 ****
       */
  #ifndef __BEOS__
      if (link(tmppath, path) < 0)
!         elog(STOP, "link from %s to %s (initialization of log file %u, segment %u) failed: %m",
               tmppath, path, log, seg);
      unlink(tmppath);
  #else
      if (rename(tmppath, path) < 0)
!         elog(STOP, "rename from %s to %s (initialization of log file %u, segment %u) failed: %m",
               tmppath, path, log, seg);
  #endif

--- 1495,1506 ----
       */
  #ifndef __BEOS__
      if (link(tmppath, path) < 0)
!         elog(CRASH, "link from %s to %s (initialization of log file %u, segment %u) failed: %m",
               tmppath, path, log, seg);
      unlink(tmppath);
  #else
      if (rename(tmppath, path) < 0)
!         elog(CRASH, "rename from %s to %s (initialization of log file %u, segment %u) failed: %m",
               tmppath, path, log, seg);
  #endif

***************
*** 1531,1537 ****
                   path, log, seg);
              return (fd);
          }
!         elog(STOP, "open of %s (log file %u, segment %u) failed: %m",
               path, log, seg);
      }

--- 1531,1537 ----
                   path, log, seg);
              return (fd);
          }
!         elog(CRASH, "open of %s (log file %u, segment %u) failed: %m",
               path, log, seg);
      }

***************
*** 1592,1598 ****

      xldir = opendir(XLogDir);
      if (xldir == NULL)
!         elog(STOP, "could not open transaction log directory (%s): %m",
               XLogDir);

      sprintf(lastoff, "%08X%08X", log, seg);
--- 1592,1598 ----

      xldir = opendir(XLogDir);
      if (xldir == NULL)
!         elog(CRASH, "could not open transaction log directory (%s): %m",
               XLogDir);

      sprintf(lastoff, "%08X%08X", log, seg);
***************
*** 1638,1644 ****
          errno = 0;
      }
      if (errno)
!         elog(STOP, "could not read transaction log directory (%s): %m",
               XLogDir);
      closedir(xldir);
  }
--- 1638,1644 ----
          errno = 0;
      }
      if (errno)
!         elog(CRASH, "could not read transaction log directory (%s): %m",
               XLogDir);
      closedir(xldir);
  }
***************
*** 1749,1756 ****
   * If RecPtr is not NULL, try to read a record at that position.  Otherwise
   * try to read a record just after the last one previously read.
   *
!  * If no valid record is available, returns NULL, or fails if emode is STOP.
!  * (emode must be either STOP or LOG.)
   *
   * buffer is a workspace at least _INTL_MAXLOGRECSZ bytes long.  It is needed
   * to reassemble a record that crosses block boundaries.  Note that on
--- 1749,1756 ----
   * If RecPtr is not NULL, try to read a record at that position.  Otherwise
   * try to read a record just after the last one previously read.
   *
!  * If no valid record is available, returns NULL, or fails if emode is CRASH.
!  * (emode must be either CRASH or LOG.)
   *
   * buffer is a workspace at least _INTL_MAXLOGRECSZ bytes long.  It is needed
   * to reassemble a record that crosses block boundaries.  Note that on
***************
*** 1802,1808 ****
          tmpRecPtr.xrecoff += SizeOfXLogPHD;
      }
      else if (!XRecOffIsValid(RecPtr->xrecoff))
!         elog(STOP, "ReadRecord: invalid record offset at %X/%X",
               RecPtr->xlogid, RecPtr->xrecoff);

      if (readFile >= 0 && !XLByteInSeg(*RecPtr, readId, readSeg))
--- 1802,1808 ----
          tmpRecPtr.xrecoff += SizeOfXLogPHD;
      }
      else if (!XRecOffIsValid(RecPtr->xrecoff))
!         elog(CRASH, "ReadRecord: invalid record offset at %X/%X",
               RecPtr->xlogid, RecPtr->xrecoff);

      if (readFile >= 0 && !XLByteInSeg(*RecPtr, readId, readSeg))
***************
*** 2083,2093 ****
  #ifdef USE_LOCALE
      localeptr = setlocale(LC_COLLATE, NULL);
      if (!localeptr)
!         elog(STOP, "invalid LC_COLLATE setting");
      StrNCpy(ControlFile->lc_collate, localeptr, LOCALE_NAME_BUFLEN);
      localeptr = setlocale(LC_CTYPE, NULL);
      if (!localeptr)
!         elog(STOP, "invalid LC_CTYPE setting");
      StrNCpy(ControlFile->lc_ctype, localeptr, LOCALE_NAME_BUFLEN);

      /*
--- 2083,2093 ----
  #ifdef USE_LOCALE
      localeptr = setlocale(LC_COLLATE, NULL);
      if (!localeptr)
!         elog(CRASH, "invalid LC_COLLATE setting");
      StrNCpy(ControlFile->lc_collate, localeptr, LOCALE_NAME_BUFLEN);
      localeptr = setlocale(LC_CTYPE, NULL);
      if (!localeptr)
!         elog(CRASH, "invalid LC_CTYPE setting");
      StrNCpy(ControlFile->lc_ctype, localeptr, LOCALE_NAME_BUFLEN);

      /*
***************
*** 2122,2128 ****
       * specific error than "couldn't read pg_control".
       */
      if (sizeof(ControlFileData) > BLCKSZ)
!         elog(STOP, "sizeof(ControlFileData) is larger than BLCKSZ; fix either one");

      memset(buffer, 0, BLCKSZ);
      memcpy(buffer, ControlFile, sizeof(ControlFileData));
--- 2122,2128 ----
       * specific error than "couldn't read pg_control".
       */
      if (sizeof(ControlFileData) > BLCKSZ)
!         elog(CRASH, "sizeof(ControlFileData) is larger than BLCKSZ; fix either one");

      memset(buffer, 0, BLCKSZ);
      memcpy(buffer, ControlFile, sizeof(ControlFileData));
***************
*** 2130,2136 ****
      fd = BasicOpenFile(ControlFilePath, O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
                         S_IRUSR | S_IWUSR);
      if (fd < 0)
!         elog(STOP, "WriteControlFile: could not create control file (%s): %m",
               ControlFilePath);

      errno = 0;
--- 2130,2136 ----
      fd = BasicOpenFile(ControlFilePath, O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
                         S_IRUSR | S_IWUSR);
      if (fd < 0)
!         elog(CRASH, "WriteControlFile: could not create control file (%s): %m",
               ControlFilePath);

      errno = 0;
***************
*** 2139,2149 ****
          /* if write didn't set errno, assume problem is no disk space */
          if (errno == 0)
              errno = ENOSPC;
!         elog(STOP, "WriteControlFile: write to control file failed: %m");
      }

      if (pg_fsync(fd) != 0)
!         elog(STOP, "WriteControlFile: fsync of control file failed: %m");

      close(fd);
  }
--- 2139,2149 ----
          /* if write didn't set errno, assume problem is no disk space */
          if (errno == 0)
              errno = ENOSPC;
!         elog(CRASH, "WriteControlFile: write to control file failed: %m");
      }

      if (pg_fsync(fd) != 0)
!         elog(CRASH, "WriteControlFile: fsync of control file failed: %m");

      close(fd);
  }
***************
*** 2159,2168 ****
       */
      fd = BasicOpenFile(ControlFilePath, O_RDWR | PG_BINARY, S_IRUSR | S_IWUSR);
      if (fd < 0)
!         elog(STOP, "could not open control file (%s): %m", ControlFilePath);

      if (read(fd, ControlFile, sizeof(ControlFileData)) != sizeof(ControlFileData))
!         elog(STOP, "read from control file failed: %m");

      close(fd);

--- 2159,2168 ----
       */
      fd = BasicOpenFile(ControlFilePath, O_RDWR | PG_BINARY, S_IRUSR | S_IWUSR);
      if (fd < 0)
!         elog(CRASH, "could not open control file (%s): %m", ControlFilePath);

      if (read(fd, ControlFile, sizeof(ControlFileData)) != sizeof(ControlFileData))
!         elog(CRASH, "read from control file failed: %m");

      close(fd);

***************
*** 2173,2179 ****
       * more enlightening than complaining about wrong CRC.
       */
      if (ControlFile->pg_control_version != PG_CONTROL_VERSION)
!         elog(STOP,
               "The database cluster was initialized with PG_CONTROL_VERSION %d,\n"
               "\tbut the server was compiled with PG_CONTROL_VERSION %d.\n"
               "\tIt looks like you need to initdb.",
--- 2173,2179 ----
       * more enlightening than complaining about wrong CRC.
       */
      if (ControlFile->pg_control_version != PG_CONTROL_VERSION)
!         elog(CRASH,
               "The database cluster was initialized with PG_CONTROL_VERSION %d,\n"
               "\tbut the server was compiled with PG_CONTROL_VERSION %d.\n"
               "\tIt looks like you need to initdb.",
***************
*** 2187,2193 ****
      FIN_CRC64(crc);

      if (!EQ_CRC64(crc, ControlFile->crc))
!         elog(STOP, "invalid checksum in control file");

      /*
       * Do compatibility checking immediately.  We do this here for 2
--- 2187,2193 ----
      FIN_CRC64(crc);

      if (!EQ_CRC64(crc, ControlFile->crc))
!         elog(CRASH, "invalid checksum in control file");

      /*
       * Do compatibility checking immediately.  We do this here for 2
***************
*** 2202,2233 ****
       * compatibility items because they can affect sort order of indexes.)
       */
      if (ControlFile->catalog_version_no != CATALOG_VERSION_NO)
!         elog(STOP,
               "The database cluster was initialized with CATALOG_VERSION_NO %d,\n"
             "\tbut the backend was compiled with CATALOG_VERSION_NO %d.\n"
               "\tIt looks like you need to initdb.",
               ControlFile->catalog_version_no, CATALOG_VERSION_NO);
      if (ControlFile->blcksz != BLCKSZ)
!         elog(STOP,
               "The database cluster was initialized with BLCKSZ %d,\n"
               "\tbut the backend was compiled with BLCKSZ %d.\n"
               "\tIt looks like you need to initdb.",
               ControlFile->blcksz, BLCKSZ);
      if (ControlFile->relseg_size != RELSEG_SIZE)
!         elog(STOP,
               "The database cluster was initialized with RELSEG_SIZE %d,\n"
               "\tbut the backend was compiled with RELSEG_SIZE %d.\n"
               "\tIt looks like you need to initdb.",
               ControlFile->relseg_size, RELSEG_SIZE);
  #ifdef USE_LOCALE
      if (setlocale(LC_COLLATE, ControlFile->lc_collate) == NULL)
!         elog(STOP,
             "The database cluster was initialized with LC_COLLATE '%s',\n"
               "\twhich is not recognized by setlocale().\n"
               "\tIt looks like you need to initdb.",
               ControlFile->lc_collate);
      if (setlocale(LC_CTYPE, ControlFile->lc_ctype) == NULL)
!         elog(STOP,
               "The database cluster was initialized with LC_CTYPE '%s',\n"
               "\twhich is not recognized by setlocale().\n"
               "\tIt looks like you need to initdb.",
--- 2202,2233 ----
       * compatibility items because they can affect sort order of indexes.)
       */
      if (ControlFile->catalog_version_no != CATALOG_VERSION_NO)
!         elog(CRASH,
               "The database cluster was initialized with CATALOG_VERSION_NO %d,\n"
             "\tbut the backend was compiled with CATALOG_VERSION_NO %d.\n"
               "\tIt looks like you need to initdb.",
               ControlFile->catalog_version_no, CATALOG_VERSION_NO);
      if (ControlFile->blcksz != BLCKSZ)
!         elog(CRASH,
               "The database cluster was initialized with BLCKSZ %d,\n"
               "\tbut the backend was compiled with BLCKSZ %d.\n"
               "\tIt looks like you need to initdb.",
               ControlFile->blcksz, BLCKSZ);
      if (ControlFile->relseg_size != RELSEG_SIZE)
!         elog(CRASH,
               "The database cluster was initialized with RELSEG_SIZE %d,\n"
               "\tbut the backend was compiled with RELSEG_SIZE %d.\n"
               "\tIt looks like you need to initdb.",
               ControlFile->relseg_size, RELSEG_SIZE);
  #ifdef USE_LOCALE
      if (setlocale(LC_COLLATE, ControlFile->lc_collate) == NULL)
!         elog(CRASH,
             "The database cluster was initialized with LC_COLLATE '%s',\n"
               "\twhich is not recognized by setlocale().\n"
               "\tIt looks like you need to initdb.",
               ControlFile->lc_collate);
      if (setlocale(LC_CTYPE, ControlFile->lc_ctype) == NULL)
!         elog(CRASH,
               "The database cluster was initialized with LC_CTYPE '%s',\n"
               "\twhich is not recognized by setlocale().\n"
               "\tIt looks like you need to initdb.",
***************
*** 2235,2241 ****
  #else                            /* not USE_LOCALE */
      if (strcmp(ControlFile->lc_collate, "C") != 0 ||
          strcmp(ControlFile->lc_ctype, "C") != 0)
!         elog(STOP,
          "The database cluster was initialized with LC_COLLATE '%s' and\n"
               "\tLC_CTYPE '%s', but the server was compiled without locale support.\n"
               "\tIt looks like you need to initdb or recompile.",
--- 2235,2241 ----
  #else                            /* not USE_LOCALE */
      if (strcmp(ControlFile->lc_collate, "C") != 0 ||
          strcmp(ControlFile->lc_ctype, "C") != 0)
!         elog(CRASH,
          "The database cluster was initialized with LC_COLLATE '%s' and\n"
               "\tLC_CTYPE '%s', but the server was compiled without locale support.\n"
               "\tIt looks like you need to initdb or recompile.",
***************
*** 2256,2262 ****

      fd = BasicOpenFile(ControlFilePath, O_RDWR | PG_BINARY, S_IRUSR | S_IWUSR);
      if (fd < 0)
!         elog(STOP, "could not open control file (%s): %m", ControlFilePath);

      errno = 0;
      if (write(fd, ControlFile, sizeof(ControlFileData)) != sizeof(ControlFileData))
--- 2256,2262 ----

      fd = BasicOpenFile(ControlFilePath, O_RDWR | PG_BINARY, S_IRUSR | S_IWUSR);
      if (fd < 0)
!         elog(CRASH, "could not open control file (%s): %m", ControlFilePath);

      errno = 0;
      if (write(fd, ControlFile, sizeof(ControlFileData)) != sizeof(ControlFileData))
***************
*** 2264,2274 ****
          /* if write didn't set errno, assume problem is no disk space */
          if (errno == 0)
              errno = ENOSPC;
!         elog(STOP, "write to control file failed: %m");
      }

      if (pg_fsync(fd) != 0)
!         elog(STOP, "fsync of control file failed: %m");

      close(fd);
  }
--- 2264,2274 ----
          /* if write didn't set errno, assume problem is no disk space */
          if (errno == 0)
              errno = ENOSPC;
!         elog(CRASH, "write to control file failed: %m");
      }

      if (pg_fsync(fd) != 0)
!         elog(CRASH, "fsync of control file failed: %m");

      close(fd);
  }
***************
*** 2408,2418 ****
          /* if write didn't set errno, assume problem is no disk space */
          if (errno == 0)
              errno = ENOSPC;
!         elog(STOP, "BootStrapXLOG failed to write log file: %m");
      }

      if (pg_fsync(openLogFile) != 0)
!         elog(STOP, "BootStrapXLOG failed to fsync log file: %m");

      close(openLogFile);
      openLogFile = -1;
--- 2408,2418 ----
          /* if write didn't set errno, assume problem is no disk space */
          if (errno == 0)
              errno = ENOSPC;
!         elog(CRASH, "BootStrapXLOG failed to write log file: %m");
      }

      if (pg_fsync(openLogFile) != 0)
!         elog(CRASH, "BootStrapXLOG failed to fsync log file: %m");

      close(openLogFile);
      openLogFile = -1;
***************
*** 2478,2484 ****
          ControlFile->state < DB_SHUTDOWNED ||
          ControlFile->state > DB_IN_PRODUCTION ||
          !XRecOffIsValid(ControlFile->checkPoint.xrecoff))
!         elog(STOP, "control file context is broken");

      if (ControlFile->state == DB_SHUTDOWNED)
          elog(LOG, "database system was shut down at %s",
--- 2478,2484 ----
          ControlFile->state < DB_SHUTDOWNED ||
          ControlFile->state > DB_IN_PRODUCTION ||
          !XRecOffIsValid(ControlFile->checkPoint.xrecoff))
!         elog(CRASH, "control file context is broken");

      if (ControlFile->state == DB_SHUTDOWNED)
          elog(LOG, "database system was shut down at %s",
***************
*** 2517,2523 ****
              InRecovery = true;    /* force recovery even if SHUTDOWNED */
          }
          else
!             elog(STOP, "unable to locate a valid checkpoint record");
      }
      LastRec = RecPtr = checkPointLoc;
      memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint));
--- 2517,2523 ----
              InRecovery = true;    /* force recovery even if SHUTDOWNED */
          }
          else
!             elog(CRASH, "unable to locate a valid checkpoint record");
      }
      LastRec = RecPtr = checkPointLoc;
      memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint));
***************
*** 2530,2536 ****
      elog(LOG, "next transaction id: %u; next oid: %u",
           checkPoint.nextXid, checkPoint.nextOid);
      if (!TransactionIdIsNormal(checkPoint.nextXid))
!         elog(STOP, "invalid next transaction id");

      ShmemVariableCache->nextXid = checkPoint.nextXid;
      ShmemVariableCache->nextOid = checkPoint.nextOid;
--- 2530,2536 ----
      elog(LOG, "next transaction id: %u; next oid: %u",
           checkPoint.nextXid, checkPoint.nextOid);
      if (!TransactionIdIsNormal(checkPoint.nextXid))
!         elog(CRASH, "invalid next transaction id");

      ShmemVariableCache->nextXid = checkPoint.nextXid;
      ShmemVariableCache->nextOid = checkPoint.nextOid;
***************
*** 2541,2547 ****
          XLogCtl->RedoRecPtr = checkPoint.redo;

      if (XLByteLT(RecPtr, checkPoint.redo))
!         elog(STOP, "invalid redo in checkpoint record");
      if (checkPoint.undo.xrecoff == 0)
          checkPoint.undo = RecPtr;

--- 2541,2547 ----
          XLogCtl->RedoRecPtr = checkPoint.redo;

      if (XLByteLT(RecPtr, checkPoint.redo))
!         elog(CRASH, "invalid redo in checkpoint record");
      if (checkPoint.undo.xrecoff == 0)
          checkPoint.undo = RecPtr;

***************
*** 2549,2555 ****
          XLByteLT(checkPoint.redo, RecPtr))
      {
          if (wasShutdown)
!             elog(STOP, "invalid redo/undo record in shutdown checkpoint");
          InRecovery = true;
      }
      else if (ControlFile->state != DB_SHUTDOWNED)
--- 2549,2555 ----
          XLByteLT(checkPoint.redo, RecPtr))
      {
          if (wasShutdown)
!             elog(CRASH, "invalid redo/undo record in shutdown checkpoint");
          InRecovery = true;
      }
      else if (ControlFile->state != DB_SHUTDOWNED)
***************
*** 2568,2574 ****

          /* Is REDO required ? */
          if (XLByteLT(checkPoint.redo, RecPtr))
!             record = ReadRecord(&(checkPoint.redo), STOP, buffer);
          else
          {
              /* read past CheckPoint record */
--- 2568,2574 ----

          /* Is REDO required ? */
          if (XLByteLT(checkPoint.redo, RecPtr))
!             record = ReadRecord(&(checkPoint.redo), CRASH, buffer);
          else
          {
              /* read past CheckPoint record */
***************
*** 2622,2628 ****
       * Init xlog buffer cache using the block containing the last valid
       * record from the previous incarnation.
       */
!     record = ReadRecord(&LastRec, STOP, buffer);
      EndOfLog = EndRecPtr;
      XLByteToPrevSeg(EndOfLog, openLogId, openLogSeg);
      openLogFile = XLogFileOpen(openLogId, openLogSeg, false);
--- 2622,2628 ----
       * Init xlog buffer cache using the block containing the last valid
       * record from the previous incarnation.
       */
!     record = ReadRecord(&LastRec, CRASH, buffer);
      EndOfLog = EndRecPtr;
      XLByteToPrevSeg(EndOfLog, openLogId, openLogSeg);
      openLogFile = XLogFileOpen(openLogId, openLogSeg, false);
***************
*** 2701,2707 ****
                   RecPtr.xlogid, RecPtr.xrecoff);
              do
              {
!                 record = ReadRecord(&RecPtr, STOP, buffer);
                  if (TransactionIdIsValid(record->xl_xid) &&
                      !TransactionIdDidCommit(record->xl_xid))
                      RmgrTable[record->xl_rmid].rm_undo(EndRecPtr, record);
--- 2701,2707 ----
                   RecPtr.xlogid, RecPtr.xrecoff);
              do
              {
!                 record = ReadRecord(&RecPtr, CRASH, buffer);
                  if (TransactionIdIsValid(record->xl_xid) &&
                      !TransactionIdDidCommit(record->xl_xid))
                      RmgrTable[record->xl_rmid].rm_undo(EndRecPtr, record);
***************
*** 2995,3001 ****
      checkPoint.undo = GetUndoRecPtr();

      if (shutdown && checkPoint.undo.xrecoff != 0)
!         elog(STOP, "active transaction while database system is shutting down");
  #endif

      /*
--- 2995,3001 ----
      checkPoint.undo = GetUndoRecPtr();

      if (shutdown && checkPoint.undo.xrecoff != 0)
!         elog(CRASH, "active transaction while database system is shutting down");
  #endif

      /*
***************
*** 3043,3049 ****
       * recptr = end of actual checkpoint record.
       */
      if (shutdown && !XLByteEQ(checkPoint.redo, ProcLastRecPtr))
!         elog(STOP, "concurrent transaction log activity while database system is shutting down");

      /*
       * Select point at which we can truncate the log, which we base on the
--- 3043,3049 ----
       * recptr = end of actual checkpoint record.
       */
      if (shutdown && !XLByteEQ(checkPoint.redo, ProcLastRecPtr))
!         elog(CRASH, "concurrent transaction log activity while database system is shutting down");

      /*
       * Select point at which we can truncate the log, which we base on the
***************
*** 3297,3308 ****
          if (openLogFile >= 0)
          {
              if (pg_fsync(openLogFile) != 0)
!                 elog(STOP, "fsync of log file %u, segment %u failed: %m",
                       openLogId, openLogSeg);
              if (open_sync_bit != new_sync_bit)
              {
                  if (close(openLogFile) != 0)
!                     elog(STOP, "close of log file %u, segment %u failed: %m",
                           openLogId, openLogSeg);
                  openLogFile = -1;
              }
--- 3297,3308 ----
          if (openLogFile >= 0)
          {
              if (pg_fsync(openLogFile) != 0)
!                 elog(CRASH, "fsync of log file %u, segment %u failed: %m",
                       openLogId, openLogSeg);
              if (open_sync_bit != new_sync_bit)
              {
                  if (close(openLogFile) != 0)
!                     elog(CRASH, "close of log file %u, segment %u failed: %m",
                           openLogId, openLogSeg);
                  openLogFile = -1;
              }
***************
*** 3323,3335 ****
      {
          case SYNC_METHOD_FSYNC:
              if (pg_fsync(openLogFile) != 0)
!                 elog(STOP, "fsync of log file %u, segment %u failed: %m",
                       openLogId, openLogSeg);
              break;
  #ifdef HAVE_FDATASYNC
          case SYNC_METHOD_FDATASYNC:
              if (pg_fdatasync(openLogFile) != 0)
!                 elog(STOP, "fdatasync of log file %u, segment %u failed: %m",
                       openLogId, openLogSeg);
              break;
  #endif
--- 3323,3335 ----
      {
          case SYNC_METHOD_FSYNC:
              if (pg_fsync(openLogFile) != 0)
!                 elog(CRASH, "fsync of log file %u, segment %u failed: %m",
                       openLogId, openLogSeg);
              break;
  #ifdef HAVE_FDATASYNC
          case SYNC_METHOD_FDATASYNC:
              if (pg_fdatasync(openLogFile) != 0)
!                 elog(CRASH, "fdatasync of log file %u, segment %u failed: %m",
                       openLogId, openLogSeg);
              break;
  #endif
***************
*** 3337,3343 ****
              /* write synced it already */
              break;
          default:
!             elog(STOP, "bogus wal_sync_method %d", sync_method);
              break;
      }
  }
--- 3337,3343 ----
              /* write synced it already */
              break;
          default:
!             elog(CRASH, "bogus wal_sync_method %d", sync_method);
              break;
      }
  }
Index: src/backend/access/transam/xlogutils.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/xlogutils.c,v
retrieving revision 1.21
diff -c -r1.21 xlogutils.c
*** src/backend/access/transam/xlogutils.c    2001/10/25 05:49:22    1.21
--- src/backend/access/transam/xlogutils.c    2002/02/19 04:55:02
***************
*** 249,255 ****
      hentry = (XLogRelCacheEntry *) hash_search(_xlrelcache,
                    (void *) &(rdesc->reldata.rd_node), HASH_REMOVE, NULL);
      if (hentry == NULL)
!         elog(STOP, "_xl_remove_hash_entry: file was not found in cache");

      if (rdesc->reldata.rd_fd >= 0)
          smgrclose(DEFAULT_SMGR, &(rdesc->reldata));
--- 249,255 ----
      hentry = (XLogRelCacheEntry *) hash_search(_xlrelcache,
                    (void *) &(rdesc->reldata.rd_node), HASH_REMOVE, NULL);
      if (hentry == NULL)
!         elog(CRASH, "_xl_remove_hash_entry: file was not found in cache");

      if (rdesc->reldata.rd_fd >= 0)
          smgrclose(DEFAULT_SMGR, &(rdesc->reldata));
***************
*** 346,355 ****
              hash_search(_xlrelcache, (void *) &rnode, HASH_ENTER, &found);

          if (hentry == NULL)
!             elog(STOP, "XLogOpenRelation: out of memory for cache");

          if (found)
!             elog(STOP, "XLogOpenRelation: file found on insert into cache");

          hentry->rdesc = res;

--- 346,355 ----
              hash_search(_xlrelcache, (void *) &rnode, HASH_ENTER, &found);

          if (hentry == NULL)
!             elog(CRASH, "XLogOpenRelation: out of memory for cache");

          if (found)
!             elog(CRASH, "XLogOpenRelation: file found on insert into cache");

          hentry->rdesc = res;

Index: src/backend/bootstrap/bootstrap.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v
retrieving revision 1.120
diff -c -r1.120 bootstrap.c
*** src/backend/bootstrap/bootstrap.c    2002/01/10 01:11:45    1.120
--- src/backend/bootstrap/bootstrap.c    2002/02/19 04:55:03
***************
*** 392,398 ****
              proc_exit(0);        /* done */

          default:
!             elog(STOP, "Unsupported XLOG op %d", xlogop);
              proc_exit(0);
      }

--- 392,398 ----
              proc_exit(0);        /* done */

          default:
!             elog(CRASH, "Unsupported XLOG op %d", xlogop);
              proc_exit(0);
      }

Index: src/backend/commands/analyze.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/analyze.c,v
retrieving revision 1.25
diff -c -r1.25 analyze.c
*** src/backend/commands/analyze.c    2002/01/06 00:37:44    1.25
--- src/backend/commands/analyze.c    2002/02/19 04:55:04
***************
*** 106,113 ****
  #define swapDatum(a,b)    do {Datum _tmp; _tmp=a; a=b; b=_tmp;} while(0)


- static int    MESSAGE_LEVEL;
-
  /* context information for compare_scalars() */
  static FmgrInfo *datumCmpFn;
  static SortFunctionKind datumCmpFnKind;
--- 106,111 ----
***************
*** 150,160 ****
      HeapTuple  *rows;
      HeapTuple    tuple;

-     if (vacstmt->verbose)
-         MESSAGE_LEVEL = NOTICE;
-     else
-         MESSAGE_LEVEL = DEBUG;
-
      /*
       * Begin a transaction for analyzing this relation.
       *
--- 148,153 ----
***************
*** 214,220 ****
          return;
      }

!     elog(MESSAGE_LEVEL, "Analyzing %s", RelationGetRelationName(onerel));

      /*
       * Determine which columns to analyze
--- 207,213 ----
          return;
      }

!     elog(INFO, "Analyzing %s", RelationGetRelationName(onerel));

      /*
       * Determine which columns to analyze
Index: src/backend/commands/async.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/async.c,v
retrieving revision 1.81
diff -c -r1.81 async.c
*** src/backend/commands/async.c    2001/10/25 05:49:23    1.81
--- src/backend/commands/async.c    2002/02/19 04:55:05
***************
*** 861,867 ****
           */
      }
      else
!         elog(NOTICE, "NOTIFY for %s", relname);
  }

  /* Does pendingNotifies include the given relname? */
--- 861,867 ----
           */
      }
      else
!         elog(INFO, "NOTIFY for %s", relname);
  }

  /* Does pendingNotifies include the given relname? */
Index: src/backend/commands/command.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/command.c,v
retrieving revision 1.153
diff -c -r1.153 command.c
*** src/backend/commands/command.c    2002/02/14 15:24:06    1.153
--- src/backend/commands/command.c    2002/02/19 04:55:06
***************
*** 1582,1589 ****
               constrName);
      /* Otherwise if more than one constraint deleted, notify */
      else if (deleted > 1)
!         elog(NOTICE, "Multiple constraints dropped");
!
  }


--- 1582,1588 ----
               constrName);
      /* Otherwise if more than one constraint deleted, notify */
      else if (deleted > 1)
!         elog(INFO, "Multiple constraints dropped");
  }


Index: src/backend/commands/creatinh.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/creatinh.c,v
retrieving revision 1.81
diff -c -r1.81 creatinh.c
*** src/backend/commands/creatinh.c    2001/10/25 05:49:24    1.81
--- src/backend/commands/creatinh.c    2002/02/19 04:55:07
***************
*** 425,431 ****
                   * Yes, try to merge the two column definitions. They must
                   * have the same type and typmod.
                   */
!                 elog(NOTICE, "CREATE TABLE: merging multiple inherited definitions of attribute \"%s\"",
                       attributeName);
                  def = (ColumnDef *) nth(exist_attno - 1, inhSchema);
                  if (strcmp(def->typename->name, attributeType) != 0 ||
--- 425,431 ----
                   * Yes, try to merge the two column definitions. They must
                   * have the same type and typmod.
                   */
!                 elog(INFO, "CREATE TABLE: merging multiple inherited definitions of attribute \"%s\"",
                       attributeName);
                  def = (ColumnDef *) nth(exist_attno - 1, inhSchema);
                  if (strcmp(def->typename->name, attributeType) != 0 ||
***************
*** 564,570 ****
                   * Yes, try to merge the two column definitions. They must
                   * have the same type and typmod.
                   */
!                 elog(NOTICE, "CREATE TABLE: merging attribute \"%s\" with inherited definition",
                       attributeName);
                  def = (ColumnDef *) nth(exist_attno - 1, inhSchema);
                  if (strcmp(def->typename->name, attributeType) != 0 ||
--- 564,570 ----
                   * Yes, try to merge the two column definitions. They must
                   * have the same type and typmod.
                   */
!                 elog(INFO, "CREATE TABLE: merging attribute \"%s\" with inherited definition",
                       attributeName);
                  def = (ColumnDef *) nth(exist_attno - 1, inhSchema);
                  if (strcmp(def->typename->name, attributeType) != 0 ||
Index: src/backend/commands/define.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/define.c,v
retrieving revision 1.64
diff -c -r1.64 define.c
*** src/backend/commands/define.c    2001/10/28 06:25:42    1.64
--- src/backend/commands/define.c    2002/02/19 04:55:07
***************
*** 398,409 ****
          else if (strcasecmp(defel->defname, "precedence") == 0)
          {
              /* NOT IMPLEMENTED (never worked in v4.2) */
!             elog(NOTICE, "CREATE OPERATOR: precedence not implemented");
          }
          else if (strcasecmp(defel->defname, "associativity") == 0)
          {
              /* NOT IMPLEMENTED (never worked in v4.2) */
!             elog(NOTICE, "CREATE OPERATOR: associativity not implemented");
          }
          else if (strcasecmp(defel->defname, "commutator") == 0)
              commutatorName = defGetString(defel);
--- 398,409 ----
          else if (strcasecmp(defel->defname, "precedence") == 0)
          {
              /* NOT IMPLEMENTED (never worked in v4.2) */
!             elog(INFO, "CREATE OPERATOR: precedence not implemented");
          }
          else if (strcasecmp(defel->defname, "associativity") == 0)
          {
              /* NOT IMPLEMENTED (never worked in v4.2) */
!             elog(INFO, "CREATE OPERATOR: associativity not implemented");
          }
          else if (strcasecmp(defel->defname, "commutator") == 0)
              commutatorName = defGetString(defel);
Index: src/backend/commands/explain.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/explain.c,v
retrieving revision 1.67
diff -c -r1.67 explain.c
*** src/backend/commands/explain.c    2001/10/25 05:49:25    1.67
--- src/backend/commands/explain.c    2002/02/19 04:55:07
***************
*** 59,65 ****
      /* rewriter will not cope with utility statements */
      if (query->commandType == CMD_UTILITY)
      {
!         elog(NOTICE, "Utility statements have no plan structure");
          return;
      }

--- 59,65 ----
      /* rewriter will not cope with utility statements */
      if (query->commandType == CMD_UTILITY)
      {
!         elog(INFO, "Utility statements have no plan structure");
          return;
      }

***************
*** 69,75 ****
      /* In the case of an INSTEAD NOTHING, tell at least that */
      if (rewritten == NIL)
      {
!         elog(NOTICE, "Query rewrites to nothing");
          return;
      }

--- 69,75 ----
      /* In the case of an INSTEAD NOTHING, tell at least that */
      if (rewritten == NIL)
      {
!         elog(INFO, "Query rewrites to nothing");
          return;
      }

***************
*** 94,102 ****
      if (query->commandType == CMD_UTILITY)
      {
          if (query->utilityStmt && IsA(query->utilityStmt, NotifyStmt))
!             elog(NOTICE, "QUERY PLAN:\n\nNOTIFY\n");
          else
!             elog(NOTICE, "QUERY PLAN:\n\nUTILITY\n");
          return;
      }

--- 94,102 ----
      if (query->commandType == CMD_UTILITY)
      {
          if (query->utilityStmt && IsA(query->utilityStmt, NotifyStmt))
!             elog(INFO, "QUERY PLAN:\n\nNOTIFY\n");
          else
!             elog(INFO, "QUERY PLAN:\n\nUTILITY\n");
          return;
      }

***************
*** 152,158 ****
          s = nodeToString(plan);
          if (s)
          {
!             elog(NOTICE, "QUERY DUMP:\n\n%s", s);
              pfree(s);
          }
      }
--- 152,158 ----
          s = nodeToString(plan);
          if (s)
          {
!             elog(INFO, "QUERY DUMP:\n\n%s", s);
              pfree(s);
          }
      }
***************
*** 165,171 ****
          if (analyze)
              appendStringInfo(str, "Total runtime: %.2f msec\n",
                               1000.0 * totaltime);
!         elog(NOTICE, "QUERY PLAN:\n\n%s", str->data);
          pfree(str->data);
          pfree(str);
      }
--- 165,171 ----
          if (analyze)
              appendStringInfo(str, "Total runtime: %.2f msec\n",
                               1000.0 * totaltime);
!         elog(INFO, "QUERY PLAN:\n\n%s", str->data);
          pfree(str->data);
          pfree(str);
      }
Index: src/backend/commands/sequence.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/sequence.c,v
retrieving revision 1.68
diff -c -r1.68 sequence.c
*** src/backend/commands/sequence.c    2002/01/11 18:16:04    1.68
--- src/backend/commands/sequence.c    2002/02/19 04:55:08
***************
*** 879,885 ****
      sequence_magic *sm;

      if (info != XLOG_SEQ_LOG)
!         elog(STOP, "seq_redo: unknown op code %u", info);

      reln = XLogOpenRelation(true, RM_SEQ_ID, xlrec->node);
      if (!RelationIsValid(reln))
--- 879,885 ----
      sequence_magic *sm;

      if (info != XLOG_SEQ_LOG)
!         elog(CRASH, "seq_redo: unknown op code %u", info);

      reln = XLogOpenRelation(true, RM_SEQ_ID, xlrec->node);
      if (!RelationIsValid(reln))
***************
*** 887,893 ****

      buffer = XLogReadBuffer(true, reln, 0);
      if (!BufferIsValid(buffer))
!         elog(STOP, "seq_redo: can't read block of %u/%u",
               xlrec->node.tblNode, xlrec->node.relNode);

      page = (Page) BufferGetPage(buffer);
--- 887,893 ----

      buffer = XLogReadBuffer(true, reln, 0);
      if (!BufferIsValid(buffer))
!         elog(CRASH, "seq_redo: can't read block of %u/%u",
               xlrec->node.tblNode, xlrec->node.relNode);

      page = (Page) BufferGetPage(buffer);
***************
*** 903,909 ****
      itemsz = MAXALIGN(itemsz);
      if (PageAddItem(page, (Item) item, itemsz,
                      FirstOffsetNumber, LP_USED) == InvalidOffsetNumber)
!         elog(STOP, "seq_redo: failed to add item to page");

      PageSetLSN(page, lsn);
      PageSetSUI(page, ThisStartUpID);
--- 903,909 ----
      itemsz = MAXALIGN(itemsz);
      if (PageAddItem(page, (Item) item, itemsz,
                      FirstOffsetNumber, LP_USED) == InvalidOffsetNumber)
!         elog(CRASH, "seq_redo: failed to add item to page");

      PageSetLSN(page, lsn);
      PageSetSUI(page, ThisStartUpID);
Index: src/backend/commands/trigger.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/trigger.c,v
retrieving revision 1.101
diff -c -r1.101 trigger.c
*** src/backend/commands/trigger.c    2002/01/15 16:52:47    1.101
--- src/backend/commands/trigger.c    2002/02/19 04:55:09
***************
*** 363,369 ****
          elog(ERROR, "DropTrigger: there is no trigger %s on relation %s",
               stmt->trigname, stmt->relname);
      if (tgfound > 1)
!         elog(NOTICE, "DropTrigger: found (and deleted) %d triggers %s on relation %s",
               tgfound, stmt->trigname, stmt->relname);
      heap_endscan(tgscan);
      heap_close(tgrel, RowExclusiveLock);
--- 363,369 ----
          elog(ERROR, "DropTrigger: there is no trigger %s on relation %s",
               stmt->trigname, stmt->relname);
      if (tgfound > 1)
!         elog(INFO, "DropTrigger: found (and deleted) %d triggers %s on relation %s",
               tgfound, stmt->trigname, stmt->relname);
      heap_endscan(tgscan);
      heap_close(tgrel, RowExclusiveLock);
***************
*** 485,491 ****
          stmt.relname = pstrdup(RelationGetRelationName(refrel));
          heap_close(refrel, NoLock);

!         elog(NOTICE, "DROP TABLE implicitly drops referential integrity trigger from table \"%s\"", stmt.relname);

          DropTrigger(&stmt);

--- 485,491 ----
          stmt.relname = pstrdup(RelationGetRelationName(refrel));
          heap_close(refrel, NoLock);

!         elog(INFO, "DROP TABLE implicitly drops referential integrity trigger from table \"%s\"", stmt.relname);

          DropTrigger(&stmt);

Index: src/backend/commands/user.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/user.c,v
retrieving revision 1.90
diff -c -r1.90 user.c
*** src/backend/commands/user.c    2001/11/05 17:46:25    1.90
--- src/backend/commands/user.c    2002/02/19 04:55:10
***************
*** 544,550 ****

      /* changes to the flat password file cannot be rolled back */
      if (IsTransactionBlock() && password)
!         elog(NOTICE, "ALTER USER: password changes cannot be rolled back");

      /*
       * Scan the pg_shadow relation to be certain the user exists. Note we
--- 544,550 ----

      /* changes to the flat password file cannot be rolled back */
      if (IsTransactionBlock() && password)
!         elog(INFO, "ALTER USER: password changes cannot be rolled back");

      /*
       * Scan the pg_shadow relation to be certain the user exists. Note we
***************
*** 698,704 ****
          elog(ERROR, "DROP USER: permission denied");

      if (IsTransactionBlock())
!         elog(NOTICE, "DROP USER cannot be rolled back completely");

      /*
       * Scan the pg_shadow relation to find the usesysid of the user to be
--- 698,704 ----
          elog(ERROR, "DROP USER: permission denied");

      if (IsTransactionBlock())
!         elog(INFO, "DROP USER cannot be rolled back completely");

      /*
       * Scan the pg_shadow relation to find the usesysid of the user to be
Index: src/backend/commands/vacuum.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/vacuum.c,v
retrieving revision 1.213
diff -c -r1.213 vacuum.c
*** src/backend/commands/vacuum.c    2002/01/06 00:37:44    1.213
--- src/backend/commands/vacuum.c    2002/02/19 04:55:12
***************
*** 108,115 ****

  static MemoryContext vac_context = NULL;

- static int    MESSAGE_LEVEL;        /* message level */
-
  static TransactionId OldestXmin;
  static TransactionId FreezeLimit;

--- 108,113 ----
***************
*** 191,201 ****
       */
      pgstat_vacuum_tabstat();

-     if (vacstmt->verbose)
-         MESSAGE_LEVEL = NOTICE;
-     else
-         MESSAGE_LEVEL = DEBUG;
-
      /*
       * Create special memory context for cross-transaction storage.
       *
--- 189,194 ----
***************
*** 971,977 ****
      vac_init_rusage(&ru0);

      relname = RelationGetRelationName(onerel);
!     elog(MESSAGE_LEVEL, "--Relation %s--", relname);

      empty_pages = new_pages = changed_pages = empty_end_pages = 0;
      num_tuples = tups_vacuumed = nkeep = nunused = 0;
--- 964,970 ----
      vac_init_rusage(&ru0);

      relname = RelationGetRelationName(onerel);
!     elog(INFO, "--Relation %s--", relname);

      empty_pages = new_pages = changed_pages = empty_end_pages = 0;
      num_tuples = tups_vacuumed = nkeep = nunused = 0;
***************
*** 1282,1288 ****
          pfree(vtlinks);
      }

!     elog(MESSAGE_LEVEL, "Pages %u: Changed %u, reaped %u, Empty %u, New %u; \
  Tup %.0f: Vac %.0f, Keep/VTL %.0f/%u, UnUsed %.0f, MinLen %lu, MaxLen %lu; \
  Re-using: Free/Avail. Space %.0f/%.0f; EndEmpty/Avail. Pages %u/%u.\n\t%s",
           nblocks, changed_pages, vacuum_pages->num_pages, empty_pages,
--- 1275,1281 ----
          pfree(vtlinks);
      }

!     elog(INFO, "Pages %u: Changed %u, reaped %u, Empty %u, New %u; \
  Tup %.0f: Vac %.0f, Keep/VTL %.0f/%u, UnUsed %.0f, MinLen %lu, MaxLen %lu; \
  Re-using: Free/Avail. Space %.0f/%.0f; EndEmpty/Avail. Pages %u/%u.\n\t%s",
           nblocks, changed_pages, vacuum_pages->num_pages, empty_pages,
***************
*** 1856,1862 ****
                                           InvalidOffsetNumber, LP_USED);
                      if (newoff == InvalidOffsetNumber)
                      {
!                         elog(STOP, "moving chain: failed to add item with len = %lu to page %u",
                            (unsigned long) tuple_len, destvacpage->blkno);
                      }
                      newitemid = PageGetItemId(ToPage, newoff);
--- 1849,1855 ----
                                           InvalidOffsetNumber, LP_USED);
                      if (newoff == InvalidOffsetNumber)
                      {
!                         elog(CRASH, "moving chain: failed to add item with len = %lu to page %u",
                            (unsigned long) tuple_len, destvacpage->blkno);
                      }
                      newitemid = PageGetItemId(ToPage, newoff);
***************
*** 1979,1985 ****
                                   InvalidOffsetNumber, LP_USED);
              if (newoff == InvalidOffsetNumber)
              {
!                 elog(STOP, "failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)",
                       (unsigned long) tuple_len,
                       cur_page->blkno, (unsigned long) cur_page->free,
                       cur_page->offsets_used, cur_page->offsets_free);
--- 1972,1978 ----
                                   InvalidOffsetNumber, LP_USED);
              if (newoff == InvalidOffsetNumber)
              {
!                 elog(CRASH, "failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)",
                       (unsigned long) tuple_len,
                       cur_page->blkno, (unsigned long) cur_page->free,
                       cur_page->offsets_used, cur_page->offsets_free);
***************
*** 2204,2210 ****
      }
      Assert(num_moved == checked_moved);

!     elog(MESSAGE_LEVEL, "Rel %s: Pages: %u --> %u; Tuple(s) moved: %u.\n\t%s",
           RelationGetRelationName(onerel),
           nblocks, blkno, num_moved,
           vac_show_rusage(&ru0));
--- 2197,2203 ----
      }
      Assert(num_moved == checked_moved);

!     elog(INFO, "Rel %s: Pages: %u --> %u; Tuple(s) moved: %u.\n\t%s",
           RelationGetRelationName(onerel),
           nblocks, blkno, num_moved,
           vac_show_rusage(&ru0));
***************
*** 2376,2382 ****
      /* truncate relation if there are some empty end-pages */
      if (vacuum_pages->empty_end_pages > 0)
      {
!         elog(MESSAGE_LEVEL, "Rel %s: Pages: %u --> %u.",
               RelationGetRelationName(onerel),
               vacrelstats->rel_pages, relblocks);
          relblocks = smgrtruncate(DEFAULT_SMGR, onerel, relblocks);
--- 2369,2375 ----
      /* truncate relation if there are some empty end-pages */
      if (vacuum_pages->empty_end_pages > 0)
      {
!         elog(INFO, "Rel %s: Pages: %u --> %u.",
               RelationGetRelationName(onerel),
               vacrelstats->rel_pages, relblocks);
          relblocks = smgrtruncate(DEFAULT_SMGR, onerel, relblocks);
***************
*** 2450,2456 ****
                          stats->num_pages, stats->num_index_tuples,
                          false);

!     elog(MESSAGE_LEVEL, "Index %s: Pages %u; Tuples %.0f.\n\t%s",
           RelationGetRelationName(indrel),
           stats->num_pages, stats->num_index_tuples,
           vac_show_rusage(&ru0));
--- 2443,2449 ----
                          stats->num_pages, stats->num_index_tuples,
                          false);

!     elog(INFO, "Index %s: Pages %u; Tuples %.0f.\n\t%s",
           RelationGetRelationName(indrel),
           stats->num_pages, stats->num_index_tuples,
           vac_show_rusage(&ru0));
***************
*** 2504,2510 ****
                          stats->num_pages, stats->num_index_tuples,
                          false);

!     elog(MESSAGE_LEVEL, "Index %s: Pages %u; Tuples %.0f: Deleted %.0f.\n\t%s",
           RelationGetRelationName(indrel), stats->num_pages,
           stats->num_index_tuples - keep_tuples, stats->tuples_removed,
           vac_show_rusage(&ru0));
--- 2497,2503 ----
                          stats->num_pages, stats->num_index_tuples,
                          false);

!     elog(INFO, "Index %s: Pages %u; Tuples %.0f: Deleted %.0f.\n\t%s",
           RelationGetRelationName(indrel), stats->num_pages,
           stats->num_index_tuples - keep_tuples, stats->tuples_removed,
           vac_show_rusage(&ru0));
Index: src/backend/commands/vacuumlazy.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/vacuumlazy.c,v
retrieving revision 1.11
diff -c -r1.11 vacuumlazy.c
*** src/backend/commands/vacuumlazy.c    2002/01/06 00:37:44    1.11
--- src/backend/commands/vacuumlazy.c    2002/02/19 04:55:12
***************
*** 92,99 ****
  } LVRelStats;


- static int    MESSAGE_LEVEL;        /* message level */
-
  static TransactionId OldestXmin;
  static TransactionId FreezeLimit;

--- 92,97 ----
***************
*** 138,149 ****
      bool        hasindex;
      BlockNumber possibly_freeable;

-     /* initialize */
-     if (vacstmt->verbose)
-         MESSAGE_LEVEL = NOTICE;
-     else
-         MESSAGE_LEVEL = DEBUG;
-
      vacuum_set_xid_limits(vacstmt, onerel->rd_rel->relisshared,
                            &OldestXmin, &FreezeLimit);

--- 136,141 ----
***************
*** 208,214 ****
      vac_init_rusage(&ru0);

      relname = RelationGetRelationName(onerel);
!     elog(MESSAGE_LEVEL, "--Relation %s--", relname);

      empty_pages = changed_pages = 0;
      num_tuples = tups_vacuumed = nkeep = nunused = 0;
--- 200,206 ----
      vac_init_rusage(&ru0);

      relname = RelationGetRelationName(onerel);
!     elog(INFO, "--Relation %s--", relname);

      empty_pages = changed_pages = 0;
      num_tuples = tups_vacuumed = nkeep = nunused = 0;
***************
*** 430,436 ****
              lazy_scan_index(Irel[i], vacrelstats);
      }

!     elog(MESSAGE_LEVEL, "Pages %u: Changed %u, Empty %u; \
  Tup %.0f: Vac %.0f, Keep %.0f, UnUsed %.0f.\n\tTotal %s",
           nblocks, changed_pages, empty_pages,
           num_tuples, tups_vacuumed, nkeep, nunused,
--- 422,428 ----
              lazy_scan_index(Irel[i], vacrelstats);
      }

!     elog(INFO, "Pages %u: Changed %u, Empty %u; \
  Tup %.0f: Vac %.0f, Keep %.0f, UnUsed %.0f.\n\tTotal %s",
           nblocks, changed_pages, empty_pages,
           num_tuples, tups_vacuumed, nkeep, nunused,
***************
*** 481,487 ****
          npages++;
      }

!     elog(MESSAGE_LEVEL, "Removed %d tuples in %d pages.\n\t%s",
           tupindex, npages,
           vac_show_rusage(&ru0));
  }
--- 473,479 ----
          npages++;
      }

!     elog(INFO, "Removed %d tuples in %d pages.\n\t%s",
           tupindex, npages,
           vac_show_rusage(&ru0));
  }
***************
*** 589,595 ****
                          stats->num_pages, stats->num_index_tuples,
                          false);

!     elog(MESSAGE_LEVEL, "Index %s: Pages %u; Tuples %.0f.\n\t%s",
           RelationGetRelationName(indrel),
           stats->num_pages, stats->num_index_tuples,
           vac_show_rusage(&ru0));
--- 581,587 ----
                          stats->num_pages, stats->num_index_tuples,
                          false);

!     elog(INFO, "Index %s: Pages %u; Tuples %.0f.\n\t%s",
           RelationGetRelationName(indrel),
           stats->num_pages, stats->num_index_tuples,
           vac_show_rusage(&ru0));
***************
*** 636,642 ****
                              stats->num_pages, stats->num_index_tuples,
                              false);

!         elog(MESSAGE_LEVEL, "Index %s: Pages %u; Tuples %.0f: Deleted %.0f.\n\t%s",
               RelationGetRelationName(indrel), stats->num_pages,
               stats->num_index_tuples, stats->tuples_removed,
               vac_show_rusage(&ru0));
--- 628,634 ----
                              stats->num_pages, stats->num_index_tuples,
                              false);

!         elog(INFO, "Index %s: Pages %u; Tuples %.0f: Deleted %.0f.\n\t%s",
               RelationGetRelationName(indrel), stats->num_pages,
               stats->num_index_tuples, stats->tuples_removed,
               vac_show_rusage(&ru0));
***************
*** 746,752 ****
       * We keep the exclusive lock until commit (perhaps not necessary)?
       */

!     elog(MESSAGE_LEVEL, "Truncated %u --> %u pages.\n\t%s",
           old_rel_pages, new_rel_pages,
           vac_show_rusage(&ru0));
  }
--- 738,744 ----
       * We keep the exclusive lock until commit (perhaps not necessary)?
       */

!     elog(INFO, "Truncated %u --> %u pages.\n\t%s",
           old_rel_pages, new_rel_pages,
           vac_show_rusage(&ru0));
  }
Index: src/backend/commands/variable.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/variable.c,v
retrieving revision 1.57
diff -c -r1.57 variable.c
*** src/backend/commands/variable.c    2001/12/09 04:37:50    1.57
--- src/backend/commands/variable.c    2002/02/19 04:55:13
***************
*** 295,301 ****
      strcat(buf, ((EuroDates) ? "European" : "US (NonEuropean)"));
      strcat(buf, " conventions");

!     elog(NOTICE, buf, NULL);

      return TRUE;
  }
--- 295,301 ----
      strcat(buf, ((EuroDates) ? "European" : "US (NonEuropean)"));
      strcat(buf, " conventions");

!     elog(INFO, buf, NULL);

      return TRUE;
  }
***************
*** 482,490 ****
          tzn = getenv("TZ");

      if (tzn != NULL)
!         elog(NOTICE, "Time zone is '%s'", tzn);
      else
!         elog(NOTICE, "Time zone is unset");

      return TRUE;
  }    /* show_timezone() */
--- 482,490 ----
          tzn = getenv("TZ");

      if (tzn != NULL)
!         elog(INFO, "Time zone is '%s'", tzn);
      else
!         elog(INFO, "Time zone is unset");

      return TRUE;
  }    /* show_timezone() */
***************
*** 576,584 ****
  {

      if (XactIsoLevel == XACT_SERIALIZABLE)
!         elog(NOTICE, "TRANSACTION ISOLATION LEVEL is SERIALIZABLE");
      else
!         elog(NOTICE, "TRANSACTION ISOLATION LEVEL is READ COMMITTED");
      return TRUE;
  }

--- 576,584 ----
  {

      if (XactIsoLevel == XACT_SERIALIZABLE)
!         elog(INFO, "TRANSACTION ISOLATION LEVEL is SERIALIZABLE");
      else
!         elog(INFO, "TRANSACTION ISOLATION LEVEL is READ COMMITTED");
      return TRUE;
  }

***************
*** 623,629 ****
  static bool
  show_random_seed(void)
  {
!     elog(NOTICE, "Seed for random number generator is unavailable");
      return (TRUE);
  }

--- 623,629 ----
  static bool
  show_random_seed(void)
  {
!     elog(INFO, "Seed for random number generator is unavailable");
      return (TRUE);
  }

***************
*** 690,696 ****
  static bool
  show_client_encoding(void)
  {
!     elog(NOTICE, "Current client encoding is '%s'",
           pg_get_client_encoding_name());
      return TRUE;
  }
--- 690,696 ----
  static bool
  show_client_encoding(void)
  {
!     elog(INFO, "Current client encoding is '%s'",
           pg_get_client_encoding_name());
      return TRUE;
  }
***************
*** 727,747 ****
  static bool
  parse_server_encoding(List *args)
  {
!     elog(NOTICE, "SET SERVER_ENCODING is not supported");
      return TRUE;
  }

  static bool
  show_server_encoding(void)
  {
!     elog(NOTICE, "Current server encoding is '%s'", GetDatabaseEncodingName());
      return TRUE;
  }

  static bool
  reset_server_encoding(void)
  {
!     elog(NOTICE, "RESET SERVER_ENCODING is not supported");
      return TRUE;
  }

--- 727,747 ----
  static bool
  parse_server_encoding(List *args)
  {
!     elog(INFO, "SET SERVER_ENCODING is not supported");
      return TRUE;
  }

  static bool
  show_server_encoding(void)
  {
!     elog(INFO, "Current server encoding is '%s'", GetDatabaseEncodingName());
      return TRUE;
  }

  static bool
  reset_server_encoding(void)
  {
!     elog(INFO, "RESET SERVER_ENCODING is not supported");
      return TRUE;
  }

***************
*** 814,820 ****
      {
          const char *val = GetConfigOption(name);

!         elog(NOTICE, "%s is %s", name, val);
      }
  }

--- 814,820 ----
      {
          const char *val = GetConfigOption(name);

!         elog(INFO, "%s is %s", name, val);
      }
  }

Index: src/backend/parser/analyze.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/parser/analyze.c,v
retrieving revision 1.213
diff -c -r1.213 analyze.c
*** src/backend/parser/analyze.c    2002/01/03 23:21:31    1.213
--- src/backend/parser/analyze.c    2002/02/19 04:55:15
***************
*** 823,829 ****
          sequence->istemp = cxt->istemp;
          sequence->options = NIL;

!         elog(NOTICE, "%s will create implicit sequence '%s' for SERIAL column '%s.%s'",
          cxt->stmtType, sequence->seqname, cxt->relname, column->colname);

          cxt->blist = lappend(cxt->blist, sequence);
--- 823,829 ----
          sequence->istemp = cxt->istemp;
          sequence->options = NIL;

!         elog(INFO, "%s will create implicit sequence '%s' for SERIAL column '%s.%s'",
          cxt->stmtType, sequence->seqname, cxt->relname, column->colname);

          cxt->blist = lappend(cxt->blist, sequence);
***************
*** 1238,1244 ****
              elog(ERROR, "%s: failed to make implicit index name",
                   cxt->stmtType);

!         elog(NOTICE, "%s / %s%s will create implicit index '%s' for table '%s'",
               cxt->stmtType,
               (strcmp(cxt->stmtType, "ALTER TABLE") == 0) ? "ADD " : "",
               (index->primary ? "PRIMARY KEY" : "UNIQUE"),
--- 1238,1244 ----
              elog(ERROR, "%s: failed to make implicit index name",
                   cxt->stmtType);

!         elog(INFO, "%s / %s%s will create implicit index '%s' for table '%s'",
               cxt->stmtType,
               (strcmp(cxt->stmtType, "ALTER TABLE") == 0) ? "ADD " : "",
               (index->primary ? "PRIMARY KEY" : "UNIQUE"),
***************
*** 1262,1268 ****
      if (cxt->fkconstraints == NIL)
          return;

!     elog(NOTICE, "%s will create implicit trigger(s) for FOREIGN KEY check(s)",
           cxt->stmtType);

      foreach(fkclist, cxt->fkconstraints)
--- 1262,1268 ----
      if (cxt->fkconstraints == NIL)
          return;

!     elog(INFO, "%s will create implicit trigger(s) for FOREIGN KEY check(s)",
           cxt->stmtType);

      foreach(fkclist, cxt->fkconstraints)
***************
*** 2681,2687 ****
          elog(ERROR, "unsupported expression in %%TYPE");
      v = (Var *) n;
      tyn = typeidTypeName(v->vartype);
!     elog(NOTICE, "%s.%s%%TYPE converted to %s", tn->name, tn->attrname, tyn);
      tn->name = tyn;
      tn->typmod = v->vartypmod;
      tn->attrname = NULL;
--- 2681,2687 ----
          elog(ERROR, "unsupported expression in %%TYPE");
      v = (Var *) n;
      tyn = typeidTypeName(v->vartype);
!     elog(INFO, "%s.%s%%TYPE converted to %s", tn->name, tn->attrname, tyn);
      tn->name = tyn;
      tn->typmod = v->vartypmod;
      tn->attrname = NULL;
Index: src/backend/parser/gram.y
===================================================================
RCS file: /cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.277
diff -c -r2.277 gram.y
*** src/backend/parser/gram.y    2002/02/18 06:49:20    2.277
--- src/backend/parser/gram.y    2002/02/19 04:55:18
***************
*** 1310,1316 ****
                      n->constraints = $3;

                      if ($4 != NULL)
!                         elog(NOTICE,"CREATE TABLE / COLLATE %s not yet implemented"
                               "; clause ignored", $4);

                      $$ = (Node *)n;
--- 1310,1316 ----
                      n->constraints = $3;

                      if ($4 != NULL)
!                         elog(INFO,"CREATE TABLE / COLLATE %s not yet implemented"
                               "; clause ignored", $4);

                      $$ = (Node *)n;
***************
*** 2308,2314 ****
          | RELATIVE                        { $$ = RELATIVE; }
          | ABSOLUTE
              {
!                 elog(NOTICE,"FETCH / ABSOLUTE not supported, using RELATIVE");
                  $$ = RELATIVE;
              }
          ;
--- 2308,2314 ----
          | RELATIVE                        { $$ = RELATIVE; }
          | ABSOLUTE
              {
!                 elog(INFO,"FETCH / ABSOLUTE not supported, using RELATIVE");
                  $$ = RELATIVE;
              }
          ;
Index: src/backend/parser/parse_relation.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v
retrieving revision 1.60
diff -c -r1.60 parse_relation.c
*** src/backend/parser/parse_relation.c    2001/11/05 17:46:26    1.60
--- src/backend/parser/parse_relation.c    2002/02/19 04:55:19
***************
*** 1041,1047 ****
          }
      }
      if (foundInFromCl)
!         elog(NOTICE, "Adding missing FROM-clause entry%s for table \"%s\"",
               pstate->parentParseState != NULL ? " in subquery" : "",
               refname);
  }
--- 1041,1047 ----
          }
      }
      if (foundInFromCl)
!         elog(INFO, "Adding missing FROM-clause entry%s for table \"%s\"",
               pstate->parentParseState != NULL ? " in subquery" : "",
               refname);
  }
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.264
diff -c -r1.264 postmaster.c
*** src/backend/postmaster/postmaster.c    2002/01/10 01:11:45    1.264
--- src/backend/postmaster/postmaster.c    2002/02/19 04:55:20
***************
*** 1442,1448 ****
                  break;
              if (ShutdownPID > 0)
              {
!                 elog(REALLYFATAL, "shutdown process %d already running",
                       ShutdownPID);
                  abort();
              }
--- 1442,1448 ----
                  break;
              if (ShutdownPID > 0)
              {
!                 elog(CRASH, "shutdown process %d already running",
                       ShutdownPID);
                  abort();
              }
***************
*** 1486,1492 ****
                  break;
              if (ShutdownPID > 0)
              {
!                 elog(REALLYFATAL, "shutdown process %d already running",
                       ShutdownPID);
                  abort();
              }
--- 1486,1492 ----
                  break;
              if (ShutdownPID > 0)
              {
!                 elog(CRASH, "shutdown process %d already running",
                       ShutdownPID);
                  abort();
              }
***************
*** 1590,1596 ****
              {
                  if (ShutdownPID > 0)
                  {
!                     elog(STOP, "startup process %d died while shutdown process %d already running",
                           pid, ShutdownPID);
                      abort();
                  }
--- 1590,1596 ----
              {
                  if (ShutdownPID > 0)
                  {
!                     elog(CRASH, "startup process %d died while shutdown process %d already running",
                           pid, ShutdownPID);
                      abort();
                  }
Index: src/backend/storage/buffer/bufmgr.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v
retrieving revision 1.120
diff -c -r1.120 bufmgr.c
*** src/backend/storage/buffer/bufmgr.c    2001/11/10 23:51:14    1.120
--- src/backend/storage/buffer/bufmgr.c    2002/02/19 04:55:22
***************
*** 443,449 ****
                   */
                  if (buf->flags & BM_JUST_DIRTIED)
                  {
!                     elog(STOP, "BufferAlloc: content of block %u (%u/%u) changed while flushing",
                           buf->tag.blockNum,
                           buf->tag.rnode.tblNode, buf->tag.rnode.relNode);
                  }
--- 443,449 ----
                   */
                  if (buf->flags & BM_JUST_DIRTIED)
                  {
!                     elog(CRASH, "BufferAlloc: content of block %u (%u/%u) changed while flushing",
                           buf->tag.blockNum,
                           buf->tag.rnode.tblNode, buf->tag.rnode.relNode);
                  }
***************
*** 804,810 ****
          }

          if (status == SM_FAIL)    /* disk failure ?! */
!             elog(STOP, "BufferSync: cannot write %u for %u/%u",
                   bufHdr->tag.blockNum,
                   bufHdr->tag.rnode.tblNode, bufHdr->tag.rnode.relNode);

--- 804,810 ----
          }

          if (status == SM_FAIL)    /* disk failure ?! */
!             elog(CRASH, "BufferSync: cannot write %u for %u/%u",
                   bufHdr->tag.blockNum,
                   bufHdr->tag.rnode.tblNode, bufHdr->tag.rnode.relNode);

***************
*** 1566,1572 ****
                                         (char *) MAKE_PTR(bufHdr->data));

                      if (status == SM_FAIL)        /* disk failure ?! */
!                         elog(STOP, "FlushRelationBuffers: cannot write %u for %u/%u",
                               bufHdr->tag.blockNum,
                               bufHdr->tag.rnode.tblNode,
                               bufHdr->tag.rnode.relNode);
--- 1566,1572 ----
                                         (char *) MAKE_PTR(bufHdr->data));

                      if (status == SM_FAIL)        /* disk failure ?! */
!                         elog(CRASH, "FlushRelationBuffers: cannot write %u for %u/%u",
                               bufHdr->tag.blockNum,
                               bufHdr->tag.rnode.tblNode,
                               bufHdr->tag.rnode.relNode);
Index: src/backend/storage/lmgr/proc.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v
retrieving revision 1.117
diff -c -r1.117 proc.c
*** src/backend/storage/lmgr/proc.c    2001/12/28 18:16:43    1.117
--- src/backend/storage/lmgr/proc.c    2002/02/19 04:55:23
***************
*** 211,217 ****
       * we are a backend, we inherit this by fork() from the postmaster).
       */
      if (procglobal == NULL)
!         elog(STOP, "InitProcess: Proc Header uninitialized");

      if (MyProc != NULL)
          elog(ERROR, "InitProcess: you already exist");
--- 211,217 ----
       * we are a backend, we inherit this by fork() from the postmaster).
       */
      if (procglobal == NULL)
!         elog(CRASH, "InitProcess: Proc Header uninitialized");

      if (MyProc != NULL)
          elog(ERROR, "InitProcess: you already exist");
***************
*** 300,306 ****
       * inherit this by fork() from the postmaster).
       */
      if (ProcGlobal == NULL || DummyProc == NULL)
!         elog(STOP, "InitDummyProcess: Proc Header uninitialized");

      if (MyProc != NULL)
          elog(ERROR, "InitDummyProcess: you already exist");
--- 300,306 ----
       * inherit this by fork() from the postmaster).
       */
      if (ProcGlobal == NULL || DummyProc == NULL)
!         elog(CRASH, "InitDummyProcess: Proc Header uninitialized");

      if (MyProc != NULL)
          elog(ERROR, "InitDummyProcess: you already exist");
Index: src/backend/storage/smgr/smgr.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v
retrieving revision 1.54
diff -c -r1.54 smgr.c
*** src/backend/storage/smgr/smgr.c    2001/10/25 05:49:43    1.54
--- src/backend/storage/smgr/smgr.c    2002/02/19 04:55:23
***************
*** 582,588 ****
          if (smgrsw[i].smgr_sync)
          {
              if ((*(smgrsw[i].smgr_sync)) () == SM_FAIL)
!                 elog(STOP, "storage sync failed on %s: %m",
                       DatumGetCString(DirectFunctionCall1(smgrout,
                                                       Int16GetDatum(i))));
          }
--- 582,588 ----
          if (smgrsw[i].smgr_sync)
          {
              if ((*(smgrsw[i].smgr_sync)) () == SM_FAIL)
!                 elog(CRASH, "storage sync failed on %s: %m",
                       DatumGetCString(DirectFunctionCall1(smgrout,
                                                       Int16GetDatum(i))));
          }
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.245
diff -c -r1.245 postgres.c
*** src/backend/tcop/postgres.c    2002/01/10 01:11:45    1.245
--- src/backend/tcop/postgres.c    2002/02/19 04:55:24
***************
*** 2027,2036 ****
      if (assert_enabled)
      {
          /* val != 0 should be trapped by previous Assert */
!         elog(NOTICE, "Assert test successfull (val = %d)", val);
      }
      else
!         elog(NOTICE, "Assert checking is disabled (val = %d)", val);

      return val;
  }
--- 2027,2036 ----
      if (assert_enabled)
      {
          /* val != 0 should be trapped by previous Assert */
!         elog(INFO, "Assert test successfull (val = %d)", val);
      }
      else
!         elog(INFO, "Assert checking is disabled (val = %d)", val);

      return val;
  }
Index: src/backend/utils/adt/selfuncs.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v
retrieving revision 1.103
diff -c -r1.103 selfuncs.c
*** src/backend/utils/adt/selfuncs.c    2002/01/03 04:02:34    1.103
--- src/backend/utils/adt/selfuncs.c    2002/02/19 04:55:26
***************
*** 2923,2929 ****
          return (bool) result;
      localeptr = setlocale(LC_COLLATE, NULL);
      if (!localeptr)
!         elog(STOP, "Invalid LC_COLLATE setting");

      /*
       * Currently we accept only "C" and "POSIX" (do any systems still
--- 2923,2929 ----
          return (bool) result;
      localeptr = setlocale(LC_COLLATE, NULL);
      if (!localeptr)
!         elog(CRASH, "Invalid LC_COLLATE setting");

      /*
       * Currently we accept only "C" and "POSIX" (do any systems still
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/error/elog.c,v
retrieving revision 1.91
diff -c -r1.91 elog.c
*** src/backend/utils/error/elog.c    2001/11/05 17:46:30    1.91
--- src/backend/utils/error/elog.c    2002/02/19 04:55:27
***************
*** 109,115 ****
       * Note that we use malloc() not palloc() because we want to retain
       * control if we run out of memory.  palloc() would recursively call
       * elog(ERROR), which would be all right except if we are working on a
!      * FATAL or REALLYFATAL error.    We'd lose track of the fatal condition
       * and report a mere ERROR to outer loop, which would be a Bad Thing.
       * So, we substitute an appropriate message in-place, without
       * downgrading the level if it's above ERROR.
--- 109,115 ----
       * Note that we use malloc() not palloc() because we want to retain
       * control if we run out of memory.  palloc() would recursively call
       * elog(ERROR), which would be all right except if we are working on a
!      * FATAL or CRASH error.    We'd lose track of the fatal condition
       * and report a mere ERROR to outer loop, which would be a Bad Thing.
       * So, we substitute an appropriate message in-place, without
       * downgrading the level if it's above ERROR.
***************
*** 142,154 ****
          lev = FATAL;

      /*
!      * If we are inside a critical section, all errors become REALLYFATAL
       * errors.    See miscadmin.h.
       */
      if (lev == ERROR || lev == FATAL)
      {
          if (CritSectionCount > 0)
!             lev = REALLYFATAL;
      }

      prefix = elog_message_prefix(lev);
--- 142,154 ----
          lev = FATAL;

      /*
!      * If we are inside a critical section, all errors become CRASH
       * errors.    See miscadmin.h.
       */
      if (lev == ERROR || lev == FATAL)
      {
          if (CritSectionCount > 0)
!             lev = CRASH;
      }

      prefix = elog_message_prefix(lev);
***************
*** 167,178 ****
       * vsnprintf won't know what to do with %m).  To keep space
       * calculation simple, we only allow one %m.
       */
!     space_needed = timestamp_size + strlen(prefix)
!         + strlen(fmt) + strlen(errorstr) + 1;

      if (copy_lineno)
      {
!         /* translator: This string will be truncated at 31 characters. */
          snprintf(copylineno_buf, 32, gettext("copy: line %d, "), copy_lineno);
          space_needed += strlen(copylineno_buf);
      }
--- 167,181 ----
       * vsnprintf won't know what to do with %m).  To keep space
       * calculation simple, we only allow one %m.
       */
!     space_needed = timestamp_size + strlen(prefix) +
!                    strlen(fmt) + strlen(errorstr) + 1;

      if (copy_lineno)
      {
!         /*
!          * Prints the failure line of the COPY.  Wow, what a hack!  bjm
!          * Translators:  Error message will be truncated at 31 characters.
!          */
          snprintf(copylineno_buf, 32, gettext("copy: line %d, "), copy_lineno);
          space_needed += strlen(copylineno_buf);
      }
***************
*** 184,190 ****
          {
              /* We're up against it, convert to out-of-memory error */
              fmt_buf = fmt_fixedbuf;
!             if (lev != FATAL && lev != REALLYFATAL)
              {
                  lev = ERROR;
                  prefix = elog_message_prefix(lev);
--- 187,193 ----
          {
              /* We're up against it, convert to out-of-memory error */
              fmt_buf = fmt_fixedbuf;
!             if (lev != FATAL && lev != CRASH)
              {
                  lev = ERROR;
                  prefix = elog_message_prefix(lev);
***************
*** 213,219 ****
      if (copy_lineno)
      {
          strcat(fmt_buf, copylineno_buf);
!         if (lev == ERROR || lev == FATAL || lev == REALLYFATAL)
              copy_lineno = 0;
      }

--- 216,222 ----
      if (copy_lineno)
      {
          strcat(fmt_buf, copylineno_buf);
!         if (lev == ERROR || lev == FATAL || lev == CRASH)
              copy_lineno = 0;
      }

***************
*** 281,287 ****
          {
              /* We're up against it, convert to out-of-memory error */
              msg_buf = msg_fixedbuf;
!             if (lev != FATAL && lev != REALLYFATAL)
              {
                  lev = ERROR;
                  prefix = elog_message_prefix(lev);
--- 284,290 ----
          {
              /* We're up against it, convert to out-of-memory error */
              msg_buf = msg_fixedbuf;
!             if (lev != FATAL && lev != CRASH)
              {
                  lev = ERROR;
                  prefix = elog_message_prefix(lev);
***************
*** 312,317 ****
--- 315,324 ----
              case DEBUG:
                  syslog_level = LOG_DEBUG;
                  break;
+             case LOG:
+             case INFO:
+                 syslog_level = LOG_INFO;
+                 break;
              case NOTICE:
                  syslog_level = LOG_NOTICE;
                  break;
***************
*** 321,327 ****
              case FATAL:
                  syslog_level = LOG_ERR;
                  break;
!             case REALLYFATAL:
              default:
                  syslog_level = LOG_CRIT;
                  break;
--- 328,334 ----
              case FATAL:
                  syslog_level = LOG_ERR;
                  break;
!             case CRASH:
              default:
                  syslog_level = LOG_CRIT;
                  break;
***************
*** 334,344 ****
      /* syslog doesn't want a trailing newline, but other destinations do */
      strcat(msg_buf, "\n");

!     /* write to terminal */
!     if (Use_syslog <= 1 || whereToSendOutput == Debug)
          write(2, msg_buf, strlen(msg_buf));

!     if (lev > DEBUG && whereToSendOutput == Remote)
      {
          /* Send IPC message to the front-end program */
          MemoryContext oldcxt;
--- 341,352 ----
      /* syslog doesn't want a trailing newline, but other destinations do */
      strcat(msg_buf, "\n");

!     /* Write to server logs or server terminal */
!     if (lev != INFO && (Use_syslog <= 1 || whereToSendOutput == Debug))
          write(2, msg_buf, strlen(msg_buf));

!     /* Should we output to the client too? */
!     if (lev >= INFO && whereToSendOutput == Remote)
      {
          /* Send IPC message to the front-end program */
          MemoryContext oldcxt;
***************
*** 351,357 ****
           */
          oldcxt = MemoryContextSwitchTo(ErrorContext);

!         if (lev == NOTICE)
              /* exclude the timestamp from msg sent to frontend */
              send_notice_to_frontend(msg_buf + timestamp_size);
          else
--- 359,365 ----
           */
          oldcxt = MemoryContextSwitchTo(ErrorContext);

!         if (lev <= NOTICE)
              /* exclude the timestamp from msg sent to frontend */
              send_notice_to_frontend(msg_buf + timestamp_size);
          else
***************
*** 414,420 ****
           * Guard against infinite loop from elog() during error recovery.
           */
          if (InError)
!             elog(REALLYFATAL, "elog: error during error recovery, giving up!");
          InError = true;

          /*
--- 422,428 ----
           * Guard against infinite loop from elog() during error recovery.
           */
          if (InError)
!             elog(CRASH, "elog: error during error recovery, giving up!");
          InError = true;

          /*
***************
*** 423,429 ****
          siglongjmp(Warn_restart, 1);
      }

!     if (lev == FATAL || lev == REALLYFATAL)
      {
          /*
           * Serious crash time. Postmaster will observe nonzero process
--- 431,437 ----
          siglongjmp(Warn_restart, 1);
      }

!     if (lev == FATAL || lev == CRASH)
      {
          /*
           * Serious crash time. Postmaster will observe nonzero process
***************
*** 673,682 ****
  {
      StringInfoData buf;

!     AssertArg(type == NOTICE || type == ERROR);

      pq_beginmessage(&buf);
!     pq_sendbyte(&buf, type == NOTICE ? 'N' : 'E');
      pq_sendstring(&buf, msg);
      pq_endmessage(&buf);

--- 681,690 ----
  {
      StringInfoData buf;

!     AssertArg(type <= ERROR);

      pq_beginmessage(&buf);
!     pq_sendbyte(&buf, type != ERROR ? 'N' : 'E'); /* No reason to add INFO */
      pq_sendstring(&buf, msg);
      pq_endmessage(&buf);

***************
*** 732,750 ****
      switch (lev)
      {
          case DEBUG:
!             prefix = gettext("DEBUG:  ");
              break;
          case NOTICE:
              prefix = gettext("NOTICE:  ");
              break;
          case ERROR:
!             prefix = gettext("ERROR:  ");
              break;
          case FATAL:
!             prefix = gettext("FATAL 1:  ");
              break;
!         case REALLYFATAL:
!             prefix = gettext("FATAL 2:  ");
              break;
      }

--- 740,764 ----
      switch (lev)
      {
          case DEBUG:
!             prefix = gettext("DEBUG:   ");
!             break;
!         case LOG:
!             prefix = gettext("LOG:     ");
!             break;
!         case INFO:
!             prefix = gettext("INFO:    ");
              break;
          case NOTICE:
              prefix = gettext("NOTICE:  ");
              break;
          case ERROR:
!             prefix = gettext("ERROR:   ");
              break;
          case FATAL:
!             prefix = gettext("FATAL:   ");
              break;
!         case CRASH:
!             prefix = gettext("CRASH:   ");
              break;
      }

Index: src/backend/utils/hash/dynahash.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v
retrieving revision 1.40
diff -c -r1.40 dynahash.c
*** src/backend/utils/hash/dynahash.c    2001/10/28 06:25:54    1.40
--- src/backend/utils/hash/dynahash.c    2002/02/19 04:55:32
***************
*** 933,939 ****
       * systemwide restart.    Otherwise, just shut down this one backend.
       */
      if (hashp->isshared)
!         elog(STOP, "Hash table '%s' corrupted", hashp->tabname);
      else
          elog(FATAL, "Hash table '%s' corrupted", hashp->tabname);
  }
--- 933,939 ----
       * systemwide restart.    Otherwise, just shut down this one backend.
       */
      if (hashp->isshared)
!         elog(CRASH, "Hash table '%s' corrupted", hashp->tabname);
      else
          elog(FATAL, "Hash table '%s' corrupted", hashp->tabname);
  }
Index: src/include/utils/elog.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/utils/elog.h,v
retrieving revision 1.30
diff -c -r1.30 elog.h
*** src/include/utils/elog.h    2001/11/05 17:46:36    1.30
--- src/include/utils/elog.h    2002/02/19 04:55:33
***************
*** 15,29 ****
  #define ELOG_H

  /* Error level codes */
! #define NOTICE    0                /* random info, sent to frontend */
! #define ERROR    (-1)            /* user error - return to known state */
! #define FATAL    1                /* fatal error - abort process */
! #define REALLYFATAL 2            /* take down the other backends with me */
! #define DEBUG    (-2)            /* debug message */
!
! /* temporary nonsense... */
! #define STOP    REALLYFATAL
! #define LOG        DEBUG

  /* Configurable parameters */
  #ifdef ENABLE_SYSLOG
--- 15,27 ----
  #define ELOG_H

  /* Error level codes */
! #define DEBUG    0                /* sent only to server logs, label DEBUG */
! #define LOG        1                /* sent only to server logs, label LOG */
! #define INFO    2                /* sent only to client */
! #define NOTICE    3                /* important, sent to both */
! #define ERROR    4                /* user error - return to known state */
! #define FATAL    5                /* fatal error - abort process */
! #define CRASH    6                /* take down the other backends with me */

  /* Configurable parameters */
  #ifdef ENABLE_SYSLOG

Re: elog cleanup

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> [ 100K+ patch ]

If you're going to hit every file in the backend in pursuit of this
idea, *puh-leeze* get it right the FIRST time, rather than subjecting
us all to multiple rounds of break-everyone-else's-patches-in-progress.

Things you did not get right include: where's the PG_ prefix?
And what happened to merging the debug-level mechanism with the
error level codes?

> o Add INFO level that prints only to the client
> o Add LOG level to print messages only to the server log

I still object strongly to this worldview.  The code should not have
a hard-wired concept of which messages are for the client and which
are for the log.

            regards, tom lane

Re: elog cleanup

From
Bruce Momjian
Date:
Serguei Mokhov wrote:
> ----- Original Message -----
> From: "Bruce Momjian" <pgman@candle.pha.pa.us>
> Sent: Tuesday, February 19, 2002 12:16 AM
>
> ...
>
> > ! elog(CRASH, "heap_delete_%sdo: no block", (redo) ? "re" : "un");
> > ! elog(CRASH, "heap_delete_%sdo: uninitialized page", (redo) ? "re" : "un");
>
> ...
>
> This type of "dynamically constructed" messages is kinda bad for translators,
> because the parts one's replacing in the original message could be
> translated differently entirely and may not suit in the translations as they do in the originals.
> Even if they do, "re" and "un" will never make into the message catalogs, for example.
>
> Maybe it's not so crucial for these specific messages, but for sure won't
> work for general type of messages.

This is a good point.  I am not too concerned about this case because it
is attempting to match an actual function name.  I hope we don't do this
for more general messages.  My guess is that we don't, because if we
did, some translator would have complained.  :-)

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: elog cleanup

From
Bruce Momjian
Date:
Bruce Momjian wrote:
> This patch fixes several issues with our elog() handling:

Oh, I forgot to mention that this patch also renumbers the elog values
so they are in increasing order;  seemed to make sense.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: elog cleanup

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > [ 100K+ patch ]
>
> If you're going to hit every file in the backend in pursuit of this
> idea, *puh-leeze* get it right the FIRST time, rather than subjecting
> us all to multiple rounds of break-everyone-else's-patches-in-progress.
>
> Things you did not get right include: where's the PG_ prefix?
> And what happened to merging the debug-level mechanism with the
> error level codes?

Wow, what encouragement!  :-<

See later posting.  I didn't want a mammoth patch that no one could
review.  I will do the rename at the same time I apply the patch, if
everyone agrees.

> > o Add INFO level that prints only to the client
> > o Add LOG level to print messages only to the server log
>
> I still object strongly to this worldview.  The code should not have
> a hard-wired concept of which messages are for the client and which
> are for the log.

OK, I can't come up with a clean solution without hardwiring it.  If we
are warning someone about a sequence creation as part of SERIAL, it
makes no sense to send it to the server log, it is informational.  The
same goes with database startup messages and checkpoint log file
rotation, which go only to the server logs.  I don't see the value in
adding complexity when it isn't needed.

If you want a clean heiarchy, I guess you could put INFO below LOG, and
default the server level to LOG and the client level to INFO.  However,
the client is never going to see most LOG message, but it does have the
desired effect that INFO only goes to the client and LOG goes only to
the server (usually).  Seems less logical to me because LOG can't go to
the client, but it has the same effect if people prefer that.  Actually,
now that I think of it, several LOG message would go to the client.  The
old way was to make LOG == DEBUG, but if you do that, then the server
would see all the INFO message because LOG has to be less than INFO;  it
gets to be a mess.

Considering the number of people doing elog(), I think saying "Use LOG
for server-only, INFO for client-only, and NOTICE for both" is pretty
clear.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: elog cleanup

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Wow, what encouragement!  :-<

Well, I assumed that you generated this patch with the intention of
applying it promptly.  If it was only a basis for discussion, why'd
you go to the effort of creating a 100K+ patch that will be stale in
a few days?  It's certainly not useful to aid the discussion: a ten-line
statement of what you wanted to do would've been more helpful.  Who's
going to wade through a 100K patch?

In any case, the correct approach would've been to put up a proposal
on pghackers before doing the work.  You *know* this is going to be
controversial.  More, if it's not highlighted on pghackers then a
lot of people will fail to get the word and we'll be having trouble
with broken patches for a long time to come.

            regards, tom lane

Re: elog cleanup

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Wow, what encouragement!  :-<
>
> Well, I assumed that you generated this patch with the intention of
> applying it promptly.  If it was only a basis for discussion, why'd
> you go to the effort of creating a 100K+ patch that will be stale in
> a few days?  It's certainly not useful to aid the discussion: a ten-line
> statement of what you wanted to do would've been more helpful.  Who's
> going to wade through a 100K patch?

Well, I am making decisions that certain messages to only to the client.
I need people to see those changes.

> In any case, the correct approach would've been to put up a proposal
> on pghackers before doing the work.  You *know* this is going to be
> controversial.  More, if it's not highlighted on pghackers then a
> lot of people will fail to get the word and we'll be having trouble
> with broken patches for a long time to come.

I just sent the summary to hackers.  Haven't seen any comments either
way so far.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: elog cleanup

From
"Serguei Mokhov"
Date:
----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
Sent: Tuesday, February 19, 2002 12:16 AM

...

> ! elog(CRASH, "heap_delete_%sdo: no block", (redo) ? "re" : "un");
> ! elog(CRASH, "heap_delete_%sdo: uninitialized page", (redo) ? "re" : "un");

...

This type of "dynamically constructed" messages is kinda bad for translators,
because the parts one's replacing in the original message could be
translated differently entirely and may not suit in the translations as they do in the originals.
Even if they do, "re" and "un" will never make into the message catalogs, for example.

Maybe it's not so crucial for these specific messages, but for sure won't
work for general type of messages.