背景:某夜晚,业务方反馈GP数据库无法查询。速看集群状态gpstate -m 集群状态正常无任何实例异常,登录数据库查询运行会话,此时以无法查询抛出如下异常信息。
=#select * from pg_stat_activity;
FATAL: the limit of 250 distributed transactions has been reached.
DETAL: the global user configuration (GUC) server parameter max_prepared_transactions controls this limit.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost .Attempting reset:succeeded
命令行查看数据库进程ps -ef|grep postgres发现数据库连接爆满,会话为正常繁忙状态下3倍,会话堆积阻塞,所有进程显示为waiting状态。于是紧急处理清理部分非常规业务进程,连接数据下降,任务正常运行通畅,登录数据库正常查询,堆积任务迅速执行完成。
查询max_prepared_transactions参数:show max_prepared_transactions 为默认值,小于数据库连接数据max_connections。
官方文档:
Sets the maximum number of transactions that can be in the prepared state simultaneously. Greenplum uses prepared transactions internally to ensure data integrity across the segments. This value must be at least as large as the value of max_connections on the master. Segment instances should be set to the same value as the master.
百度翻译:设置可同时处于准备状态的最大事务数。Greenplum在内部使用准备好的事务来确保跨段的数据完整性。此值必须至少与主机上最大连接数值一样大。段实例应设置为与主实例相同的值。
max_prepared_transactions参数值建议与max_connections参数值一致。
改