gooderp18绿色标准版
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

64 行
6.6KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>52.5. Logical Streaming Replication Protocol</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="protocol-replication.html" title="52.4. Streaming Replication Protocol" /><link rel="next" href="protocol-message-types.html" title="52.6. Message Data Types" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">52.5. Logical Streaming Replication Protocol</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="protocol-replication.html" title="52.4. Streaming Replication Protocol">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="protocol.html" title="Chapter 52. Frontend/Backend Protocol">Up</a></td><th width="60%" align="center">Chapter 52. Frontend/Backend Protocol</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="protocol-message-types.html" title="52.6. Message Data Types">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="PROTOCOL-LOGICAL-REPLICATION"><div class="titlepage"><div><div><h2 class="title" style="clear: both">52.5. Logical Streaming Replication Protocol</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="protocol-logical-replication.html#PROTOCOL-LOGICAL-REPLICATION-PARAMS">52.5.1. Logical Streaming Replication Parameters</a></span></dt><dt><span class="sect2"><a href="protocol-logical-replication.html#PROTOCOL-LOGICAL-MESSAGES">52.5.2. Logical Replication Protocol Messages</a></span></dt><dt><span class="sect2"><a href="protocol-logical-replication.html#PROTOCOL-LOGICAL-MESSAGES-FLOW">52.5.3. Logical Replication Protocol Message Flow</a></span></dt></dl></div><p>
  3. This section describes the logical replication protocol, which is the message
  4. flow started by the <code class="literal">START_REPLICATION</code>
  5. <code class="literal">SLOT</code> <em class="replaceable"><code>slot_name</code></em>
  6. <code class="literal">LOGICAL</code> replication command.
  7. </p><p>
  8. The logical streaming replication protocol builds on the primitives of
  9. the physical streaming replication protocol.
  10. </p><div class="sect2" id="PROTOCOL-LOGICAL-REPLICATION-PARAMS"><div class="titlepage"><div><div><h3 class="title">52.5.1. Logical Streaming Replication Parameters</h3></div></div></div><p>
  11. The logical replication <code class="literal">START_REPLICATION</code> command
  12. accepts following parameters:
  13. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
  14. proto_version
  15. </span></dt><dd><p>
  16. Protocol version. Currently only version <code class="literal">1</code> is
  17. supported.
  18. </p></dd><dt><span class="term">
  19. publication_names
  20. </span></dt><dd><p>
  21. Comma separated list of publication names for which to subscribe
  22. (receive changes). The individual publication names are treated
  23. as standard objects names and can be quoted the same as needed.
  24. </p></dd></dl></div><p>
  25. </p></div><div class="sect2" id="PROTOCOL-LOGICAL-MESSAGES"><div class="titlepage"><div><div><h3 class="title">52.5.2. Logical Replication Protocol Messages</h3></div></div></div><p>
  26. The individual protocol messages are discussed in the following
  27. subsections. Individual messages are described in
  28. <a class="xref" href="protocol-logicalrep-message-formats.html" title="52.9. Logical Replication Message Formats">Section 52.9</a>.
  29. </p><p>
  30. All top-level protocol messages begin with a message type byte.
  31. While represented in code as a character, this is a signed byte with no
  32. associated encoding.
  33. </p><p>
  34. Since the streaming replication protocol supplies a message length there
  35. is no need for top-level protocol messages to embed a length in their
  36. header.
  37. </p></div><div class="sect2" id="PROTOCOL-LOGICAL-MESSAGES-FLOW"><div class="titlepage"><div><div><h3 class="title">52.5.3. Logical Replication Protocol Message Flow</h3></div></div></div><p>
  38. With the exception of the <code class="literal">START_REPLICATION</code> command and
  39. the replay progress messages, all information flows only from the backend
  40. to the frontend.
  41. </p><p>
  42. The logical replication protocol sends individual transactions one by one.
  43. This means that all messages between a pair of Begin and Commit messages
  44. belong to the same transaction.
  45. </p><p>
  46. Every sent transaction contains zero or more DML messages (Insert,
  47. Update, Delete). In case of a cascaded setup it can also contain Origin
  48. messages. The origin message indicated that the transaction originated on
  49. different replication node. Since a replication node in the scope of logical
  50. replication protocol can be pretty much anything, the only identifier
  51. is the origin name. It's downstream's responsibility to handle this as
  52. needed (if needed). The Origin message is always sent before any DML
  53. messages in the transaction.
  54. </p><p>
  55. Every DML message contains an arbitrary relation ID, which can be mapped to
  56. an ID in the Relation messages. The Relation messages describe the schema of the
  57. given relation. The Relation message is sent for a given relation either
  58. because it is the first time we send a DML message for given relation in the
  59. current session or because the relation definition has changed since the
  60. last Relation message was sent for it. The protocol assumes that the client
  61. is capable of caching the metadata for as many relations as needed.
  62. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="protocol-replication.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="protocol.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="protocol-message-types.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">52.4. Streaming Replication Protocol </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 52.6. Message Data Types</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1