规模化的PostgreSQL。在不停机的情况下改变数据库模式

Braintree Payments uses PostgreSQL as its primary datastore. We rely heavily on the data safety and consistency guarantees a traditional relational database offers us, but these guarantees come with certain operational difficulties. To make things even more interesting, we allow zero scheduled functional downtime for our main payments processing services.

Braintree Payments使用PostgreSQL作为其主要数据存储。我们非常依赖传统关系型数据库为我们提供的数据安全和一致性保障,但这些保障伴随着某些操作上的困难。为了使事情更加有趣,我们允许我们的主要支付处理服务有零计划的功能停机时间。

Several years ago we published a blog post detailing some of the things we had learned about how to safely run DDL (data definition language) operations without interrupting our production API traffic.

几年前,我们发表了一篇博文,详细介绍了我们在如何安全运行DDL(数据定义语言)操作而不中断我们的生产API流量方面的一些经验。

Since that time PostgreSQL has gone through quite a few major upgrade cycles — several of which have added improved support for concurrent DDL. We’ve also further refined our processes. Given how much has changed, we figured it was time for a blog post redux.

从那时起,PostgreSQL经历了几个主要的升级周期--其中几个周期增加了对并发DDL的改进支持。我们也进一步完善了我们的流程。鉴于发生了这么多变化,我们认为是时候重新发表一篇博文了。

In this post we’ll address the following topics:

在这篇文章中,我们将讨论以下主题。

First, some basics

首先,一些基本知识

For all code and database changes, we require that:

对于所有的代码和数据库修改,我们要求。

  • Live code and schemas be forward-compatible with updated code and schemas: this allows us to roll out deploys gradually across a fleet of application servers and database clusters.
  • 实时代码和模式与更新的代码和模式向前兼容:这使我们能够在应用服务器和数据库集群的机群中逐步推出部署。
  • New code and schemas be backward-compatible with live code and schemas: this allows us to roll back any change to the previous version in the event of unexpected errors.
  • 新的代码和模式与现行的代码和模式向后兼容:这使我们能够在出现意外错误时将任何变化回滚到以前的版本。

For all DDL operations we require that:

对于所有的DDL操作,我们要求。

  • Any exclusive locks acquired on tables or indexes be held for at most ~2 seconds.
  • 任何在表或索引上获得的独占锁最多保持~2秒。
  • Rollback strategies do not involve reverting the database schema to its previous version.
  • 回滚策略不涉及将数据库模式恢复到以前的版本。

Transactionality

交易性

PostgreSQL supports transactiona...

开通本站会员,查看完整译文。

Home - Wiki
Copyright © 2011-2024 iteam. Current version is 2.139.0. UTC+08:00, 2024-12-23 10:59
浙ICP备14020137号-1 $Map of visitor$