获取事务id导致双机热备只读查询失败

read only queries on hot standby server fail due to acquiring transaction id

我们刚刚成功地将主服务器备份到热备用服务器上。然而,当我们尝试查询热备时,我们得到以下错误:

ERROR: cannot assign TransactionIds during recovery

我启用了详细模式并看到错误发生在 varsup.c:72

/* safety check, we should never get this far in a HS standby */ 
if (RecoveryInProgress())
   elog(ERROR, "cannot assign TransactionIds during recovery");

奇怪的是,如果我们使用 psql 客户端并发出多个读取查询,第一个会失败,但所有后续的都会成功。

pipeline=#    SELECT pg_is_in_recovery();
ERROR:  cannot assign TransactionIds during recovery
pipeline=#    SELECT pg_is_in_recovery();
 pg_is_in_recovery 
-------------------
t
(1 row)

使用 postgres 9.5.3

任何想法将不胜感激。

顺便说一句: 我们添加了: hot_standby = on 到 pipelinedb.conf(相当于 postgresql.conf)

并且我们添加了:

primary_slot_name = 'replicator_slot'
primary_conninfo = 'user=username host=ip_address port=5432'
recovery_target_timeline = 'latest'

到recovery.conf

使用

pg_ctl promote

退出恢复模式并恢复正常 (read/write) 操作。

来自postgresql documentation

In promote mode, the standby server that is running in the specified 
data directory is commanded to exit recovery and begin read-write 
operations.

我们目前正在调查 the issue 您为我们写的这么贴心。一旦问题解决,我会post在这里更新,应该不会太长