wal_debug 是一个用于输出与WAL相关的调试信息的配置参数。
wal_debug 添加于 PostgreSQL 7.1。
用法
wal_debug 是一个开发者 GUC,仅当 PostgreSQL 编译时在 src/include/pg_config_manual.h 中定义了宏 WAL_DEBUG 时才可用。
默认值
wal_debug 的默认值为:off。
变更历史
- PostgreSQL 7.1
- 添加于(提交 b0299c5d)
示例
在可用 wal_debug 的实例上启用它时的日志输出
[2022-06-09 08:52:57 UTC] psql postgres postgres LOG: 00000: statement: ALTER SYSTEM SET wal_debug = on; [2022-06-09 08:52:57 UTC] psql postgres postgres LOCATION: exec_simple_query, postgres.c:1053 [2022-06-09 08:52:59 UTC] psql postgres postgres LOG: 00000: statement: SELECT pg_reload_conf(); [2022-06-09 08:52:59 UTC] psql postgres postgres LOCATION: exec_simple_query, postgres.c:1053 [2022-06-09 08:52:59 UTC] LOG: 00000: received SIGHUP, reloading configuration files [2022-06-09 08:52:59 UTC] LOCATION: SIGHUP_handler, postmaster.c:2763 [2022-06-09 08:52:59 UTC] LOG: 00000: parameter "wal_debug" changed to "on" [2022-06-09 08:52:59 UTC] LOCATION: ProcessConfigFileInternal, guc-file.l:455
随后的日志输出将包含广泛的 WAL 调试信息,例如:
[2022-06-09 08:53:29 UTC] LOG: 00000: INSERT @ 0/3000868: - XLOG/FPI_FOR_HINT: [2022-06-09 08:53:29 UTC] LOCATION: XLogInsertRecord, xlog.c:1000 [2022-06-09 08:53:29 UTC] LOG: 00000: INSERT @ 0/3000DF8: - XLOG/FPI_FOR_HINT: [2022-06-09 08:53:29 UTC] LOCATION: XLogInsertRecord, xlog.c:1000 [2022-06-09 08:53:29 UTC] LOG: 00000: INSERT @ 0/3000E50: - Heap2/PRUNE: latestRemovedXid 0 nredirected 2 ndead 3 [2022-06-09 08:53:29 UTC] LOCATION: XLogInsertRecord, xlog.c:1000
在编译时未设置 WAL_DEBUG 宏的实例上尝试使用 wal_debug
postgres=# SHOW wal_debug; ERROR: unrecognized configuration parameter "wal_debug"
参考资料
- PostgreSQL 文档: wal_debug
