↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 协议消息 / 逻辑复制格式

Commit Prepared (logical replication)

逻辑复制 Commit Prepared 格式,表示提交预备事务消息。

当前查看 PostgreSQL 18.6。

说明

逻辑复制 Commit Prepared 格式,表示提交预备事务消息。

层次
逻辑复制载荷,与前后端消息封装分开。
首个字段
Byte1('K')

用法

Commit Prepared

协议上下文

本节说明各逻辑复制消息的详细格式。这些消息由复制槽 SQL 接口返回,或由 walsender 发送。由 walsender 发送时,它们被封装在复制协议的 WAL 消息中(参见第 54.4 节),消息流程通常与物理复制相同。Stream Start、Stream Stop、Stream Commit 和 Stream Abort 从协议版本 2 起可用。Begin Prepare、Prepare、Commit Prepared、Rollback Prepared 和 Stream Prepare 从协议版本 3 起可用。以下消息部分为上述消息所共用。

按手册顺序排列的字段

位置格式含义
1Byte1('K')将该消息标识为 Commit Prepared 消息。
2Int8(0)标志;目前未使用。
3Int64 (XLogRecPtr)预备事务提交的 LSN。
4Int64 (XLogRecPtr)预备事务提交的结束 LSN。
5Int64 (TimestampTz)事务的提交时间戳。其值为自 PostgreSQL 纪元(2000-01-01)起经过的微秒数。
6Int32 (TransactionId)事务的 Xid。
7字符串预备事务的用户定义 GID。

手册定义

Byte1('K')

将该消息标识为 Commit Prepared 消息。

Int8(0)

标志;目前未使用。

Int64 (XLogRecPtr)

预备事务提交的 LSN。

Int64 (XLogRecPtr)

预备事务提交的结束 LSN。

Int64 (TimestampTz)

事务的提交时间戳。其值为自 PostgreSQL 纪元(2000-01-01)起经过的微秒数。

Int32 (TransactionId)

事务的 Xid。

字符串

预备事务的用户定义 GID。

相关条目

文档与源码

来源构建
版本
18.6
构建
https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
来源指纹
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

版本比较

PostgreSQL 14 → 15: 新增收录。

以下差异保留原始字段名与英文源描述。

--- PostgreSQL 14
+++ PostgreSQL 15
@@ -1 +1,33 @@
-该版未收录
+{
+  "fields": [
+    {
+      "description": "Identifies the message as the commit of a prepared transaction message.",
+      "format": "Byte1('K')"
+    },
+    {
+      "description": "Flags; currently unused.",
+      "format": "Int8(0)"
+    },
+    {
+      "description": "The LSN of the commit of the prepared transaction.",
+      "format": "Int64 (XLogRecPtr)"
+    },
+    {
+      "description": "The end LSN of the commit of the prepared transaction.",
+      "format": "Int64 (XLogRecPtr)"
+    },
+    {
+      "description": "Commit timestamp of the transaction. The value is in number of microseconds since PostgreSQL epoch (2000-01-01).",
+      "format": "Int64 (TimestampTz)"
+    },
+    {
+      "description": "Xid of the transaction.",
+      "format": "Int32 (TransactionId)"
+    },
+    {
+      "description": "The user defined GID of the prepared transaction.",
+      "format": "String"
+    }
+  ],
+  "layer": "logical replication"
+}

比较已记录的接口与属性,排除来源指纹和构建元数据。某个样本中没有记录,不能据此判断实际引入或移除的版本。

相关条目

导出 JSON · 返回协议消息 · 收录范围为 PostgreSQL 15 至 20;最早采样版本不一定是实际引入版本。