diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 380be5fb17c..2f4dde3bebd 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -2797,9 +2797,11 @@ The commands accepted in replication mode are:
- Protocol version. Currently only version 1 is
- supported.
-
+ Protocol version. Currently versions 1 and
+ 2 are supported. The version 2
+ is supported only for server version 14 and above, and it allows
+ streaming of large in-progress transactions.
+
@@ -2855,7 +2857,10 @@ The commands accepted in replication mode are:
The logical replication protocol sends individual transactions one by one.
This means that all messages between a pair of Begin and Commit messages
- belong to the same transaction.
+ belong to the same transaction. It also sends changes of large in-progress
+ transactions between a pair of Stream Start and Stream Stop messages. The
+ last stream of such a transaction contains Stream Commit or Stream Abort
+ message.
@@ -6457,8 +6462,8 @@ Message
- Xid of the transaction. The XID is sent only when user has
- requested streaming of in-progress transactions.
+ Xid of the transaction (only present for streamed transactions).
+ This field is available since protocol version 2.
@@ -6646,6 +6651,17 @@ Relation
Int32
+
+ Xid of the transaction (only present for streamed transactions).
+ This field is available since protocol version 2.
+
+
+
+
+
+ Int32
+
+
ID of the relation.
@@ -6767,6 +6783,17 @@ Type
Int32
+
+ Xid of the transaction (only present for streamed transactions).
+ This field is available since protocol version 2.
+
+
+
+
+
+ Int32
+
+
ID of the data type.
@@ -6821,6 +6848,17 @@ Insert
Int32
+
+ Xid of the transaction (only present for streamed transactions).
+ This field is available since protocol version 2.
+
+
+
+
+
+ Int32
+
+
ID of the relation corresponding to the ID in the relation
message.
@@ -6877,6 +6915,17 @@ Update
Int32
+
+ Xid of the transaction (only present for streamed transactions).
+ This field is available since protocol version 2.
+
+
+
+
+
+ Int32
+
+
ID of the relation corresponding to the ID in the relation
message.
@@ -6980,6 +7029,17 @@ Delete
Int32
+
+ Xid of the transaction (only present for streamed transactions).
+ This field is available since protocol version 2.
+
+
+
+
+
+ Int32
+
+
ID of the relation corresponding to the ID in the relation
message.
@@ -7058,6 +7118,17 @@ Truncate
Int32
+
+ Xid of the transaction (only present for streamed transactions).
+ This field is available since protocol version 2.
+
+
+
+
+
+ Int32
+
+
Number of relations
@@ -7095,6 +7166,206 @@ Truncate
+The following messages (Stream Start, Stream End, Stream Commit, and
+Stream Abort) are available since protocol version 2.
+
+
+
+
+
+
+
+Stream Start
+
+
+
+
+
+
+
+ Byte1('S')
+
+
+
+ Identifies the message as a stream start message.
+
+
+
+
+
+ Int32
+
+
+
+ Xid of the transaction.
+
+
+
+
+
+ Int8
+
+
+
+ A value of 1 indicates this is the first stream segment for
+ this XID, 0 for any other stream segment.
+
+
+
+
+
+
+
+
+
+
+
+Stream Stop
+
+
+
+
+
+
+
+ Byte1('E')
+
+
+
+ Identifies the message as a stream stop message.
+
+
+
+
+
+
+
+
+
+
+
+Stream Commit
+
+
+
+
+
+
+
+ Byte1('c')
+
+
+
+ Identifies the message as a stream commit message.
+
+
+
+
+
+ Int32
+
+
+
+ Xid of the transaction.
+
+
+
+
+
+ Int8
+
+
+
+ Flags; currently unused (must be 0).
+
+
+
+
+
+ Int64
+
+
+
+ The LSN of the commit.
+
+
+
+
+
+ Int64
+
+
+
+ The end LSN of the transaction.
+
+
+
+
+
+ Int64
+
+
+
+ Commit timestamp of the transaction. The value is in number
+ of microseconds since PostgreSQL epoch (2000-01-01).
+
+
+
+
+
+
+
+
+
+
+
+Stream Abort
+
+
+
+
+
+
+
+ Byte1('A')
+
+
+
+ Identifies the message as a stream abort message.
+
+
+
+
+
+ Int32
+
+
+
+ Xid of the transaction.
+
+
+
+
+
+ Int32
+
+
+
+ Xid of the subtransaction (will be same as xid of the transaction for top-level
+ transactions).
+
+
+
+
+
+
+
+
+
+
+
+
+
The following message parts are shared by the above messages.