Postgresql 中文操作指南

Chapter 65. Generic WAL Records

虽然所有内置的 WAL 记录模块都有自己类型的 WAL 记录,但也有一个通用 WAL 记录类型,它以通用方式描述了页面中的更改。这对提供自定义访问方法的扩展很有用。

Although all built-in WAL-logged modules have their own types of WAL records, there is also a generic WAL record type, which describes changes to pages in a generic way. This is useful for extensions that provide custom access methods.

Custom WAL Resource Managers 相比,通用 WAL 更易于扩展实现,并且不要求加载扩展库以应用记录。

In comparison with Custom WAL Resource Managers, Generic WAL is simpler for an extension to implement and does not require the extension library to be loaded in order to apply the records.

Note

Logical Decoding 期间,通用 WAL 记录将被忽略。如果需要为扩展执行逻辑解码,请考虑使用自定义 WAL 资源管理器。

Generic WAL records are ignored during Logical Decoding. If logical decoding is required for your extension, consider a Custom WAL Resource Manager.

用于构建通用 WAL 记录的 API 在 access/generic_xlog.h 中定义,并在 access/transam/generic_xlog.c 中实施。

The API for constructing generic WAL records is defined in access/generic_xlog.h and implemented in access/transam/generic_xlog.c.

若要使用通用 WAL 记录工具执行 WAL 记录的数据更新,请遵循这些步骤:

To perform a WAL-logged data update using the generic WAL record facility, follow these steps:

可以通过调用 GenericXLogAbort(state) 在上述任何步骤之间取消 WAL 记录的构建。这将放弃对页面图像副本的所有更改。

WAL record construction can be canceled between any of the above steps by calling GenericXLogAbort(state). This will discard all changes to the page image copies.

使用通用 WAL 记录工具时,请注意以下几点:

Please note the following points when using the generic WAL record facility: