database - 是什么导致只读副本上的数据成为 old_snapshot 并导致冲突?
问题描述
多次遇到(在 RDS Postgres 实例上)后:
ERROR: canceling statement due to conflict with recovery
Detail: User query might have needed to see row versions that must be removed
我跑了(在热备上):
SELECT *
FROM pg_stat_database_conflicts;
并发现所有的冲突都与confl_snapshot
这在文档中解释为:
confl_snapshot:此数据库中由于旧快照而取消的查询数
什么可能导致此冲突(作为旧快照)?
如果有帮助,以下是一些相关设置(通过SHOW ALL ;
在待机状态下运行):
hot_standby: on
hot_standby_feedback: off
max_standby_archive_delay: 30s
max_standby_streaming_delay: 1h
name,setting
old_snapshot_threshold: -1
vacuum_defer_cleanup_age: 0
vacuum_freeze_min_age: 50000000
vacuum_freeze_table_age: 150000000
vacuum_multixact_freeze_min_age: 5000000
vacuum_multixact_freeze_table_age: 150000000
wal_level: replica
wal_receiver_status_interval: 10s
wal_receiver_timeout: 30s
wal_retrieve_retry_interval: 5s
wal_segment_size: 16MB
wal_sender_timeout: 30s
wal_writer_delay: 200ms
解决方案
推荐阅读
- nsattributedstring - 在 NSAttributedString 中对齐子字符串
- amazon-web-services - Kubectl 将部署应用到指定的节点组 - AWS EKS
- python - 在 DynamoDB 表中存储字典列表
- java - @Async 和 @Transactional 的 Spring Boot 问题
- php - Wordpress/WooCommerce:如果单词不是“搜索”,则更改 searchurl 的 SLUG 会停止搜索(通过 htaccess 或 functions.php)
- python-3.x - AWS CDK - 访问新功能
- pdflib - PDFlib - 在左上角而不是左下角使用“textflow”放置换行文本
- sql - 打开 262 列的 DBF 文件,从 256 列增加,返回“...file.dbf is not a table”
- javascript - 如何在平板设备上获取经度和纬度?JS 地图框
- xml - 将带有嵌套节点的 xml 导入 Access(并且需要使用 xsl 将 xml 转换为“平面”结构)