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