首页 > 解决方案 > 如何解决流命令的错误读取结果?

问题描述

我有一个主数据库与一个发布和一个订阅该发布的从属数据库进行逻辑复制。在从站上,我偶尔会收到以下错误:

ERROR:  error reading result of streaming command:
LOG:  logical replication table synchronization worker for subscription ABC, table XYZ

如何阻止上述错误的发生?

下面是演示错误的日志屏幕截图: postgresql日志截图 以下是与文本相同的信息:

2020-11-25 06:50:51.736 UTC [91572] LOG:  background worker "logical replication worker" (PID 96504) exited with exit code 1
2020-11-25 06:50:51.740 UTC [96505] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_devicekioskrating" has started
2020-11-25 06:50:52.197 UTC [96505] ERROR:  error reading result of streaming command:
2020-11-25 06:50:52.200 UTC [91572] LOG:  background worker "logical replication worker" (PID 96505) exited with exit code 1
2020-11-25 06:50:52.203 UTC [96506] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "workorders_sectorbranchinformation" has started
2020-11-25 06:50:52.286 UTC [96506] ERROR:  error reading result of streaming command:
2020-11-25 06:50:52.288 UTC [91572] LOG:  background worker "logical replication worker" (PID 96506) exited with exit code 1
2020-11-25 06:50:52.292 UTC [96507] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_kioskstatetransitions" has started
2020-11-25 06:52:14.887 UTC [96339] ERROR:  error reading result of streaming command:
2020-11-25 06:52:14.896 UTC [91572] LOG:  background worker "logical replication worker" (PID 96339) exited with exit code 1
2020-11-25 06:52:14.900 UTC [96543] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_sensordatafeed" has started
2020-11-25 06:52:21.385 UTC [96507] ERROR:  error reading result of streaming command:
2020-11-25 06:52:21.393 UTC [91572] LOG:  background worker "logical replication worker" (PID 96507) exited with exit code 1
2020-11-25 06:52:21.397 UTC [96547] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_sitemappoint" has started
2020-11-25 06:52:21.523 UTC [96547] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_sitemappoint" has finished
2020-11-25 06:52:21.528 UTC [96548] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "core_event" has started
2020-11-25 06:55:35.401 UTC [96543] ERROR:  error reading result of streaming command:
2020-11-25 06:55:35.408 UTC [91572] LOG:  background worker "logical replication worker" (PID 96543) exited with exit code 1
2020-11-25 06:55:35.412 UTC [96642] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_doorevents" has started
2020-11-25 06:56:43.633 UTC [96642] ERROR:  error reading result of streaming command:
2020-11-25 06:56:43.641 UTC [91572] LOG:  background worker "logical replication worker" (PID 96642) exited with exit code 1
2020-11-25 06:56:43.644 UTC [96678] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "workorders_sectorbranchinformation" has started
2020-11-25 06:56:43.776 UTC [96678] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "workorders_sectorbranchinformation" has finished
2020-11-25 06:56:43.782 UTC [96679] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "core_batteryhistory" has started
2020-11-25 06:57:04.166 UTC [96679] ERROR:  error reading result of streaming command:
2020-11-25 06:57:04.174 UTC [91572] LOG:  background worker "logical replication worker" (PID 96679) exited with exit code 1
2020-11-25 06:57:04.178 UTC [96685] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_attendantvisittime" has started
2020-11-25 06:57:06.100 UTC [96685] ERROR:  error reading result of streaming command:
2020-11-25 06:57:06.160 UTC [91572] LOG:  background worker "logical replication worker" (PID 96685) exited with exit code 1
2020-11-25 06:57:06.164 UTC [96693] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_kioskstatetransitions" has started
2020-11-25 06:59:50.375 UTC [96548] ERROR:  error reading result of streaming command:
2020-11-25 06:59:50.382 UTC [91572] LOG:  background worker "logical replication worker" (PID 96548) exited with exit code 1
2020-11-25 06:59:50.389 UTC [96755] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_sensordatafeed" has started
2020-11-25 07:00:56.844 UTC [96693] ERROR:  error reading result of streaming command:
2020-11-25 07:00:56.852 UTC [91572] LOG:  background worker "logical replication worker" (PID 96693) exited with exit code 1
2020-11-25 07:00:56.856 UTC [96779] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "workorders_wastestream" has started
2020-11-25 07:00:57.391 UTC [96779] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "workorders_wastestream" has finished
2020-11-25 07:00:57.397 UTC [96780] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "core_event" has started
2020-11-25 07:02:39.650 UTC [96755] ERROR:  error reading result of streaming command:
2020-11-25 07:02:39.658 UTC [91572] LOG:  background worker "logical replication worker" (PID 96755) exited with exit code 1
2020-11-25 07:02:39.662 UTC [96824] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_devicekioskrating" has started
2020-11-25 07:02:40.276 UTC [96824] ERROR:  error reading result of streaming command:
2020-11-25 07:02:40.279 UTC [91572] LOG:  background worker "logical replication worker" (PID 96824) exited with exit code 1
2020-11-25 07:02:40.283 UTC [96825] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_kioskstatetransitions" has started
2020-11-25 07:04:07.222 UTC [96825] ERROR:  error reading result of streaming command:
2020-11-25 07:04:07.230 UTC [91572] LOG:  background worker "logical replication worker" (PID 96825) exited with exit code 1
2020-11-25 07:04:07.234 UTC [96862] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "contractservices_attendantvisit" has started
2020-11-25 07:04:49.971 UTC [96862] ERROR:  error reading result of streaming command:
2020-11-25 07:04:49.978 UTC [91572] LOG:  background worker "logical replication worker" (PID 96862) exited with exit code 1
2020-11-25 07:04:50.432 UTC [97013] LOG:  logical replication table synchronization worker for subscription "snf5_cba_isp_db_staging_app1_srv_sub", table "core_batteryhistory" has started

尽管在 postgresql v13.0 中出现此错误,但从数据库上的表似乎可以正常复制。但是,我想解决这个错误。我还尝试下载 postgresql v13.1,并注意到我仍然收到此错误并且它无法正常复制。

我发现了这篇文章:
https ://www.postgresql-archive.org/BUG-16643-PG13-Logical-replication-initial-startup-never-finishes-and-gets-stuck-in-startup-loop- td6156051.html

那里的人(Henry Hinze)说这是一个错误,通过安装版本 13 RC1 已修复。
但我的经验是相反的,在 postgresql v13.0 中它没有卡在启动循环中,但我注意到在安装 postgresql v13.1 后它正在这样做。

我可以确认我使用的是 postgresql 13.1 版,因为/usr/lib/postgresql/13/bin/postgres -V它给了我以下输出:

postgres (PostgreSQL) 13.1 (Ubuntu 13.1-1.pgdg18.04+1)

我正在使用 Ubuntu v18.04。
我已经完全卸载了 postgresql 并重新安装它并没有解决问题。从站上的 postgresql.conf 设置是默认设置。master上相关的postgresql.conf如下:

wal_level = logical 
checkpoint_timeout = 5min 
max_wal_size = 1GB
min_wal_size = 80MB

标签: postgresqlpostgresql-13

解决方案


推荐阅读