pg 从库的日志里告警如下:
psql postgres postgres [local] 2012-07-13 09:54:13 CSTERROR: cannot assign TransactionIds during recovery
psql
postgres postgres [local] 2012-07-13 09:54:13 CSTSTATEMENT: SET
statement_timeout=30000;BEGIN;SET statement_timeout=30000;COMMIT;SELECT
datname, age(datfrozenxid) FROM pg_database WHERE datallowconn ORDER BY
1, 2
诈一看,蒙了,
在查看nagios 的告警发现这个warning check_postgresql_txn_wrapper 这个选项。
看了下代码发现了 证实执行了这个查询 “SELECT datname, age(datfrozenxid) FROM pg_database WHERE datallowconn ORDER BY 1, 2”
在主库上执行时没有问题的。可以正确的返回结构,然后去查age() 函数的
发现age (datfrozenxid) 需要请求一个事务id 而从库时streaming 复制, 是只读访问的,自然不能分配一个事务id[code]
postgres=# \df age*
List of functions
Schema | Name | Result data type | Argument data types | Type
------------+------+------------------+----------------------------------------------------------+--------
pg_catalog | age | interval | timestamp with time zone | normal
pg_catalog | age | interval | timestamp with time zone, timestamp with time zone | normal
pg_catalog | age | interval | timestamp without time zone | normal
pg_catalog | age | interval | timestamp without time zone, timestamp without time zone | normal
pg_catalog | age | integer | xid | normal
(5 rows)
[/code]
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/133735/viewspace-735383/
,如需转载,请注明出处,否则将追究法律责任。