根据 PG 日志中报错追踪错误对应的程序来源
PG 日志大量报错 test.tbl_xxx 表不存在。
·
现象
PG 日志大量报错 test.tbl_xxx 表不存在
10298:2026-04-21 01:37:39.065 UTC [unknown] postgres 192.115.1.46(41648) test 2526347:ERROR: relation "tbl_xxx" does not exist at character 22
10304:2026-04-21 01:37:49.071 UTC [unknown] postgres 192.115.1.46(41648) test 2526347:ERROR: relation "tbl_xxx" does not exist at character 22
10317:2026-04-21 01:37:59.077 UTC [unknown] postgres 192.115.1.46(41648) test 2526347:ERROR: relation "tbl_xxx" does not exist at character 22
分析
- 根据pid 2526347 查看活动查询
[root@localhost pg_log]#
postgres=# select * from pg_stat_activity where pid=2526347;
-[ RECORD 1 ]----+----------------------------------------
datid | 63820
datname | test
pid | 2526347
leader_pid |
usesysid | 10
usename | postgres
application_name |
client_addr | 192.115.1.46
client_hostname |
client_port | 41648
backend_start | 2026-04-20 12:36:19.782418+00
xact_start |
query_start | 2026-04-21 01:39:49.142276+00
state_change | 2026-04-21 01:39:49.142419+00
wait_event_type | Client
wait_event | ClientRead
state | idle
backend_xid |
backend_xmin |
query_id |
query | SELECT count(1) FROM "tbl_xxx"
backend_type | client backend
- 查看 端口 41648 对应的进程是谁
[root@localhost pg_log]# ss -tpn | grep ':41648'
ESTAB 0 0 192.115.1.46:5432 192.115.1.46:41648 users:(("postgres",pid=2526347,fd=13))
ESTAB 0 0 192.115.1.46:41648 192.115.1.46:5432 users:(("authorization",pid=2526320,fd=8))
[root@localhost pg_log]#
- 查看 pid 为 2526320 的进程
[root@localhost pg_log]# ps -ef | grep 2526320 |grep -v grep
root 2526320 1 0 Apr20 ? 00:02:27 /opt/func-xxx/bin/authorization
可以看到 进程来源为 /opt/func-xxx/bin/authorization
更多推荐
所有评论(0)