首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从分区表删除查询失败后,Postgres处于恢复模式(PG 12)

从分区表删除查询失败后,Postgres处于恢复模式(PG 12)
EN

Stack Overflow用户
提问于 2020-09-21 17:29:11
回答 1查看 510关注 0票数 1

我有一个用于处理简单表的代码,当同一个表被分区到多个子分区时,就停止工作了。

分布式应用程序(Spark)中,我们有代码可以在同一时间并行执行来自不同计算机的批删除查询(删除不同的记录)。

大多数查询都正常工作,但其中一个查询似乎在套接字连接超时上失败:

代码语言:javascript
复制
java.sql.BatchUpdateException: Batch entry 0 DELETE FROM my_table WHERE vessel_id='xxxxxx' AND day='2020-09-15 00:00:00+00'::timestamp was aborted: An I/O error occurred while sending to the backend.  Call getNextException to see other errors in the batch.

Caused by: java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:210)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)

When the code retries to run the task the connection fails on 
:FATAL:  the database system is in recovery mode

在数据库日志中,我看到:

代码语言:javascript
复制
2020-09-21 16:44:27 UTC::@:[26848]:DETAIL:  Failed process was running: DELETE FROM my_table WHERE vessel_id=$1 AND day=$2
2020-09-21 16:44:27 UTC::@:[26848]:LOG:  terminating any other active server processes
2020-09-21 16:44:27 UTC:172.31.4.110(59468):postgres@postgres:[27705]:WARNING:  terminating connection because of crash of another server process
2020-09-21 16:44:27 UTC:172.31.4.110(59468):postgres@postgres:[27705]:DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2020-09-21 16:44:27 UTC:172.31.4.110(59468):postgres@postgres:[27705]:HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2020-09-21 16:44:27 UTC:10.3.1.138(57926):rdsrepladmin@[unknown]:[26740]:WARNING:  terminating connection because of crash of another server process
2020-09-21 16:44:27 UTC:10.3.1.138(57926):rdsrepladmin@[unknown]:[26740]:DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2020-09-21 16:44:27 UTC:10.3.1.138(57926):rdsrepladmin@[unknown]:[26740]:HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2020-09-21 16:44:27 UTC::@:[22480]:WARNING:  terminating connection because of crash of another server process
2020-09-21 16:44:27 UTC::@:[22480]:DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2020-09-21 16:44:27 UTC::@:[22480]:HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2020-09-21 16:44:27 UTC:127.0.0.1(31826):rdsadmin@rdsadmin:[27967]:FATAL:  the database system is in recovery mode

知道当表被分区时数据库为什么会失败吗?为什么其他计算机上的所有其他连接都关闭,数据库进入恢复模式?

EN

回答 1

Stack Overflow用户

发布于 2021-03-29 13:55:55

在查看了日志之后,我发现这个问题已经没有记忆了。这个数据库实例是主要的实例,它负责编写、复制和删除,并且没有足够的内存同时处理所有这些任务。

修复方法是简单地添加更多内存。没什么花哨的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63997239

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档