【问题标题】:read only queries on hot standby server fail due to acquiring transaction id由于获取事务 ID,热备用服务器上的只读查询失败
【发布时间】:2017-09-23 01:19:56
【问题描述】:

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

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

【问题讨论】:

    标签: replication pipelinedb


    【解决方案1】:

    我们目前正在调查the issue,您为我们精心撰写的文章。解决后我会在这里发布更新,应该不会太长

    【讨论】:

      【解决方案2】:

      使用

      pg_ctl promote
      

      退出恢复模式并恢复正常(读/写)操作。

      来自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.
      

      【讨论】:

      • 感谢 paul 的提示,但我们不希望热备用退出恢复。理想情况下,它将始终处于恢复状态并帮助主/主服务器运行只读查询。
      猜你喜欢
      • 1970-01-01
      • 2018-08-13
      • 2017-07-19
      • 2014-12-09
      • 2023-03-31
      • 2016-12-11
      • 2018-08-25
      • 2010-12-26
      • 1970-01-01
      相关资源
      最近更新 更多