pgsql: Improve frontend error logging style.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Improve frontend error logging style.
Date: 2022-04-08 18:55:27
Message-ID: E1nctlW-000voO-Uu@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve frontend error logging style.

Get rid of the separate "FATAL" log level, as it was applied
so inconsistently as to be meaningless. This mostly involves
s/pg_log_fatal/pg_log_error/g.

Create a macro pg_fatal() to handle the common use-case of
pg_log_error() immediately followed by exit(1). Various
modules had already invented either this or equivalent macros;
standardize on pg_fatal() and apply it where possible.

Invent the ability to add "detail" and "hint" messages to a
frontend message, much as we have long had in the backend.

Except where rewording was needed to convert existing coding
to detail/hint style, I have (mostly) resisted the temptation
to change existing message wording.

Patch by me. Design and patch reviewed at various stages by
Robert Haas, Kyotaro Horiguchi, Peter Eisentraut and
Daniel Gustafsson.

Discussion: https://postgr.es/m/1363732.1636496441@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9a374b77fb53e4cfbca121e4fa278a7d71bde7c4

Modified Files
--------------
contrib/oid2name/oid2name.c | 22 +-
contrib/vacuumlo/vacuumlo.c | 18 +-
src/bin/initdb/initdb.c | 333 ++++++---------------
src/bin/pg_amcheck/pg_amcheck.c | 84 ++----
src/bin/pg_archivecleanup/pg_archivecleanup.c | 40 +--
src/bin/pg_basebackup/bbstreamer_file.c | 58 ++--
src/bin/pg_basebackup/bbstreamer_gzip.c | 47 +--
src/bin/pg_basebackup/bbstreamer_inject.c | 3 +-
src/bin/pg_basebackup/bbstreamer_lz4.c | 17 +-
src/bin/pg_basebackup/bbstreamer_tar.c | 18 +-
src/bin/pg_basebackup/bbstreamer_zstd.c | 33 +--
src/bin/pg_basebackup/pg_basebackup.c | 407 +++++++-------------------
src/bin/pg_basebackup/pg_receivewal.c | 148 +++-------
src/bin/pg_basebackup/pg_recvlogical.c | 60 +---
src/bin/pg_basebackup/receivelog.c | 16 +-
src/bin/pg_basebackup/streamutil.c | 10 +-
src/bin/pg_basebackup/walmethods.c | 5 +-
src/bin/pg_checksums/pg_checksums.c | 97 ++----
src/bin/pg_controldata/pg_controldata.c | 8 +-
src/bin/pg_ctl/pg_ctl.c | 8 +-
src/bin/pg_dump/common.c | 27 +-
src/bin/pg_dump/compress_io.c | 38 +--
src/bin/pg_dump/nls.mk | 3 +-
src/bin/pg_dump/parallel.c | 39 ++-
src/bin/pg_dump/pg_backup_archiver.c | 154 +++++-----
src/bin/pg_dump/pg_backup_archiver.h | 6 +-
src/bin/pg_dump/pg_backup_custom.c | 72 ++---
src/bin/pg_dump/pg_backup_db.c | 46 +--
src/bin/pg_dump/pg_backup_directory.c | 72 ++---
src/bin/pg_dump/pg_backup_null.c | 4 +-
src/bin/pg_dump/pg_backup_tar.c | 70 ++---
src/bin/pg_dump/pg_backup_utils.c | 8 +-
src/bin/pg_dump/pg_backup_utils.h | 8 +-
src/bin/pg_dump/pg_dump.c | 278 ++++++++----------
src/bin/pg_dump/pg_dump_sort.c | 14 +-
src/bin/pg_dump/pg_dumpall.c | 105 ++-----
src/bin/pg_dump/pg_restore.c | 44 +--
src/bin/pg_dump/t/003_pg_dump_with_server.pl | 2 +-
src/bin/pg_resetwal/pg_resetwal.c | 210 ++++---------
src/bin/pg_rewind/nls.mk | 3 +-
src/bin/pg_rewind/pg_rewind.c | 54 ++--
src/bin/pg_rewind/pg_rewind.h | 3 -
src/bin/pg_rewind/t/009_growing_files.pl | 2 +-
src/bin/pg_rewind/timeline.c | 8 +-
src/bin/pg_test_fsync/pg_test_fsync.c | 24 +-
src/bin/pg_upgrade/pg_upgrade.h | 3 +
src/bin/pg_verifybackup/pg_verifybackup.c | 34 +--
src/bin/pg_verifybackup/t/005_bad_manifest.pl | 2 +-
src/bin/pg_waldump/nls.mk | 4 +-
src/bin/pg_waldump/pg_waldump.c | 59 ++--
src/bin/pgbench/pgbench.c | 285 +++++-------------
src/bin/psql/command.c | 2 +-
src/bin/psql/common.c | 2 +-
src/bin/psql/help.c | 5 +-
src/bin/psql/mainloop.c | 10 +-
src/bin/psql/startup.c | 28 +-
src/bin/psql/t/001_basic.pl | 2 +-
src/bin/scripts/clusterdb.c | 15 +-
src/bin/scripts/createdb.c | 20 +-
src/bin/scripts/createuser.c | 12 +-
src/bin/scripts/dropdb.c | 7 +-
src/bin/scripts/dropuser.c | 7 +-
src/bin/scripts/pg_isready.c | 5 +-
src/bin/scripts/reindexdb.c | 65 ++--
src/bin/scripts/vacuumdb.c | 136 +++------
src/common/controldata_utils.c | 40 +--
src/common/file_utils.c | 6 +-
src/common/logging.c | 60 ++--
src/common/restricted_token.c | 5 +-
src/fe_utils/archive.c | 35 +--
src/fe_utils/connect_utils.c | 10 +-
src/fe_utils/parallel_slot.c | 5 +-
src/fe_utils/query_utils.c | 4 +-
src/fe_utils/recovery_gen.c | 40 +--
src/include/common/logging.h | 115 ++++++--
src/include/lib/simplehash.h | 3 +-
src/nls-global.mk | 10 +-
77 files changed, 1367 insertions(+), 2395 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-04-08 21:55:51 Re: pgsql: Add TAP test for archive_cleanup_command and recovery_end_comman
Previous Message Tom Lane 2022-04-08 18:23:19 pgsql: Fix busted .gitignore entry.