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

43 行
5.4KB

  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>30.5. Architecture</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="logical-replication-restrictions.html" title="30.4. Restrictions" /><link rel="next" href="logical-replication-monitoring.html" title="30.6. Monitoring" /></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">30.5. Architecture</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="logical-replication-restrictions.html" title="30.4. Restrictions">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="logical-replication.html" title="Chapter 30. Logical Replication">Up</a></td><th width="60%" align="center">Chapter 30. Logical Replication</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="logical-replication-monitoring.html" title="30.6. Monitoring">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="LOGICAL-REPLICATION-ARCHITECTURE"><div class="titlepage"><div><div><h2 class="title" style="clear: both">30.5. Architecture</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="logical-replication-architecture.html#LOGICAL-REPLICATION-SNAPSHOT">30.5.1. Initial Snapshot</a></span></dt></dl></div><p>
  3. Logical replication starts by copying a snapshot of the data on the
  4. publisher database. Once that is done, changes on the publisher are sent
  5. to the subscriber as they occur in real time. The subscriber applies data
  6. in the order in which commits were made on the publisher so that
  7. transactional consistency is guaranteed for the publications within any
  8. single subscription.
  9. </p><p>
  10. Logical replication is built with an architecture similar to physical
  11. streaming replication (see <a class="xref" href="warm-standby.html#STREAMING-REPLICATION" title="26.2.5. Streaming Replication">Section 26.2.5</a>). It is
  12. implemented by <span class="quote">“<span class="quote">walsender</span>”</span> and <span class="quote">“<span class="quote">apply</span>”</span>
  13. processes. The walsender process starts logical decoding (described
  14. in <a class="xref" href="logicaldecoding.html" title="Chapter 48. Logical Decoding">Chapter 48</a>) of the WAL and loads the standard
  15. logical decoding plugin (pgoutput). The plugin transforms the changes read
  16. from WAL to the logical replication protocol
  17. (see <a class="xref" href="protocol-logical-replication.html" title="52.5. Logical Streaming Replication Protocol">Section 52.5</a>) and filters the data
  18. according to the publication specification. The data is then continuously
  19. transferred using the streaming replication protocol to the apply worker,
  20. which maps the data to local tables and applies the individual changes as
  21. they are received, in correct transactional order.
  22. </p><p>
  23. The apply process on the subscriber database always runs with
  24. <code class="varname">session_replication_role</code> set
  25. to <code class="literal">replica</code>, which produces the usual effects on triggers
  26. and constraints.
  27. </p><p>
  28. The logical replication apply process currently only fires row triggers,
  29. not statement triggers. The initial table synchronization, however, is
  30. implemented like a <code class="command">COPY</code> command and thus fires both row
  31. and statement triggers for <code class="command">INSERT</code>.
  32. </p><div class="sect2" id="LOGICAL-REPLICATION-SNAPSHOT"><div class="titlepage"><div><div><h3 class="title">30.5.1. Initial Snapshot</h3></div></div></div><p>
  33. The initial data in existing subscribed tables are snapshotted and
  34. copied in a parallel instance of a special kind of apply process.
  35. This process will create its own temporary replication slot and
  36. copy the existing data. Once existing data is copied, the worker
  37. enters synchronization mode, which ensures that the table is brought
  38. up to a synchronized state with the main apply process by streaming
  39. any changes that happened during the initial data copy using standard
  40. logical replication. Once the synchronization is done, the control
  41. of the replication of the table is given back to the main apply
  42. process where the replication continues as normal.
  43. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="logical-replication-restrictions.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="logical-replication.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="logical-replication-monitoring.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">30.4. Restrictions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 30.6. Monitoring</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1