为 PostgreSQL JDBC 驱动程序打补丁
This blog post describes a recent contribution from Zalando to the Postgres JDBC driver to address a long-standing issue with the driver’s integration with Postgres’ logical replication that resulted in runaway Write-Ahead Log (WAL) growth. We will describe the issue, how it affected us at Zalando, and detail the fix made upstream in the JDBC driver that fixes the issue for Debezium and all other clients of the Postgres JDBC driver.
本博客文章描述了Zalando最近对Postgres JDBC驱动程序的贡献,以解决驱动程序与Postgres逻辑复制的集成中存在的长期问题,该问题导致Write-Ahead Log(WAL)增长失控。我们将描述该问题,它如何影响我们在Zalando的使用,并详细介绍在JDBC驱动程序中进行的修复,该修复可为Debezium和所有其他Postgres JDBC驱动程序的客户端解决该问题。
Postgres Logical Replication at Zalando
Zalando的Postgres逻辑复制
Builders at Zalando have access to a low-code solution that allows them to declare event streams that source from Postgres databases. Each event stream declaration provisions a micro application, powered by Debezium Engine, that uses Postgres Logical Replication to publish table-level change events as they occur. Capable of publishing events to a variety of different technologies, with arbitrary event transformations via AWS Lambda, these event streams form a core part of the Zalando infrastructure offering. At the time of writing, there are hundreds of these Postgres-sourced event streams out in the wild at Zalando.
Zalando的构建者可以访问低代码解决方案,该解决方案允许他们声明从Postgres数据库源的事件流。每个事件流声明都提供了一个微型应用程序,由Debezium Engine提供支持,使用Postgres逻辑复制发布表级别的更改事件。能够将事件发布到各种不同的技术中,通过AWS Lambda进行任意事件转换,这些事件流是Zalando基础架构提供的核心部分。撰写本文时,在Zalando有数百个这些源自Postgres的事件流。
One common problem that occurs with Logical Replication is excessive growth of Postgres WAL logs. At times, the Write Ahead Log (WAL) growth could occur to the point where the WAL would consume all of the available disk space on the database node resulting in demotion of the node to read-only - an undesirable outcome in a production setting indeed! This issue is prevalent in cases where a table being streamed receives very little to no write traffic - but once a write is made, any excessive WAL growth disap...